From 36576371c05edf9a3498196d7ebdb8824a6910d1 Mon Sep 17 00:00:00 2001 From: alberth Date: Sat, 18 Jul 2009 10:46:55 +0000 Subject: (svn r16871) -Codechange: Generalize GetWidgetContentSize to UpdateWidgetSize for better control over widget size and resize steps. --- src/window_gui.h | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/window_gui.h') 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 -- cgit v1.2.3-54-g00ecf