(svn r16516) -Codechange: Added click and drag handling for nested widgets.

This commit is contained in:
alberth
2009-06-04 14:07:05 +00:00
parent 1a4934ef07
commit b144a5451c
4 changed files with 156 additions and 82 deletions

View File

@@ -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);