src/widget/widget_closebox.cpp
branchcpp_gui
changeset 6282 c5b92f2d924f
parent 6264 9fc3b5467396
child 6289 be3d8bd9fb02
--- a/src/widget/widget_closebox.cpp	Sat Mar 03 11:50:45 2007 +0000
+++ b/src/widget/widget_closebox.cpp	Sat Mar 03 16:11:18 2007 +0000
@@ -3,6 +3,7 @@
 #include "../stdafx.h"
 #include <stdarg.h>
 #include "../openttd.h"
+#include "table/strings.h"
 #include "../debug.h"
 #include "../functions.h"
 #include "../map.h"
@@ -17,4 +18,35 @@
 #include "../helpers.hpp"
 #include "window_events.hpp"
 
+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));
+
+	m_tooltips = STR_018B_CLOSE_WINDOW;
+
+	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
+