summaryrefslogtreecommitdiff
path: root/src/window_gui.h
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-06-04 14:07:05 +0000
committeralberth <alberth@openttd.org>2009-06-04 14:07:05 +0000
commitb144a5451cb451d91bacafd80cab04640d1c1af1 (patch)
tree9eb3dc83f5dfd3b398f76ce3784fef22cdd5767b /src/window_gui.h
parent1a4934ef070aee3e506603707850de28c7f872cd (diff)
downloadopenttd-b144a5451cb451d91bacafd80cab04640d1c1af1.tar.xz
(svn r16516) -Codechange: Added click and drag handling for nested widgets.
Diffstat (limited to 'src/window_gui.h')
-rw-r--r--src/window_gui.h27
1 files changed, 15 insertions, 12 deletions
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);