NWidgetScrollbar Class Reference
[Hierarchical widgets]

Nested widget to display and control a scrollbar in a window. More...

#include <widget_type.h>

Inheritance diagram for NWidgetScrollbar:
NWidgetCore Scrollbar NWidgetResizeBase NWidgetBase ZeroedMemoryAllocator

Public Member Functions

 NWidgetScrollbar (WidgetType tp, Colours colour, int index)
 Scrollbar widget.
void SetupSmallestSize (Window *w, bool init_array)
 Compute smallest size needed by the widget.
void Draw (const Window *w)
 Draw the widgets of the tree.

Detailed Description

Nested widget to display and control a scrollbar in a window.

Also assign the scrollbar to other widgets using SetScrollbar() to make the mousewheel work.

Definition at line 714 of file widget_type.h.


Constructor & Destructor Documentation

NWidgetScrollbar::NWidgetScrollbar ( WidgetType  tp,
Colours  colour,
int  index 
)

Scrollbar widget.

Parameters:
tp Scrollbar type. (horizontal/vertical)
colour Colour of the scrollbar.
index Index in the widget array used by the window system.

Definition at line 1871 of file widget.cpp.

References NWID_HSCROLLBAR, NWID_VSCROLLBAR, NWidgetCore::SetDataTip(), NWidgetResizeBase::SetFill(), NWidgetCore::SetIndex(), NWidgetResizeBase::SetMinimalSize(), NWidgetResizeBase::SetResize(), NWidgetBase::type, WD_HSCROLLBAR_HEIGHT, and WD_VSCROLLBAR_WIDTH.


Member Function Documentation

void NWidgetScrollbar::Draw ( const Window w  )  [virtual]
void NWidgetScrollbar::SetupSmallestSize ( Window w,
bool  init_array 
) [virtual]

Compute smallest size needed by the widget.

The smallest size of a widget is the smallest size that a widget needs to display itself properly. In addition, filling and resizing of the widget are computed. The function calls Window::UpdateWidgetSize for each leaf widget and background widget without child with a non-negative index.

Parameters:
w Window owning the widget.
init_array Initialize the w->nested_array.
Note:
After the computation, the results can be queried by accessing the smallest_x and smallest_y data members of the widget.

Implements NWidgetBase.

Definition at line 1895 of file widget.cpp.

References NWidgetCore::index, NWidgetResizeBase::min_x, NWidgetResizeBase::min_y, Window::nested_array, Window::nested_array_size, NWidgetBase::smallest_x, and NWidgetBase::smallest_y.


The documentation for this class was generated from the following files:

Generated on Wed Apr 13 00:48:49 2011 for OpenTTD by  doxygen 1.6.1