From b144a5451cb451d91bacafd80cab04640d1c1af1 Mon Sep 17 00:00:00 2001 From: alberth Date: Thu, 4 Jun 2009 14:07:05 +0000 Subject: (svn r16516) -Codechange: Added click and drag handling for nested widgets. --- src/window_gui.h | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/window_gui.h') diff --git a/src/window_gui.h b/src/window_gui.h index 36ebaec61..62757f9c4 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -169,18 +169,19 @@ public: Owner owner; ///< The owner of the content shown in this window. Company colour is acquired from this variable. - ViewportData *viewport; ///< Pointer to viewport data, if present. - Widget *widget; ///< Widgets of the window. - uint widget_count; ///< Number of widgets of the window. - uint32 desc_flags; ///< Window/widgets default flags setting. @see WindowDefaultFlag - const Widget *focused_widget; ///< Currently focused widget, or \c NULL if no widget has focus. - NWidgetBase *nested_root; ///< Root of the nested tree. - NWidgetCore **nested_array; ///< Array of pointers into the tree. - uint nested_array_size; ///< Size of the nested array. + ViewportData *viewport; ///< Pointer to viewport data, if present. + Widget *widget; ///< Widgets of the window. + uint widget_count; ///< Number of widgets of the window. + uint32 desc_flags; ///< Window/widgets default flags setting. @see WindowDefaultFlag + const Widget *focused_widget; ///< Currently focused widget, or \c NULL if no widget has focus. + const NWidgetCore *nested_focus; ///< Currently focused nested widget, or \c NULL if no nested widget has focus. + NWidgetBase *nested_root; ///< Root of the nested tree. + NWidgetCore **nested_array; ///< Array of pointers into the tree. + uint nested_array_size; ///< Size of the nested array. - Window *parent; ///< Parent window - Window *z_front; ///< The window in front of us in z-order - Window *z_back; ///< The window behind us in z-order + Window *parent; ///< Parent window. + Window *z_front; ///< The window in front of us in z-order. + Window *z_back; ///< The window behind us in z-order. /** * Sets the enabled/disabled status of a widget. @@ -302,7 +303,8 @@ public: */ inline bool IsWidgetFocused(byte widget_index) const { - return this->focused_widget == &this->widget[widget_index]; + return (this->widget != NULL && this->focused_widget == &this->widget[widget_index]) || + (this->nested_focus != NULL && this->nested_focus->index == widget_index); } /** @@ -693,6 +695,7 @@ void SetFocusedWindow(Window *w); bool EditBoxInGlobalFocus(); void ScrollbarClickHandler(Window *w, const Widget *wi, int x, int y); +void ScrollbarClickHandler(Window *w, const NWidgetCore *nw, int x, int y); void ResizeButtons(Window *w, byte left, byte right); -- cgit v1.2.3-54-g00ecf