summaryrefslogtreecommitdiff
path: root/src/window_gui.h
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-07-18 10:46:55 +0000
committeralberth <alberth@openttd.org>2009-07-18 10:46:55 +0000
commit36576371c05edf9a3498196d7ebdb8824a6910d1 (patch)
tree0b847859d28abe6988089bd80682f0d9b0f40412 /src/window_gui.h
parent2b374824dcd55fef5cf6afe727f1ab914b19a1d2 (diff)
downloadopenttd-36576371c05edf9a3498196d7ebdb8824a6910d1.tar.xz
(svn r16871) -Codechange: Generalize GetWidgetContentSize to UpdateWidgetSize for better control over widget size and resize steps.
Diffstat (limited to 'src/window_gui.h')
-rw-r--r--src/window_gui.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/window_gui.h b/src/window_gui.h
index eee49674b..846a5a2db 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -521,18 +521,17 @@ public:
virtual void DrawWidget(const Rect &r, int widget) const {}
/**
- * Compute size of the contents of a widget.
- * If no useful size can be computed, return null-size (both width and height \c 0).
- * @param widget Number of the widget to get the size of.
- * @return Size of the contents of the widget.
- * @note If the contents ever becomes larger than what is returned here, the window should be re-initialized (with #Window::ReInit),
- * and this function should return a larger size.
- */
- virtual Dimension GetWidgetContentSize(int widget)
- {
- Dimension d = {0, 0};
- return d;
- }
+ * Update size and resize step of a widget in the window.
+ * After retrieval of the minimal size and the resize-steps of a widget, this function is called to allow further refinement,
+ * typically by computing the real maximal size of the content. Afterwards, \a size is taken to be the minimal size of the widget
+ * and \a resize is taken to contain the resize steps. For the convenience of the callee, \a padding contains the amount of
+ * padding between the content and the edge of the widget. This should be added to the returned size.
+ * @param widget Widget number.
+ * @param size Size of the widget.
+ * @param padding Recommended amount of space between the widget content and the widget edge.
+ * @param resize Resize step of the widget.
+ */
+ virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize) {}
/**
* Called when window gains focus