summaryrefslogtreecommitdiff
path: root/src/misc_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-10 13:46:36 +0000
committerrubidium <rubidium@openttd.org>2008-05-10 13:46:36 +0000
commitd24442ae8b1b84646982cbdf0ff638caf42e1132 (patch)
tree03bcd6a5e6e6fd5771fa462f05a599c97c6a9661 /src/misc_gui.cpp
parent935434333badb8376f9dde535ddc50c18e9af3aa (diff)
downloadopenttd-d24442ae8b1b84646982cbdf0ff638caf42e1132.tar.xz
(svn r13029) -Codechange: more work in the road to getting the WP macros and byte[WINDOW_CUSTOM_SIZE] removed. This step changes the event handling to work directly on the Window class instead of via a function pointer and big switches while keeping backward compatability while we're rewriting the Windows to the new scheme.
Diffstat (limited to 'src/misc_gui.cpp')
-rw-r--r--src/misc_gui.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index dc224d3f4..89f76e6dc 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -80,10 +80,8 @@ class LandInfoWindow : public Window {
public:
char landinfo_data[LAND_INFO_LINES][LAND_INFO_LINE_BUFF_SIZE];
- virtual void HandleWindowEvent(WindowEvent *e)
+ virtual void HandlePaintEvent()
{
- if (e->event != WE_PAINT) return;
-
DrawWindowWidgets(this);
DoDrawStringCentered(140, 16, this->landinfo_data[0], TC_LIGHT_BLUE);
@@ -1008,10 +1006,7 @@ static void QueryStringWndProc(Window *w, WindowEvent *e)
/* If the parent is NULL, the editbox is handled by general function
* HandleOnEditText */
if (parent != NULL) {
- WindowEvent e;
- e.event = WE_ON_EDIT_TEXT;
- e.we.edittext.str = qs->text.buf;
- parent->HandleWindowEvent(&e);
+ parent->OnQueryTextFinished(qs->text.buf);
} else {
HandleOnEditText(qs->text.buf);
}
@@ -1036,17 +1031,12 @@ static void QueryStringWndProc(Window *w, WindowEvent *e)
case WE_DESTROY: // Call cancellation of query, if we have not handled it before
if (!qs->handled && w->parent != NULL) {
- WindowEvent e;
- Window *parent = w->parent;
-
qs->handled = true;
- e.event = WE_ON_EDIT_TEXT;
- e.we.edittext.str = NULL;
- parent->HandleWindowEvent(&e);
+ w->parent->OnQueryTextFinished(NULL);
}
ClrBit(_no_scroll, SCROLL_EDIT);
break;
- }
+ }
}
static const Widget _query_string_widgets[] = {