(svn r16515) -Codechange: Added scrollbar handling for nested widgets, and finding widgets by type or position in the tree.
This commit is contained in:
@@ -153,6 +153,7 @@ enum SizingType {
|
||||
|
||||
/* Forward declarations. */
|
||||
class NWidgetCore;
|
||||
struct Scrollbar;
|
||||
|
||||
/**
|
||||
* Baseclass for nested widgets.
|
||||
@@ -170,6 +171,9 @@ public:
|
||||
virtual void StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl) = 0;
|
||||
virtual void FillNestedArray(NWidgetCore **array, uint length) = 0;
|
||||
|
||||
virtual NWidgetCore *GetWidgetFromPos(int x, int y) = 0;
|
||||
virtual NWidgetBase *GetWidgetOfType(WidgetType tp) = 0;
|
||||
|
||||
/**
|
||||
* Set additional space (padding) around the widget.
|
||||
* @param top Amount of additional space above the widget.
|
||||
@@ -284,6 +288,8 @@ public:
|
||||
void StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl);
|
||||
/* virtual */ void FillNestedArray(NWidgetCore **array, uint length);
|
||||
|
||||
virtual Scrollbar *FindScrollbar(Window *w, bool allow_next = true) = 0;
|
||||
|
||||
NWidgetDisplay disp_flags; ///< Flags that affect display and interaction with the widget.
|
||||
Colours colour; ///< Colour of this widget.
|
||||
int index; ///< Index of the nested widget in the widget array of the window (\c -1 means 'not used').
|
||||
@@ -335,6 +341,8 @@ public:
|
||||
/** Return whether the container is empty. */
|
||||
inline bool IsEmpty() { return head == NULL; };
|
||||
|
||||
/* virtual */ NWidgetBase *GetWidgetOfType(WidgetType tp);
|
||||
|
||||
protected:
|
||||
NWidgetBase *head; ///< Pointer to first widget in container.
|
||||
NWidgetBase *tail; ///< Pointer to last widget in container.
|
||||
@@ -352,6 +360,7 @@ public:
|
||||
void StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl);
|
||||
|
||||
/* virtual */ void Draw(const Window *w);
|
||||
/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
|
||||
};
|
||||
|
||||
/** Container with pre/inter/post child space. */
|
||||
@@ -362,6 +371,8 @@ public:
|
||||
void SetPIP(uint8 pip_pre, uint8 pip_inter, uint8 pip_post);
|
||||
|
||||
/* virtual */ void Draw(const Window *w);
|
||||
/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
|
||||
|
||||
protected:
|
||||
uint8 pip_pre; ///< Amount of space before first widget.
|
||||
uint8 pip_inter; ///< Amount of space between widgets.
|
||||
@@ -416,6 +427,8 @@ public:
|
||||
|
||||
/* virtual */ void Draw(const Window *w);
|
||||
/* virtual */ void Invalidate(const Window *w) const;
|
||||
/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
|
||||
/* virtual */ NWidgetBase *GetWidgetOfType(WidgetType tp);
|
||||
};
|
||||
|
||||
/** Nested widget with a child.
|
||||
@@ -435,6 +448,9 @@ public:
|
||||
/* virtual */ void FillNestedArray(NWidgetCore **array, uint length);
|
||||
|
||||
/* virtual */ void Draw(const Window *w);
|
||||
/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
|
||||
/* virtual */ NWidgetBase *GetWidgetOfType(WidgetType tp);
|
||||
/* virtual */ Scrollbar *FindScrollbar(Window *w, bool allow_next = true);
|
||||
|
||||
private:
|
||||
NWidgetPIPContainer *child; ///< Child widget.
|
||||
@@ -448,6 +464,9 @@ public:
|
||||
|
||||
/* virtual */ void Draw(const Window *w);
|
||||
/* virtual */ void Invalidate(const Window *w) const;
|
||||
/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
|
||||
/* virtual */ NWidgetBase *GetWidgetOfType(WidgetType tp);
|
||||
/* virtual */ Scrollbar *FindScrollbar(Window *w, bool allow_next = true);
|
||||
};
|
||||
|
||||
Widget *InitializeNWidgets(NWidgetBase *nwid, bool rtl = false);
|
||||
|
Reference in New Issue
Block a user