(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.

This commit is contained in:
rubidium
2008-05-10 13:46:36 +00:00
parent 935434333b
commit d24442ae8b
6 changed files with 478 additions and 194 deletions

View File

@@ -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[] = {