src/widget/widget_stickybox.cpp
author KUDr
Tue, 06 Mar 2007 20:18:17 +0000
branchcpp_gui
changeset 6292 272c690043e3
parent 6290 8078f7a3c8a0
child 6301 e0251f797d59
permissions -rw-r--r--
(svn r9032) [cpp_gui] -Cleanup(r9023): removed forgotten unused StickyBox::OnPaint()
/* $Id$ */
#include "../stdafx.h"
#include <stdarg.h>
#include "../openttd.h"
#include "../debug.h"
#include "../functions.h"
#include "../map.h"
#include "../player.h"
#include "../window.h"
#include "../gfx.h"
#include "../viewport.h"
#include "../console.h"
#include "../variables.h"
#include "../table/sprites.h"
#include "../genworld.h"
#include "../helpers.hpp"
#include "window_events.hpp"
#include "widget_types.h"

namespace gui {

/*virtual*/ void StickyBox::OnCreate(EvtCreate &ev)
{
	// move itself to the right side of the parent
	Rect16 rc = m_container->GetRect();
	rc.SetLeft(rc.Right() - (DEFAULT_WIDTH - 1));
	rc.SetBottom(rc.Top() + (DEFAULT_HEIGHT - 1));
	SetRect(rc);

	SetAnchors(PIN_TOP | PIN_RIGHT);
	super::OnCreate(ev);
}

/*virtual*/ void StickyBox::OnLeftClick(EvtLeftClick &ev)
{
	BaseWindow *w = GetWindow();
	assert(w != NULL);

	w->m_feature_flags = (w->m_feature_flags & ~FF_STICKED) | (m_pushed ? FF_STICKED : FF_NONE);
}

}; // namespace gui