OpenTTD
dropdown.cpp
Go to the documentation of this file.
1 /* $Id: dropdown.cpp 27820 2017-03-23 20:07:59Z peter1138 $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
12 #include "../stdafx.h"
13 #include "../window_gui.h"
14 #include "../string_func.h"
15 #include "../strings_func.h"
16 #include "../window_func.h"
17 #include "dropdown_type.h"
18 
19 #include "dropdown_widget.h"
20 
21 #include "../safeguards.h"
22 
23 
24 void DropDownListItem::Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
25 {
26  int c1 = _colour_gradient[bg_colour][3];
27  int c2 = _colour_gradient[bg_colour][7];
28 
29  int mid = top + this->Height(0) / 2;
30  GfxFillRect(left + 1, mid - 2, right - 1, mid - 2, c1);
31  GfxFillRect(left + 1, mid - 1, right - 1, mid - 1, c2);
32 }
33 
34 uint DropDownListStringItem::Width() const
35 {
36  char buffer[512];
37  GetString(buffer, this->String(), lastof(buffer));
38  return GetStringBoundingBox(buffer).width;
39 }
40 
41 void DropDownListStringItem::Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
42 {
43  DrawString(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, this->String(), sel ? TC_WHITE : TC_BLACK);
44 }
45 
53 /* static */ int DropDownListStringItem::NatSortFunc(const DropDownListItem * const *first, const DropDownListItem * const * second)
54 {
55  char buffer1[512], buffer2[512];
56  GetString(buffer1, static_cast<const DropDownListStringItem*>(*first)->String(), lastof(buffer1));
57  GetString(buffer2, static_cast<const DropDownListStringItem*>(*second)->String(), lastof(buffer2));
58  return strnatcmp(buffer1, buffer2);
59 }
60 
61 StringID DropDownListParamStringItem::String() const
62 {
63  for (uint i = 0; i < lengthof(this->decode_params); i++) SetDParam(i, this->decode_params[i]);
64  return this->string;
65 }
66 
67 StringID DropDownListCharStringItem::String() const
68 {
69  SetDParamStr(0, this->raw_string);
70  return this->string;
71 }
72 
73 static const NWidgetPart _nested_dropdown_menu_widgets[] = {
76  NWidget(NWID_SELECTION, INVALID_COLOUR, WID_DM_SHOW_SCROLL),
78  EndContainer(),
79  EndContainer(),
80 };
81 
82 static WindowDesc _dropdown_desc(
83  WDP_MANUAL, NULL, 0, 0,
86  _nested_dropdown_menu_widgets, lengthof(_nested_dropdown_menu_widgets)
87 );
88 
94  const DropDownList *list;
96  byte click_delay;
97  bool drag_mode;
99  int scrolling;
101  Scrollbar *vscroll;
102 
116  DropdownWindow(Window *parent, const DropDownList *list, int selected, int button, bool instant_close, const Point &position, const Dimension &size, Colours wi_colour, bool scroll)
117  : Window(&_dropdown_desc)
118  {
119  assert(list->Length() > 0);
120 
121  this->position = position;
122 
123  this->CreateNestedTree();
124 
125  this->vscroll = this->GetScrollbar(WID_DM_SCROLL);
126 
127  uint items_width = size.width - (scroll ? NWidgetScrollbar::GetVerticalDimension().width : 0);
128  NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_DM_ITEMS);
129  nwi->SetMinimalSize(items_width, size.height + 4);
130  nwi->colour = wi_colour;
131 
132  nwi = this->GetWidget<NWidgetCore>(WID_DM_SCROLL);
133  nwi->colour = wi_colour;
134 
135  this->GetWidget<NWidgetStacked>(WID_DM_SHOW_SCROLL)->SetDisplayedPlane(scroll ? 0 : SZSP_NONE);
136 
137  this->FinishInitNested(0);
138  CLRBITS(this->flags, WF_WHITE_BORDER);
139 
140  /* Total length of list */
141  int list_height = 0;
142  for (const DropDownListItem * const *it = list->Begin(); it != list->End(); ++it) {
143  const DropDownListItem *item = *it;
144  list_height += item->Height(items_width);
145  }
146 
147  /* Capacity is the average number of items visible */
148  this->vscroll->SetCapacity(size.height * (uint16)list->Length() / list_height);
149  this->vscroll->SetCount((uint16)list->Length());
150 
151  this->parent_wnd_class = parent->window_class;
152  this->parent_wnd_num = parent->window_number;
153  this->parent_button = button;
154  this->list = list;
155  this->selected_index = selected;
156  this->click_delay = 0;
157  this->drag_mode = true;
158  this->instant_close = instant_close;
159  }
160 
161  ~DropdownWindow()
162  {
163  /* Make the dropdown "invisible", so it doesn't affect new window placement.
164  * Also mark it dirty in case the callback deals with the screen. (e.g. screenshots). */
165  this->window_class = WC_INVALID;
166  this->SetDirty();
167 
168  Window *w2 = FindWindowById(this->parent_wnd_class, this->parent_wnd_num);
169  if (w2 != NULL) {
170  Point pt = _cursor.pos;
171  pt.x -= w2->left;
172  pt.y -= w2->top;
173  w2->OnDropdownClose(pt, this->parent_button, this->selected_index, this->instant_close);
174  }
175  delete this->list;
176  }
177 
178  virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
179  {
180  return this->position;
181  }
182 
188  bool GetDropDownItem(int &value)
189  {
190  if (GetWidgetFromPos(this, _cursor.pos.x - this->left, _cursor.pos.y - this->top) < 0) return false;
191 
192  NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_DM_ITEMS);
193  int y = _cursor.pos.y - this->top - nwi->pos_y - 2;
194  int width = nwi->current_x - 4;
195  int pos = this->vscroll->GetPosition();
196 
197  const DropDownList *list = this->list;
198 
199  for (const DropDownListItem * const *it = list->Begin(); it != list->End(); ++it) {
200  /* Skip items that are scrolled up */
201  if (--pos >= 0) continue;
202 
203  const DropDownListItem *item = *it;
204  int item_height = item->Height(width);
205 
206  if (y < item_height) {
207  if (item->masked || !item->Selectable()) return false;
208  value = item->result;
209  return true;
210  }
211 
212  y -= item_height;
213  }
214 
215  return false;
216  }
217 
218  virtual void DrawWidget(const Rect &r, int widget) const
219  {
220  if (widget != WID_DM_ITEMS) return;
221 
222  Colours colour = this->GetWidget<NWidgetCore>(widget)->colour;
223 
224  int y = r.top + 2;
225  int pos = this->vscroll->GetPosition();
226  for (const DropDownListItem * const *it = this->list->Begin(); it != this->list->End(); ++it) {
227  const DropDownListItem *item = *it;
228  int item_height = item->Height(r.right - r.left + 1);
229 
230  /* Skip items that are scrolled up */
231  if (--pos >= 0) continue;
232 
233  if (y + item_height < r.bottom) {
234  bool selected = (this->selected_index == item->result);
235  if (selected) GfxFillRect(r.left + 2, y, r.right - 1, y + item_height - 1, PC_BLACK);
236 
237  item->Draw(r.left, r.right, y, y + item_height, selected, colour);
238 
239  if (item->masked) {
240  GfxFillRect(r.left + 1, y, r.right - 1, y + item_height - 1, _colour_gradient[colour][5], FILLRECT_CHECKER);
241  }
242  }
243  y += item_height;
244  }
245  }
246 
247  virtual void OnClick(Point pt, int widget, int click_count)
248  {
249  if (widget != WID_DM_ITEMS) return;
250  int item;
251  if (this->GetDropDownItem(item)) {
252  this->click_delay = 4;
253  this->selected_index = item;
254  this->SetDirty();
255  }
256  }
257 
258  virtual void OnTick()
259  {
260  if (this->scrolling != 0) {
261  int pos = this->vscroll->GetPosition();
262 
263  this->vscroll->UpdatePosition(this->scrolling);
264  this->scrolling = 0;
265 
266  if (pos != this->vscroll->GetPosition()) {
267  this->SetDirty();
268  }
269  }
270  }
271 
272  virtual void OnMouseLoop()
273  {
274  Window *w2 = FindWindowById(this->parent_wnd_class, this->parent_wnd_num);
275  if (w2 == NULL) {
276  delete this;
277  return;
278  }
279 
280  if (this->click_delay != 0 && --this->click_delay == 0) {
281  /* Make the dropdown "invisible", so it doesn't affect new window placement.
282  * Also mark it dirty in case the callback deals with the screen. (e.g. screenshots). */
283  this->window_class = WC_INVALID;
284  this->SetDirty();
285 
286  w2->OnDropdownSelect(this->parent_button, this->selected_index);
287  delete this;
288  return;
289  }
290 
291  if (this->drag_mode) {
292  int item;
293 
294  if (!_left_button_clicked) {
295  this->drag_mode = false;
296  if (!this->GetDropDownItem(item)) {
297  if (this->instant_close) delete this;
298  return;
299  }
300  this->click_delay = 2;
301  } else {
302  if (_cursor.pos.y <= this->top + 2) {
303  /* Cursor is above the list, set scroll up */
304  this->scrolling = -1;
305  return;
306  } else if (_cursor.pos.y >= this->top + this->height - 2) {
307  /* Cursor is below list, set scroll down */
308  this->scrolling = 1;
309  return;
310  }
311 
312  if (!this->GetDropDownItem(item)) return;
313  }
314 
315  if (this->selected_index != item) {
316  this->selected_index = item;
317  this->SetDirty();
318  }
319  }
320  }
321 };
322 
337 void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int button, Rect wi_rect, Colours wi_colour, bool auto_width, bool instant_close)
338 {
340 
341  /* The preferred position is just below the dropdown calling widget */
342  int top = w->top + wi_rect.bottom + 1;
343 
344  /* The preferred width equals the calling widget */
345  uint width = wi_rect.right - wi_rect.left + 1;
346 
347  /* Longest item in the list, if auto_width is enabled */
348  uint max_item_width = 0;
349 
350  /* Total length of list */
351  int height = 0;
352 
353  for (const DropDownListItem * const *it = list->Begin(); it != list->End(); ++it) {
354  const DropDownListItem *item = *it;
355  height += item->Height(width);
356  if (auto_width) max_item_width = max(max_item_width, item->Width() + 5);
357  }
358 
359  /* Check if the status bar is visible, as we don't want to draw over it */
360  int screen_bottom = GetMainViewBottom();
361  bool scroll = false;
362 
363  /* Check if the dropdown will fully fit below the widget */
364  if (top + height + 4 >= screen_bottom) {
365  /* If not, check if it will fit above the widget */
366  int screen_top = GetMainViewTop();
367  if (w->top + wi_rect.top > screen_top + height) {
368  top = w->top + wi_rect.top - height - 4;
369  } else {
370  /* If it doesn't fit above the widget, we need to enable a scrollbar... */
371  int avg_height = height / (int)list->Length();
372  scroll = true;
373 
374  /* ... and choose whether to put the list above or below the widget. */
375  bool put_above = false;
376  int available_height = screen_bottom - w->top - wi_rect.bottom;
377  if (w->top + wi_rect.top - screen_top > available_height) {
378  // Put it above.
379  available_height = w->top + wi_rect.top - screen_top;
380  put_above = true;
381  }
382 
383  /* Check at least there is space for one item. */
384  assert(available_height >= avg_height);
385 
386  /* And lastly, fit the list... */
387  int rows = available_height / avg_height;
388  height = rows * avg_height;
389 
390  /* Add space for the scroll bar if we automatically determined
391  * the width of the list. */
392  max_item_width += NWidgetScrollbar::GetVerticalDimension().width;
393 
394  /* ... and set the top position if needed. */
395  if (put_above) {
396  top = w->top + wi_rect.top - height - 4;
397  }
398  }
399  }
400 
401  if (auto_width) width = max(width, max_item_width);
402 
403  Point dw_pos = { w->left + (_current_text_dir == TD_RTL ? wi_rect.right + 1 - (int)width : wi_rect.left), top};
404  Dimension dw_size = {width, (uint)height};
405  new DropdownWindow(w, list, selected, button, instant_close, dw_pos, dw_size, wi_colour, scroll);
406 }
407 
421 void ShowDropDownList(Window *w, const DropDownList *list, int selected, int button, uint width, bool auto_width, bool instant_close)
422 {
423  /* Our parent's button widget is used to determine where to place the drop
424  * down list window. */
425  Rect wi_rect;
426  NWidgetCore *nwi = w->GetWidget<NWidgetCore>(button);
427  wi_rect.left = nwi->pos_x;
428  wi_rect.right = nwi->pos_x + nwi->current_x - 1;
429  wi_rect.top = nwi->pos_y;
430  wi_rect.bottom = nwi->pos_y + nwi->current_y - 1;
431  Colours wi_colour = nwi->colour;
432 
433  if ((nwi->type & WWT_MASK) == NWID_BUTTON_DROPDOWN) {
435  } else {
436  w->LowerWidget(button);
437  }
438  w->SetWidgetDirty(button);
439 
440  if (width != 0) {
441  if (_current_text_dir == TD_RTL) {
442  wi_rect.left = wi_rect.right + 1 - width;
443  } else {
444  wi_rect.right = wi_rect.left + width - 1;
445  }
446  }
447 
448  ShowDropDownListAt(w, list, selected, button, wi_rect, wi_colour, auto_width, instant_close);
449 }
450 
462 void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask, uint32 hidden_mask, uint width)
463 {
464  DropDownList *list = new DropDownList();
465 
466  for (uint i = 0; strings[i] != INVALID_STRING_ID; i++) {
467  if (!HasBit(hidden_mask, i)) {
468  *list->Append() = new DropDownListStringItem(strings[i], i, HasBit(disabled_mask, i));
469  }
470  }
471 
472  /* No entries in the list? */
473  if (list->Length() == 0) {
474  delete list;
475  return;
476  }
477 
478  ShowDropDownList(w, list, selected, button, width);
479 }
480 
487 {
488  Window *w;
489  FOR_ALL_WINDOWS_FROM_BACK(w) {
490  if (w->window_class != WC_DROPDOWN_MENU) continue;
491 
492  DropdownWindow *dw = dynamic_cast<DropdownWindow*>(w);
493  assert(dw != NULL);
494  if (pw->window_class == dw->parent_wnd_class &&
495  pw->window_number == dw->parent_wnd_num) {
496  int parent_button = dw->parent_button;
497  delete dw;
498  return parent_button;
499  }
500  }
501 
502  return -1;
503 }
504 
Colours colour
Colour of this widget.
Definition: widget_type.h:303
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen...
Definition: gfx.cpp:112
Point pos
logical mouse position
Definition: gfx_type.h:119
virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
Compute the initial position of the window.
Definition: dropdown.cpp:178
High level window description.
Definition: window_gui.h:168
void SetMinimalSize(uint min_x, uint min_y)
Set minimal size of the widget.
Definition: widget.cpp:817
int left
x position of left edge of the window
Definition: window_gui.h:312
Scrollbar data structure.
Definition: widget_type.h:589
bool instant_close
Close the window when the mouse button is raised.
Definition: dropdown.cpp:98
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
Definition: window.cpp:577
Horizontal container.
Definition: widget_type.h:75
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
Definition: window.cpp:1105
byte _colour_gradient[COLOUR_END][8]
All 16 colour gradients 8 colours per gradient from darkest (0) to lightest (7)
Definition: gfx.cpp:53
WidgetType type
Type of the widget / nested widget.
Definition: widget_type.h:163
WindowClass parent_wnd_class
Parent window class.
Definition: dropdown.cpp:91
int selected_index
Index of the selected item in the list.
Definition: dropdown.cpp:95
int top
y position of top edge of the window
Definition: window_gui.h:313
const T * Begin() const
Get the pointer to the first item (const)
virtual void OnMouseLoop()
Called for every mouse loop run, which is at least once per (game) tick.
Definition: dropdown.cpp:272
#define lastof(x)
Get the last element of an fixed size array.
Definition: depend.cpp:50
WindowClass
Window classes.
Definition: window_type.h:39
#define CLRBITS(x, y)
Clears several bits in a variable.
Invalid window.
Definition: window_type.h:684
static T max(const T a, const T b)
Returns the maximum of two values.
Definition: math_func.hpp:26
Common string list item.
Definition: dropdown_type.h:41
const T * End() const
Get the pointer behind the last valid item (const)
const DropDownList * list
List with dropdown menu items.
Definition: dropdown.cpp:94
bool _left_button_clicked
Is left mouse button clicked?
Definition: gfx.cpp:40
T * Append(uint to_add=1)
Append an item and return it.
void SetCapacity(int capacity)
Set the capacity of visible elements.
Definition: widget_type.h:686
void SetCount(int num)
Sets the number of elements in the list.
Definition: widget_type.h:670
int GetMainViewBottom()
Return the bottom of the main view available for general use.
Definition: window.cpp:2163
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:910
Data structure for an opened window.
Definition: window_gui.h:271
byte click_delay
Timer to delay selection.
Definition: dropdown.cpp:96
void SetDParamStr(uint n, const char *str)
This function is used to "bind" a C string to a OpenTTD dparam slot.
Definition: strings.cpp:279
Bit value of the &#39;dropdown active&#39; flag.
Definition: widget_type.h:273
uint Length() const
Get the number of items in the list.
uint pos_y
Vertical position of top-left corner of the widget in the window.
Definition: widget_type.h:178
virtual void OnTick()
Called once per (game) tick.
Definition: dropdown.cpp:258
uint current_y
Current vertical size (after resizing).
Definition: widget_type.h:175
Simple vector template class, with automatic delete.
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:947
bool masked
Masked and unselectable item.
Definition: dropdown_type.h:27
int GetMainViewTop()
Return the top of the main view available for general use.
Definition: window.cpp:2152
Simple depressed panel.
Definition: widget_type.h:50
void LowerWidget(byte widget_index)
Marks a widget as lowered.
Definition: window_gui.h:469
virtual void OnDropdownSelect(int widget, int index)
A dropdown option associated to this window has been selected.
Definition: window_gui.h:705
int GetWidgetFromPos(const Window *w, int x, int y)
Returns the index for the widget located at the given position relative to the window.
Definition: widget.cpp:162
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new &#39;real&#39; widget.
Definition: widget_type.h:1114
Baseclass for nested widgets.
Definition: widget_type.h:126
Button with a drop-down.
Definition: widget_type.h:82
int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
Definition: gfx.cpp:499
#define lengthof(x)
Return the length of an fixed size array.
Definition: depend.cpp:42
uint pos_x
Horizontal position of top-left corner of the widget in the window.
Definition: widget_type.h:177
Display plane with zero size in both directions (none filling and resizing).
Definition: widget_type.h:390
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:18
int scrolling
If non-zero, auto-scroll the item list (one time).
Definition: dropdown.cpp:99
static const uint8 PC_BLACK
Black palette colour.
Definition: gfx_func.h:207
Drop-down menu window.
Definition: dropdown.cpp:90
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition: gfx.cpp:699
Draw only every second pixel, used for greying-out.
Definition: gfx_type.h:284
No window, redirects to WC_MAIN_WINDOW.
Definition: window_type.h:40
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
Definition: window.cpp:1137
WindowNumber parent_wnd_num
Parent window number.
Definition: dropdown.cpp:92
bool GetDropDownItem(int &value)
Find the dropdown item under the cursor.
Definition: dropdown.cpp:188
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
Definition: dropdown.cpp:247
int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
Compares two strings using case insensitive natural sort.
Definition: string.cpp:569
void UpdatePosition(int difference, ScrollbarStepping unit=SS_SMALL)
Updates the position of the first visible element by the given amount.
Definition: widget_type.h:714
TextDirection _current_text_dir
Text direction of the currently selected language.
Definition: strings.cpp:52
int result
Result code to return to window on selection.
Definition: dropdown_type.h:26
This window won&#39;t get focus/make any other window lose focus when click.
Definition: window_gui.h:212
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME, WWT_INSET, or WWT_PANEL).
Definition: widget_type.h:999
Point position
Position of the topleft corner of the window.
Definition: dropdown.cpp:100
uint current_x
Current horizontal size (after resizing).
Definition: widget_type.h:174
int parent_button
Parent widget number where the window is dropped from.
Definition: dropdown.cpp:93
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
Definition: dropdown.cpp:218
Coordinates of a point in 2D.
DropdownWindow(Window *parent, const DropDownList *list, int selected, int button, bool instant_close, const Point &position, const Dimension &size, Colours wi_colour, bool scroll)
Create a dropdown menu.
Definition: dropdown.cpp:116
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
Definition: strings_type.h:19
Offset at right to draw the frame rectangular area.
Definition: window_gui.h:63
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
int32 WindowNumber
Number to differentiate different windows of the same class.
Definition: window_type.h:695
WindowClass window_class
Window class.
Definition: window_gui.h:306
Specification of a rectangle with absolute coordinates of all edges.
Vertical scrollbar.
Definition: widget_type.h:84
Text is written right-to-left by default.
Definition: strings_type.h:26
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:307
Manually align the window (so no automatic location finding)
Definition: window_gui.h:155
NWidgetDisplay disp_flags
Flags that affect display and interaction with the widget.
Definition: widget_type.h:302
virtual void OnDropdownClose(Point pt, int widget, int index, bool instant_close)
A dropdown window associated to this window has been closed.
Definition: window.cpp:280
Stacked widgets, only one visible at a time (eg in a panel with tabs).
Definition: widget_type.h:80
const NWID * GetWidget(uint widnum) const
Get the nested widget with number widnum from the nested widget tree.
Definition: window_gui.h:827
Window white border counter bit mask.
Definition: window_gui.h:242
static NWidgetPart SetScrollbar(int index)
Attach a scrollbar to a widget.
Definition: widget_type.h:1095
Base list item class from which others are derived.
Definition: dropdown_type.h:24
Dimensions (a width and height) of a rectangle in 2D.
Offset at left to draw the frame rectangular area.
Definition: window_gui.h:62
Drop down menu; Window numbers:
Definition: window_type.h:151
uint16 GetPosition() const
Gets the position of the first visible element in the list.
Definition: widget_type.h:631
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
Definition: strings_func.h:201
Base class for a &#39;real&#39; widget.
Definition: widget_type.h:284
static int CDECL NatSortFunc(const DropDownListItem *const *first, const DropDownListItem *const *second)
Natural sorting comparator function for DropDownList::sort().
Definition: dropdown.cpp:53