summaryrefslogtreecommitdiff
path: root/src/widget_type.h
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-07-26 17:29:01 +0000
committeralberth <alberth@openttd.org>2009-07-26 17:29:01 +0000
commit9856cc9d0a339bace9c50a722e6a2bfc37cbdd88 (patch)
treeabfd00cb0e2915b31761021afe69aa39f372753e /src/widget_type.h
parent2dd998ab06d0f79445bf96239da9944fa30b7578 (diff)
downloadopenttd-9856cc9d0a339bace9c50a722e6a2bfc37cbdd88.tar.xz
(svn r16963) -Codechange: Added NWidgetViewport widget.
Diffstat (limited to 'src/widget_type.h')
-rw-r--r--src/widget_type.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/widget_type.h b/src/widget_type.h
index 58c9c580b..ae30eac0b 100644
--- a/src/widget_type.h
+++ b/src/widget_type.h
@@ -113,6 +113,7 @@ enum WidgetType {
NWID_SPACER, ///< Invisible widget that takes some space.
NWID_SELECTION, ///< Stacked widgets, only one visible at a time (eg in a panel with tabs).
NWID_LAYERED, ///< Widgets layered on top of each other, all visible at the same time.
+ NWID_VIEWPORT, ///< Nested widget containing a viewport.
/* Nested widget part types. */
WPT_RESIZE, ///< Widget part for specifying resizing.
@@ -471,6 +472,25 @@ private:
NWidgetPIPContainer *child; ///< Child widget.
};
+/**
+ * Nested widget to display a viewport in a window.
+ * After initializing the nested widget tree, call #InitializeViewport(). After changing the window size,
+ * call #UpdateViewportCoordinates() eg from Window::OnResize().
+ * @todo Class derives from #NWidgetCore, but does not use #colour, #widget_data, or #tool_tip.
+ * @ingroup NestedWidgets */
+class NWidgetViewport : public NWidgetCore {
+public:
+ NWidgetViewport(int index);
+
+ /* virtual */ void SetupSmallestSize(Window *w, bool init_array);
+ /* virtual */ void StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl);
+ /* virtual */ void Draw(const Window *w);
+ /* virtual */ Scrollbar *FindScrollbar(Window *w, bool allow_next = true);
+
+ void InitializeViewport(Window *w, uint32 follow_flags, ZoomLevel zoom);
+ void UpdateViewportCoordinates(Window *w);
+};
+
/** Leaf widget.
* @ingroup NestedWidgets */
class NWidgetLeaf : public NWidgetCore {