#include "stdafx.h"
#include "company_func.h"
#include "gfx_func.h"
#include "window_gui.h"
#include "table/sprites.h"
#include "table/strings.h"
Go to the source code of this file.
Functions | |
static Point | HandleScrollbarHittest (const Scrollbar *sb, int top, int bottom) |
Compute the vertical position of the draggable part of scrollbar. | |
void | ScrollbarClickHandler (Window *w, const Widget *wi, int x, int y) |
Special handling for the scrollbar widget type. | |
int | GetWidgetFromPos (const Window *w, int x, int y) |
Returns the index for the widget located at the given position relative to the window. | |
void | DrawFrameRect (int left, int top, int right, int bottom, Colours colour, FrameFlags flags) |
Draw frame rectangle. | |
static void | ResizeWidgets (Window *w, byte a, byte b) |
static void | ResizeWidgets (Window *w, byte a, byte b, byte c) |
void | ResizeButtons (Window *w, byte left, byte right) |
Evenly distribute some widgets when resizing horizontally (often a button row) When only two arguments are given, the widgets are presumed to be on a line and only the ends are given. | |
void | ResizeWindowForWidget (Window *w, uint widget, int delta_x, int delta_y) |
Resize a widget and shuffle other widgets around to fit. | |
Variables | |
static const char * | UPARROW = "\xEE\x8A\xA0" |
static const char * | DOWNARROW = "\xEE\x8A\xAA" |
Definition in file widget.cpp.
void DrawFrameRect | ( | int | left, | |
int | top, | |||
int | right, | |||
int | bottom, | |||
Colours | colour, | |||
FrameFlags | flags | |||
) |
Draw frame rectangle.
left | Left edge of the frame | |
top | Top edge of the frame | |
right | Right edge of the frame | |
bottom | Bottom edge of the frame | |
colour | Colour table to use. |
flags | Flags controlling how to draw the frame. |
Definition at line 169 of file widget.cpp.
References _colour_gradient, FILLRECT_RECOLOUR, FR_BORDERONLY, FR_DARKENED, FR_LOWERED, FR_TRANSPARENT, and GfxFillRect().
Referenced by DrawArrowButtons(), SettingEntry::DrawSetting(), Window::DrawWidgets(), and AISettingsWindow::OnPaint().
int GetWidgetFromPos | ( | const Window * | w, | |
int | x, | |||
int | y | |||
) |
Returns the index for the widget located at the given position relative to the window.
It includes all widget-corner pixels as well.
*w | Window to look inside | |
x | The Window client X coordinate | |
y | The Window client y coordinate |
Definition at line 140 of file widget.cpp.
References Window::IsWidgetHidden(), Widget::left, Widget::top, Widget::type, Window::widget, Window::widget_count, WWT_EMPTY, and WWT_FRAME.
Referenced by DispatchLeftClickEvent(), and DispatchRightClickEvent().
Compute the vertical position of the draggable part of scrollbar.
sb | Scrollbar list data | |
top | Top position of the scrollbar (top position of the up-button) | |
bottom | Bottom position of the scrollbar (bottom position of the down-button) |
Definition at line 24 of file widget.cpp.
References Scrollbar::cap, Scrollbar::count, Scrollbar::pos, Point::x, and Point::y.
Referenced by Window::DrawWidgets(), and ScrollbarClickHandler().
void ResizeButtons | ( | Window * | w, | |
byte | left, | |||
byte | right | |||
) |
Evenly distribute some widgets when resizing horizontally (often a button row) When only two arguments are given, the widgets are presumed to be on a line and only the ends are given.
w | Window to modify | |
left | The leftmost widget to resize | |
right | The rightmost widget to resize. Since right side of it is used, remember to set it to RESIZE_RIGHT |
Definition at line 547 of file widget.cpp.
References Widget::left, ResizeButtons(), Widget::right, and Window::widget.
Referenced by StationViewWindow::OnResize(), NewGRFWindow::OnResize(), ReplaceVehicleWindow::OnResize(), AISettingsWindow::OnResize(), AIListWindow::OnResize(), and ResizeButtons().
void ResizeWindowForWidget | ( | Window * | w, | |
uint | widget, | |||
int | delta_x, | |||
int | delta_y | |||
) |
Resize a widget and shuffle other widgets around to fit.
Definition at line 588 of file widget.cpp.
References Widget::bottom, ResizeInfo::height, Window::height, Widget::left, Window::resize, Widget::right, Widget::top, Window::widget, Window::widget_count, ResizeInfo::width, and Window::width.
Referenced by StationViewWindow::OnClick(), and ReplaceVehicleWindow::OnPaint().
Special handling for the scrollbar widget type.
Handles the special scrolling buttons and other scrolling.
w | Window on which a scroll was performed. | |
wi | Pointer to the scrollbar widget. | |
x | The X coordinate of the mouse click. | |
y | The Y coordinate of the mouse click. |
Definition at line 55 of file widget.cpp.
References _left_button_clicked, Widget::bottom, Scrollbar::cap, Scrollbar::count, Window::flags4, HandleScrollbarHittest(), Window::hscroll, Widget::left, max(), min(), CursorVars::pos, Scrollbar::pos, Widget::right, Window::SetDirty(), Widget::top, Widget::type, Window::vscroll, Window::vscroll2, WF_SCROLL_DOWN, WF_SCROLL_MIDDLE, WF_SCROLL_UP, WWT_HSCROLLBAR, WWT_SCROLL2BAR, WWT_SCROLLBAR, Point::x, and Point::y.
Referenced by DispatchLeftClickEvent().