summaryrefslogtreecommitdiff
path: root/src/osk_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/osk_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/osk_gui.cpp')
-rw-r--r--src/osk_gui.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp
index 681762e08..f92bb16b0 100644
--- a/src/osk_gui.cpp
+++ b/src/osk_gui.cpp
@@ -157,11 +157,7 @@ static void OskWndProc(Window *w, WindowEvent *e)
if (qs->orig == NULL || strcmp(qs->text.buf, qs->orig) != 0) {
/* pass information by simulating a button press on parent window */
if (WP(w, osk_d).ok_btn != 0) {
- Window *parent = w->parent;
- WindowEvent e;
- e.event = WE_CLICK;
- e.we.click.widget = WP(w, osk_d).ok_btn;
- parent->HandleWindowEvent(&e);
+ w->parent->OnClick(e->we.click.pt, WP(w, osk_d).ok_btn);
}
}
delete w;
@@ -169,11 +165,7 @@ static void OskWndProc(Window *w, WindowEvent *e)
case OSK_WIDGET_CANCEL:
if (WP(w, osk_d).cancel_btn != 0) { // pass a cancel event to the parent window
- Window *parent = w->parent;
- WindowEvent e;
- e.event = WE_CLICK;
- e.we.click.widget = WP(w, osk_d).cancel_btn;
- parent->HandleWindowEvent(&e);
+ w->parent->OnClick(e->we.click.pt, WP(w, osk_d).cancel_btn);
} else { // or reset to original string
strcpy(qs->text.buf, WP(w, osk_d).orig);
UpdateTextBufferSize(&qs->text);