(svn r9091) [cpp_gui] -Codechange: Widgets now use container's coordinate space instead of window's space
/* $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 CloseBox::OnCreate(EvtCreate &ev)
{
Point16 size(DEFAULT_WIDTH, DEFAULT_HEIGHT);
// move itself to the left of the parent
SetTopLeft(m_container->TopLeft());
SetBottomRight(TopLeft() + size - Point16(1, 1));
SetAnchors(PIN_LEFT | PIN_TOP);
super::OnCreate(ev);
}
/*virtual*/ void CloseBox::OnPaint(EvtPaint &ev)
{
assert(Size() == Point16(DEFAULT_WIDTH, DEFAULT_HEIGHT));
DrawBackground(ev);
DrawString(Left() + 2, Top() + 2, STR_00C5, 0);
}
/*virtual*/ void CloseBox::OnLeftClick(EvtLeftClick &ev)
{
BaseWindow *w = GetWindow();
assert(w != NULL);
w->Close();
}
}; // namespace gui