author | rubidium |
Sun, 25 May 2008 19:17:03 +0000 | |
changeset 9354 | 845e07db4549 |
parent 9301 | 3b20dfb6c4e8 |
child 9374 | 4e9c2b65768e |
permissions | -rw-r--r-- |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
1 |
/* $Id$ */ |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
2 |
|
9111
48ce04029fe4
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
9082
diff
changeset
|
3 |
/** @file dropdown.cpp Implementation of the dropdown widget. */ |
48ce04029fe4
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
9082
diff
changeset
|
4 |
|
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
5 |
#include "../stdafx.h" |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
6 |
#include "../openttd.h" |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
7 |
#include "../strings_type.h" |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
8 |
#include "../window_gui.h" |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
9 |
#include "../strings_func.h" |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
10 |
#include "../strings_type.h" |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
11 |
#include "../gfx_func.h" |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
12 |
#include "../window_func.h" |
8301
9f8d82ea6667
(svn r11865) -Feature(tte): Support scrolling of drop down lists when in drag mode by moving the pointer above or below the list.
peter1138
parents:
8299
diff
changeset
|
13 |
#include "../core/math_func.hpp" |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
14 |
#include "dropdown_type.h" |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
15 |
#include "dropdown_func.h" |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
16 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
17 |
#include "../table/sprites.h" |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
18 |
#include "table/strings.h" |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
19 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
20 |
StringID DropDownListItem::String() const |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
21 |
{ |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
22 |
return STR_NULL; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
23 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
24 |
|
8905
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
25 |
uint DropDownListItem::Height(uint width) const |
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
26 |
{ |
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
27 |
return 10; |
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
28 |
} |
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
29 |
|
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
30 |
StringID DropDownListStringItem::String() const |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
31 |
{ |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
32 |
return this->string; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
33 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
34 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
35 |
StringID DropDownListParamStringItem::String() const |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
36 |
{ |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
37 |
for (uint i = 0; i < lengthof(this->decode_params); i++) SetDParam(i, this->decode_params[i]); |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
38 |
return this->string; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
39 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
40 |
|
8907
c6949b09d3b3
(svn r12675) -Codechange: Add support for custom drawing of drop down list items.
peter1138
parents:
8905
diff
changeset
|
41 |
void DropDownListItem::Draw(int x, int y, uint width, uint height, bool sel) const |
c6949b09d3b3
(svn r12675) -Codechange: Add support for custom drawing of drop down list items.
peter1138
parents:
8905
diff
changeset
|
42 |
{ |
c6949b09d3b3
(svn r12675) -Codechange: Add support for custom drawing of drop down list items.
peter1138
parents:
8905
diff
changeset
|
43 |
DrawStringTruncated(x + 2, y, this->String(), sel ? TC_WHITE : TC_BLACK, x + width); |
c6949b09d3b3
(svn r12675) -Codechange: Add support for custom drawing of drop down list items.
peter1138
parents:
8905
diff
changeset
|
44 |
} |
c6949b09d3b3
(svn r12675) -Codechange: Add support for custom drawing of drop down list items.
peter1138
parents:
8905
diff
changeset
|
45 |
|
8299
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
46 |
/** |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
47 |
* Delete all items of a drop down list and the list itself |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
48 |
* @param list List to delete. |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
49 |
*/ |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
50 |
static void DeleteDropDownList(DropDownList *list) |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
51 |
{ |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
52 |
for (DropDownList::iterator it = list->begin(); it != list->end(); ++it) { |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
53 |
DropDownListItem *item = *it; |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
54 |
delete item; |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
55 |
} |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
56 |
delete list; |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
57 |
} |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
58 |
|
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
59 |
static const Widget _dropdown_menu_widgets[] = { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
60 |
{ WWT_PANEL, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
61 |
{ WWT_SCROLLBAR, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
62 |
{ WIDGETS_END}, |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
63 |
}; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
64 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
65 |
struct DropdownWindow : Window { |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
66 |
WindowClass parent_wnd_class; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
67 |
WindowNumber parent_wnd_num; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
68 |
byte parent_button; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
69 |
DropDownList *list; |
8543
87899423775d
(svn r12121) -Fix [FS#1764]: Drop down item indexes are now an int instead of a byte (Yexo)
peter1138
parents:
8358
diff
changeset
|
70 |
int selected_index; |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
71 |
byte click_delay; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
72 |
bool drag_mode; |
8301
9f8d82ea6667
(svn r11865) -Feature(tte): Support scrolling of drop down lists when in drag mode by moving the pointer above or below the list.
peter1138
parents:
8299
diff
changeset
|
73 |
int scrolling; |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
74 |
|
9301
3b20dfb6c4e8
(svn r13169) -Codechange: remove a (now) unneeded parameter of one of the Window constructors.
rubidium
parents:
9273
diff
changeset
|
75 |
DropdownWindow(int x, int y, int width, int height, const Widget *widget) : Window(x, y, width, height, WC_DROPDOWN_MENU, widget) |
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
76 |
{ |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
77 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
78 |
|
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
79 |
~DropdownWindow() |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
80 |
{ |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
81 |
Window *w2 = FindWindowById(this->parent_wnd_class, this->parent_wnd_num); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
82 |
if (w2 != NULL) { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
83 |
w2->RaiseWidget(this->parent_button); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
84 |
w2->InvalidateWidget(this->parent_button); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
85 |
} |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
86 |
|
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
87 |
DeleteDropDownList(this->list); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
88 |
} |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
89 |
|
9209
2987efebe01d
(svn r13075) -Codechange: Allow any value for a dropdown item instead of just positive.
peter1138
parents:
9189
diff
changeset
|
90 |
bool GetDropDownItem(int &value) |
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
91 |
{ |
9209
2987efebe01d
(svn r13075) -Codechange: Allow any value for a dropdown item instead of just positive.
peter1138
parents:
9189
diff
changeset
|
92 |
if (GetWidgetFromPos(this, _cursor.pos.x - this->left, _cursor.pos.y - this->top) < 0) return false; |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
93 |
|
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
94 |
int y = _cursor.pos.y - this->top - 2; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
95 |
int width = this->widget[0].right - 3; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
96 |
int pos = this->vscroll.pos; |
8301
9f8d82ea6667
(svn r11865) -Feature(tte): Support scrolling of drop down lists when in drag mode by moving the pointer above or below the list.
peter1138
parents:
8299
diff
changeset
|
97 |
|
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
98 |
const DropDownList *list = this->list; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
99 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
100 |
for (DropDownList::const_iterator it = list->begin(); it != list->end(); ++it) { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
101 |
/* Skip items that are scrolled up */ |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
102 |
if (--pos >= 0) continue; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
103 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
104 |
const DropDownListItem *item = *it; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
105 |
int item_height = item->Height(width); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
106 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
107 |
if (y < item_height) { |
9209
2987efebe01d
(svn r13075) -Codechange: Allow any value for a dropdown item instead of just positive.
peter1138
parents:
9189
diff
changeset
|
108 |
if (item->masked || item->String() == STR_NULL) return false; |
2987efebe01d
(svn r13075) -Codechange: Allow any value for a dropdown item instead of just positive.
peter1138
parents:
9189
diff
changeset
|
109 |
value = item->result; |
2987efebe01d
(svn r13075) -Codechange: Allow any value for a dropdown item instead of just positive.
peter1138
parents:
9189
diff
changeset
|
110 |
return true; |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
111 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
112 |
|
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
113 |
y -= item_height; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
114 |
} |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
115 |
|
9209
2987efebe01d
(svn r13075) -Codechange: Allow any value for a dropdown item instead of just positive.
peter1138
parents:
9189
diff
changeset
|
116 |
return false; |
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
117 |
} |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
118 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
119 |
virtual void OnPaint() |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
120 |
{ |
9273
35e0224ea8f1
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
9209
diff
changeset
|
121 |
this->DrawWidgets(); |
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
122 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
123 |
int x = 1; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
124 |
int y = 2; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
125 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
126 |
int sel = this->selected_index; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
127 |
int width = this->widget[0].right - 3; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
128 |
int height = this->widget[0].bottom; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
129 |
int pos = this->vscroll.pos; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
130 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
131 |
DropDownList *list = this->list; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
132 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
133 |
for (DropDownList::const_iterator it = list->begin(); it != list->end(); ++it) { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
134 |
const DropDownListItem *item = *it; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
135 |
int item_height = item->Height(width); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
136 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
137 |
/* Skip items that are scrolled up */ |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
138 |
if (--pos >= 0) continue; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
139 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
140 |
if (y + item_height < height) { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
141 |
if (item->String() != STR_NULL) { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
142 |
if (sel == item->result) GfxFillRect(x + 1, y, x + width, y + item_height - 1, 0); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
143 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
144 |
item->Draw(x, y, width, 10, sel == item->result); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
145 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
146 |
if (item->masked) { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
147 |
GfxFillRect(x, y, x + width, y + item_height - 1, |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
148 |
(1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[this->widget[0].color][5] |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
149 |
); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
150 |
} |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
151 |
} else { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
152 |
int c1 = _colour_gradient[this->widget[0].color][3]; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
153 |
int c2 = _colour_gradient[this->widget[0].color][7]; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
154 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
155 |
GfxFillRect(x + 1, y + 3, x + this->width - 5, y + 3, c1); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
156 |
GfxFillRect(x + 1, y + 4, x + this->width - 5, y + 4, c2); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
157 |
} |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
158 |
} |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
159 |
y += item_height; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
160 |
} |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
161 |
}; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
162 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
163 |
virtual void OnClick(Point pt, int widget) |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
164 |
{ |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
165 |
if (widget != 0) return; |
9209
2987efebe01d
(svn r13075) -Codechange: Allow any value for a dropdown item instead of just positive.
peter1138
parents:
9189
diff
changeset
|
166 |
int item; |
2987efebe01d
(svn r13075) -Codechange: Allow any value for a dropdown item instead of just positive.
peter1138
parents:
9189
diff
changeset
|
167 |
if (this->GetDropDownItem(item)) { |
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
168 |
this->click_delay = 4; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
169 |
this->selected_index = item; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
170 |
this->SetDirty(); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
171 |
} |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
172 |
} |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
173 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
174 |
virtual void OnTick() |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
175 |
{ |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
176 |
if (this->scrolling == -1) { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
177 |
this->vscroll.pos = max(0, this->vscroll.pos - 1); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
178 |
this->SetDirty(); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
179 |
} else if (this->scrolling == 1) { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
180 |
this->vscroll.pos = min(this->vscroll.count - this->vscroll.cap, this->vscroll.pos + 1); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
181 |
this->SetDirty(); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
182 |
} |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
183 |
this->scrolling = 0; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
184 |
} |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
185 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
186 |
virtual void OnMouseLoop() |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
187 |
{ |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
188 |
Window *w2 = FindWindowById(this->parent_wnd_class, this->parent_wnd_num); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
189 |
if (w2 == NULL) { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
190 |
delete this; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
191 |
return; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
192 |
} |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
193 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
194 |
if (this->click_delay != 0 && --this->click_delay == 0) { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
195 |
w2->OnDropdownSelect(this->parent_button, this->selected_index); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
196 |
delete this; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
197 |
return; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
198 |
} |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
199 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
200 |
if (this->drag_mode) { |
9209
2987efebe01d
(svn r13075) -Codechange: Allow any value for a dropdown item instead of just positive.
peter1138
parents:
9189
diff
changeset
|
201 |
int item; |
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
202 |
|
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
203 |
if (!_left_button_clicked) { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
204 |
this->drag_mode = false; |
9209
2987efebe01d
(svn r13075) -Codechange: Allow any value for a dropdown item instead of just positive.
peter1138
parents:
9189
diff
changeset
|
205 |
if (!this->GetDropDownItem(item)) return; |
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
206 |
this->click_delay = 2; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
207 |
} else { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
208 |
if (_cursor.pos.y <= this->top + 2) { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
209 |
/* Cursor is above the list, set scroll up */ |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
210 |
this->scrolling = -1; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
211 |
return; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
212 |
} else if (_cursor.pos.y >= this->top + this->height - 2) { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
213 |
/* Cursor is below list, set scroll down */ |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
214 |
this->scrolling = 1; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
215 |
return; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
216 |
} |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
217 |
|
9209
2987efebe01d
(svn r13075) -Codechange: Allow any value for a dropdown item instead of just positive.
peter1138
parents:
9189
diff
changeset
|
218 |
if (!this->GetDropDownItem(item)) return; |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
219 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
220 |
|
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
221 |
this->selected_index = item; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
222 |
this->SetDirty(); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
223 |
} |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
224 |
} |
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
225 |
}; |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
226 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8857
diff
changeset
|
227 |
void ShowDropDownList(Window *w, DropDownList *list, int selected, int button, uint width) |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
228 |
{ |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
229 |
bool is_dropdown_menu_shown = w->IsWidgetLowered(button); |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
230 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
231 |
DeleteWindowById(WC_DROPDOWN_MENU, 0); |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
232 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
233 |
if (is_dropdown_menu_shown) { |
8299
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
234 |
DeleteDropDownList(list); |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
235 |
return; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
236 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
237 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
238 |
w->LowerWidget(button); |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
239 |
w->InvalidateWidget(button); |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
240 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
241 |
/* Our parent's button widget is used to determine where to place the drop |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
242 |
* down list window. */ |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
243 |
const Widget *wi = &w->widget[button]; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
244 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
245 |
/* The preferred position is just below the dropdown calling widget */ |
8335
09a2e049b3a8
(svn r11901) -Add: add two widgets for dropdowns, one raised and one inset, to eventually replace use of two widgets for each dropdown control.
peter1138
parents:
8301
diff
changeset
|
246 |
int top = w->top + wi->bottom + 1; |
8905
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
247 |
|
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
248 |
/* Total length of list */ |
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
249 |
int list_height = 0; |
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
250 |
|
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
251 |
for (DropDownList::const_iterator it = list->begin(); it != list->end(); ++it) { |
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
252 |
DropDownListItem *item = *it; |
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
253 |
list_height += item->Height(width); |
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
254 |
} |
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
255 |
|
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
256 |
/* Height of window visible */ |
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
257 |
int height = list_height; |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
258 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
259 |
/* Check if the status bar is visible, as we don't want to draw over it */ |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
260 |
Window *w3 = FindWindowById(WC_STATUS_BAR, 0); |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
261 |
int screen_bottom = w3 == NULL ? _screen.height : w3->top; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
262 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
263 |
bool scroll = false; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
264 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
265 |
/* Check if the dropdown will fully fit below the widget */ |
8905
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
266 |
if (top + height + 4 >= screen_bottom) { |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
267 |
w3 = FindWindowById(WC_MAIN_TOOLBAR, 0); |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
268 |
int screen_top = w3 == NULL ? 0 : w3->top + w3->height; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
269 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
270 |
/* If not, check if it will fit above the widget */ |
8335
09a2e049b3a8
(svn r11901) -Add: add two widgets for dropdowns, one raised and one inset, to eventually replace use of two widgets for each dropdown control.
peter1138
parents:
8301
diff
changeset
|
271 |
if (w->top + wi->top - height > screen_top) { |
8905
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
272 |
top = w->top + wi->top - height - 4; |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
273 |
} else { |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
274 |
/* ... and lastly if it won't, enable the scroll bar and fit the |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
275 |
* list in below the widget */ |
8905
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
276 |
int avg_height = list_height / list->size(); |
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
277 |
int rows = (screen_bottom - 4 - top) / avg_height; |
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
278 |
height = rows * avg_height; |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
279 |
scroll = true; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
280 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
281 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
282 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8857
diff
changeset
|
283 |
if (width == 0) width = wi->right - wi->left + 1; |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8857
diff
changeset
|
284 |
|
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
285 |
DropdownWindow *dw = new DropdownWindow( |
8358
cbd1a077e375
(svn r11924) -Codechange: All dropdowns now use the dropdown widget, so compatibility code can be removed
peter1138
parents:
8335
diff
changeset
|
286 |
w->left + wi->left, |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
287 |
top, |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8857
diff
changeset
|
288 |
width, |
8905
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
289 |
height + 4, |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
290 |
_dropdown_menu_widgets); |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
291 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
292 |
dw->widget[0].color = wi->color; |
8884
cebc13b06266
(svn r12651) -Fix (r12644) [FS#1915]: Dropdown widget width should be one pixel less than window width, not one more.
peter1138
parents:
8877
diff
changeset
|
293 |
dw->widget[0].right = width - 1; |
8905
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
294 |
dw->widget[0].bottom = height + 3; |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
295 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
296 |
dw->SetWidgetHiddenState(1, !scroll); |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
297 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
298 |
if (scroll) { |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
299 |
/* We're scrolling, so enable the scroll bar and shrink the list by |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
300 |
* the scrollbar's width */ |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
301 |
dw->widget[1].color = wi->color; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
302 |
dw->widget[1].right = dw->widget[0].right; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
303 |
dw->widget[1].left = dw->widget[1].right - 11; |
8905
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
304 |
dw->widget[1].bottom = dw->widget[0].bottom; |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
305 |
dw->widget[0].right -= 12; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
306 |
|
8905
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
307 |
/* Capacity is the average number of items visible */ |
609b1121b3b3
(svn r12672) -Codechange: Add support for variably-sized drop down list items.
peter1138
parents:
8884
diff
changeset
|
308 |
dw->vscroll.cap = height * list->size() / list_height; |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
309 |
dw->vscroll.count = list->size(); |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
310 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
311 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
312 |
dw->desc_flags = WDF_DEF_WIDGET; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
313 |
dw->flags4 &= ~WF_WHITE_BORDER_MASK; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
314 |
|
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
315 |
dw->parent_wnd_class = w->window_class; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
316 |
dw->parent_wnd_num = w->window_number; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
317 |
dw->parent_button = button; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
318 |
dw->list = list; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
319 |
dw->selected_index = selected; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
320 |
dw->click_delay = 0; |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
321 |
dw->drag_mode = true; |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
322 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
323 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8857
diff
changeset
|
324 |
void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask, uint32 hidden_mask, uint width) |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
325 |
{ |
8299
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
326 |
/* Don't create a new list if we're just closing an existing menu */ |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
327 |
if (w->IsWidgetLowered(button)) { |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
328 |
DeleteWindowById(WC_DROPDOWN_MENU, 0); |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
329 |
return; |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
330 |
} |
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
331 |
|
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
332 |
uint result = 0; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
333 |
DropDownList *list = new DropDownList(); |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
334 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
335 |
for (uint i = 0; strings[i] != INVALID_STRING_ID; i++) { |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
336 |
if (!HasBit(hidden_mask, i)) { |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
337 |
list->push_back(new DropDownListStringItem(strings[i], result, HasBit(disabled_mask, i))); |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
338 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
339 |
result++; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
340 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
341 |
|
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
342 |
/* No entries in the list? */ |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
343 |
if (list->size() == 0) { |
8299
e8b5a9aef71a
(svn r11863) -Fix (r11848): One day I'll learn C++... Delete all items in a drop down list before deleting the list.
peter1138
parents:
8294
diff
changeset
|
344 |
DeleteDropDownList(list); |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
345 |
return; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
346 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
347 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8857
diff
changeset
|
348 |
ShowDropDownList(w, list, selected, button, width); |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
349 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
350 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8543
diff
changeset
|
351 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8543
diff
changeset
|
352 |
* Delete the drop-down menu from window \a pw |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8543
diff
changeset
|
353 |
* @param pw Parent window of the drop-down menu window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8543
diff
changeset
|
354 |
*/ |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
355 |
void HideDropDownMenu(Window *pw) |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
356 |
{ |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
357 |
Window **wz; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
358 |
FOR_ALL_WINDOWS(wz) { |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
359 |
if ((*wz)->window_class != WC_DROPDOWN_MENU) continue; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
360 |
|
9189
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
361 |
DropdownWindow *dw = dynamic_cast<DropdownWindow*>(*wz); |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
362 |
if (pw->window_class == dw->parent_wnd_class && |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
363 |
pw->window_number == dw->parent_wnd_num) { |
128a1809a977
(svn r13052) -Codechange: make a class of the DropdownWindow.
rubidium
parents:
9166
diff
changeset
|
364 |
delete dw; |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
365 |
break; |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
366 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
367 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
368 |
} |
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
diff
changeset
|
369 |