forked from TheSuperHackers/GeneralsGameCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGadgetListBox.h
More file actions
208 lines (185 loc) · 13.2 KB
/
GadgetListBox.h
File metadata and controls
208 lines (185 loc) · 13.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/*
** Command & Conquer Generals Zero Hour(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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, either version 3 of the License, or
** (at your option) any later version.
**
** This program 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. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GadgetListBox.h //////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: GadgetListBox.h
//
// Created: Colin Day, June 2001
//
// Desc: Helpful interface for ListBoxes
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "GameClient/Gadget.h"
#include "GameClient/GameWindow.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
typedef struct _RightClickStruct
{
Int mouseX;
Int mouseY;
Int pos;
} RightClickStruct;
///////////////////////////////////////////////////////////////////////////////
// INLINING ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
extern Int GadgetListBoxGetEntryBasedOnXY( GameWindow *listbox, Int x, Int y, Int &row, Int &column);
extern void GadgetListboxCreateScrollbar( GameWindow *listbox );
extern void GadgetListBoxAddMultiSelect( GameWindow *listbox );
extern void GadgetListBoxRemoveMultiSelect( GameWindow *listbox );
extern void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength );
extern Int GadgetListBoxGetListLength( GameWindow *listbox ); ///< Returns the maximum possible number of list entries. Length is synonymous to rows
extern Int GadgetListBoxGetMaxSelectedLength( GameWindow *listbox ); ///< Returns the maximum possible number of list entries that can be selected
extern Int GadgetListBoxGetNumEntries( GameWindow *listbox );
extern Int GadgetListBoxGetNumColumns( GameWindow *listbox );
extern Int GadgetListBoxGetColumnWidth( GameWindow *listbox, Int column );
extern void GadgetListBoxSetFont( GameWindow *listbox, GameFont *font );
extern UnicodeString GadgetListBoxGetText( GameWindow *listbox, Int row, Int column = 0);
extern UnicodeString GadgetListBoxGetTextAndColor( GameWindow *listbox, Color *color, Int row, Int column = 0);
extern Int GadgetListBoxAddEntryText( GameWindow *listbox, UnicodeString text, Color color, Int row, Int column = -1, Bool overwrite = TRUE);
extern Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image,
Int row, Int column = -1,
Bool overwrite = TRUE, Color color = 0xFFFFFFFF );
extern Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image,
Int row, Int column,
Int hight, Int width,
Bool overwrite = TRUE, Color color = 0xFFFFFFFF );
extern void GadgetListBoxSetSelected( GameWindow *listbox, Int selectIndex );
extern void GadgetListBoxSetSelected( GameWindow *listbox, const Int *selectList, Int selectCount = 1 );
extern void GadgetListBoxGetSelected( GameWindow *listbox, Int *selectList );
extern void GadgetListBoxReset( GameWindow *listbox );
extern void GadgetListBoxSetItemData( GameWindow *listbox, void *data, Int row, Int column = 0);
extern void *GadgetListBoxGetItemData( GameWindow *listbox, Int row, Int column = 0);
extern bool GadgetListBoxIsFull(GameWindow *window);
extern Int GadgetListBoxGetBottomVisibleEntry( GameWindow *window );
extern void GadgetListBoxSetBottomVisibleEntry( GameWindow *window, Int newPos );
extern Int GadgetListBoxGetTopVisibleEntry( GameWindow *window );
extern void GadgetListBoxSetTopVisibleEntry( GameWindow *window, Int newPos );
extern void GadgetListBoxSetAudioFeedback( GameWindow *listbox, Bool enable );
//
// you can use this to set the colors for the list box all at once, note that
// it will also automatically change the colors for any attached slider
// and those slider buttons and thumb
//
extern void GadgetListBoxSetColors( GameWindow *listbox,
Color enabledColor,
Color enabledBorderColor,
Color enabledSelectedItemColor,
Color enabledSelectedItemBorderColor,
Color disabledColor,
Color disabledBorderColor,
Color disabledSelectedItemColor,
Color disabledSelectedItemBorderColor,
Color hiliteColor,
Color hiliteBorderColor,
Color hiliteSelectedItemColor,
Color hiliteSelectedItemBorderColor );
inline void GadgetListBoxSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); }
inline void GadgetListBoxSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); }
inline void GadgetListBoxSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); }
inline void GadgetListBoxSetEnabledSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); }
inline void GadgetListBoxSetEnabledSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); }
inline void GadgetListBoxSetEnabledSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); }
inline void GadgetListBoxSetEnabledSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 4, image ); }
inline void GadgetListBoxSetEnabledSelectedItemColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); }
inline void GadgetListBoxSetEnabledSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); }
inline const Image *GadgetListBoxGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); }
inline Color GadgetListBoxGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); }
inline Color GadgetListBoxGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); }
inline const Image *GadgetListBoxGetEnabledSelectedItemImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 1 ); }
inline const Image *GadgetListBoxGetEnabledSelectedItemImageRight( GameWindow *g ) { return g->winGetEnabledImage( 2 ); }
inline const Image *GadgetListBoxGetEnabledSelectedItemImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); }
inline const Image *GadgetListBoxGetEnabledSelectedItemImageSmallCenter( GameWindow *g ){ return g->winGetEnabledImage( 4 ); }
inline Color GadgetListBoxGetEnabledSelectedItemColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); }
inline Color GadgetListBoxGetEnabledSelectedItemBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); }
inline void GadgetListBoxSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); }
inline void GadgetListBoxSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); }
inline void GadgetListBoxSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); }
inline void GadgetListBoxSetDisabledSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); }
inline void GadgetListBoxSetDisabledSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); }
inline void GadgetListBoxSetDisabledSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); }
inline void GadgetListBoxSetDisabledSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 4, image ); }
inline void GadgetListBoxSetDisabledSelectedItemColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); }
inline void GadgetListBoxSetDisabledSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); }
inline const Image *GadgetListBoxGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); }
inline Color GadgetListBoxGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); }
inline Color GadgetListBoxGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); }
inline const Image *GadgetListBoxGetDisabledSelectedItemImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 1 ); }
inline const Image *GadgetListBoxGetDisabledSelectedItemImageRight( GameWindow *g ) { return g->winGetDisabledImage( 2 ); }
inline const Image *GadgetListBoxGetDisabledSelectedItemImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 3 ); }
inline const Image *GadgetListBoxGetDisabledSelectedItemImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 4 ); }
inline Color GadgetListBoxGetDisabledSelectedItemColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); }
inline Color GadgetListBoxGetDisabledSelectedItemBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); }
inline void GadgetListBoxSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); }
inline void GadgetListBoxSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); }
inline void GadgetListBoxSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); }
inline void GadgetListBoxSetHiliteSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); }
inline void GadgetListBoxSetHiliteSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); }
inline void GadgetListBoxSetHiliteSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); }
inline void GadgetListBoxSetHiliteSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 4, image ); }
inline void GadgetListBoxSetHiliteSelectedItemColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); }
inline void GadgetListBoxSetHiliteSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); }
inline const Image *GadgetListBoxGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); }
inline Color GadgetListBoxGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); }
inline Color GadgetListBoxGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); }
inline const Image *GadgetListBoxGetHiliteSelectedItemImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 1 ); }
inline const Image *GadgetListBoxGetHiliteSelectedItemImageRight( GameWindow *g ) { return g->winGetHiliteImage( 2 ); }
inline const Image *GadgetListBoxGetHiliteSelectedItemImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 3 ); }
inline const Image *GadgetListBoxGetHiliteSelectedItemImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 4 ); }
inline Color GadgetListBoxGetHiliteSelectedItemColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); }
inline Color GadgetListBoxGetHiliteSelectedItemBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); }
inline GameWindow *GadgetListBoxGetSlider( GameWindow *g )
{
ListboxData *listData = (ListboxData *)g->winGetUserData();
if( listData && listData->slider )
return listData->slider;
return nullptr;
}
inline GameWindow *GadgetListBoxGetUpButton( GameWindow *g )
{
ListboxData *listData = (ListboxData *)g->winGetUserData();
if( listData && listData->upButton )
return listData->upButton;
return nullptr;
}
inline GameWindow *GadgetListBoxGetDownButton( GameWindow *g )
{
ListboxData *listData = (ListboxData *)g->winGetUserData();
if( listData && listData->downButton )
return listData->downButton;
return nullptr;
}
// EXTERNALS //////////////////////////////////////////////////////////////////