src/widget/widget_closebox.cpp
branchcpp_gui
changeset 6282 c5b92f2d924f
parent 6264 9fc3b5467396
child 6289 be3d8bd9fb02
equal deleted inserted replaced
6281:2ae707873e23 6282:c5b92f2d924f
     1 /* $Id$ */
     1 /* $Id$ */
     2 
     2 
     3 #include "../stdafx.h"
     3 #include "../stdafx.h"
     4 #include <stdarg.h>
     4 #include <stdarg.h>
     5 #include "../openttd.h"
     5 #include "../openttd.h"
       
     6 #include "table/strings.h"
     6 #include "../debug.h"
     7 #include "../debug.h"
     7 #include "../functions.h"
     8 #include "../functions.h"
     8 #include "../map.h"
     9 #include "../map.h"
     9 #include "../player.h"
    10 #include "../player.h"
    10 #include "../window.h"
    11 #include "../window.h"
    15 #include "../table/sprites.h"
    16 #include "../table/sprites.h"
    16 #include "../genworld.h"
    17 #include "../genworld.h"
    17 #include "../helpers.hpp"
    18 #include "../helpers.hpp"
    18 #include "window_events.hpp"
    19 #include "window_events.hpp"
    19 
    20 
       
    21 namespace gui {
    20 
    22 
       
    23 /*virtual*/ void CloseBox::OnCreate(EvtCreate &ev)
       
    24 {
       
    25 	Point16 size(DEFAULT_WIDTH, DEFAULT_HEIGHT);
       
    26 	// move itself to the left of the parent
       
    27 	SetTopLeft(m_container->TopLeft());
       
    28 	SetBottomRight(TopLeft() +  size - Point16(1, 1));
       
    29 
       
    30 	m_tooltips = STR_018B_CLOSE_WINDOW;
       
    31 
       
    32 	SetAnchors(PIN_LEFT | PIN_TOP);
       
    33 	super::OnCreate(ev);
       
    34 }
       
    35 
       
    36 /*virtual*/ void CloseBox::OnPaint(EvtPaint &ev)
       
    37 {
       
    38 	assert(Size() == Point16(DEFAULT_WIDTH, DEFAULT_HEIGHT));
       
    39 
       
    40 	DrawBackground(ev);
       
    41 	DrawString(Left() + 2, Top() + 2, STR_00C5, 0);
       
    42 }
       
    43 
       
    44 /*virtual*/ void CloseBox::OnLeftClick(EvtLeftClick &ev)
       
    45 {
       
    46 	BaseWindow *w = GetWindow();
       
    47 	assert(w != NULL);
       
    48 	w->Close();
       
    49 }
       
    50 
       
    51 }; // namespace gui
       
    52