Nested widget to display and control a scrollbar in a window. More...
#include <widget_type.h>
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. |
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.
NWidgetScrollbar::NWidgetScrollbar | ( | WidgetType | tp, | |
Colours | colour, | |||
int | index | |||
) |
Scrollbar widget.
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.
void NWidgetScrollbar::Draw | ( | const Window * | w | ) | [virtual] |
Draw the widgets of the tree.
The function calls Window::DrawWidget for each widget with a non-negative index, after the widget itself is painted.
w | Window that owns the tree. |
Implements NWidgetBase.
Definition at line 1905 of file widget.cpp.
References _colour_gradient, NWidgetCore::colour, NWidgetBase::current_x, NWidgetBase::current_y, NWidgetCore::disp_flags, DrawHorizontalScrollbar(), DrawVerticalScrollbar(), FILLRECT_CHECKER, GfxFillRect(), HasBit(), NWidgetCore::IsDisabled(), ND_SCROLLBAR_BTN, NDB_SCROLLBAR_DOWN, NDB_SCROLLBAR_UP, NWID_HSCROLLBAR, NWidgetBase::pos_x, NWidgetBase::pos_y, Window::scrolling_scrollbar, and NWidgetBase::type.
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.
w | Window owning the widget. | |
init_array | Initialize the w->nested_array . |
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.