/* $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::OnPaint(EvtPaint &ev)
{
assert(Size() == Point16(DEFAULT_WIDTH, DEFAULT_HEIGHT));
DrawBackground(ev);
DrawSprite(m_pushed ? SPR_PIN_UP : SPR_PIN_DOWN, PAL_NONE, Left() + 2 + m_pushed, Top() + 3 + m_pushed);
}
/*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