diff options
Diffstat (limited to 'textscreen/txt_window.c')
-rw-r--r-- | textscreen/txt_window.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/textscreen/txt_window.c b/textscreen/txt_window.c index 8cbddb55..67543735 100644 --- a/textscreen/txt_window.c +++ b/textscreen/txt_window.c @@ -97,6 +97,7 @@ void TXT_CloseWindow(txt_window_t *window) int i; TXT_EmitSignal(window, "closed"); + TXT_RemoveDesktopWindow(window); free(window->title); @@ -113,8 +114,6 @@ void TXT_CloseWindow(txt_window_t *window) // Destroy table and window TXT_DestroyWidget(window); - - TXT_RemoveDesktopWindow(window); } static void CalcWindowPosition(txt_window_t *window) @@ -218,7 +217,7 @@ static void DrawActionArea(txt_window_t *window) { if (window->actions[i] != NULL) { - TXT_DrawWidget(window->actions[i], 0); + TXT_DrawWidget(window->actions[i]); } } } @@ -317,7 +316,7 @@ void TXT_LayoutWindow(txt_window_t *window) TXT_LayoutWidget(widgets); } -void TXT_DrawWindow(txt_window_t *window, int selected) +void TXT_DrawWindow(txt_window_t *window) { txt_widget_t *widgets; @@ -331,7 +330,7 @@ void TXT_DrawWindow(txt_window_t *window, int selected) // Draw all widgets - TXT_DrawWidget(window, selected); + TXT_DrawWidget(window); // Draw an action area, if we have one @@ -410,7 +409,21 @@ static void MouseButtonPress(txt_window_t *window, int b) && x >= widget->x && x < (signed) (widget->x + widget->w) && y >= widget->y && y < (signed) (widget->y + widget->h)) { + int was_focused; + + // Main table temporarily loses focus when action area button + // is clicked. This way, any active input boxes that depend + // on having focus will save their values before the + // action is performed. + + was_focused = window->table.widget.focused; + TXT_SetWidgetFocus(window, 0); + TXT_SetWidgetFocus(window, was_focused); + + // Pass through mouse press. + TXT_WidgetMousePress(widget, x, y, b); + break; } } @@ -474,6 +487,11 @@ void TXT_SetMouseListener(txt_window_t *window, window->mouse_listener_data = user_data; } +void TXT_SetWindowFocus(txt_window_t *window, int focused) +{ + TXT_SetWidgetFocus(window, focused); +} + txt_window_t *TXT_MessageBox(char *title, char *message, ...) { txt_window_t *window; |