Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/Tools/3dsmaxExport/LEXIExporter/GDIMetaLib/Sources/GDIComboBox.cpp @ 6

Last change on this file since 6 was 6, checked in by anonymous, 17 years ago

=…

File size: 5.9 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of LEXIExporter
4
5Copyright 2006 NDS Limited
6
7Author(s):
8Bo Krohn
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23-----------------------------------------------------------------------------
24*/
25
26/////////////////////////////////////////////////
27//
28//  Max Exporter - GDI ComboBox
29//
30/////////////////////////////////////////////////
31
32#include "stdafx.h"
33
34//
35
36namespace GDI {
37
38//
39
40ComboBox::ComboBox()
41{
42}
43
44ComboBox::~ComboBox()
45{
46}
47
48//
49
50void ComboBox::Clear()
51{
52        SendMessage(WM_CLEAR, 0, 0);
53}
54
55//
56
57void ComboBox::Copy()
58{
59        SendMessage(WM_COPY, 0, 0);
60}
61
62//
63
64void ComboBox::Cut()
65{
66        SendMessage(WM_CUT, 0, 0);
67}
68
69//
70
71bool ComboBox::GetComboBoxInfo(COMBOBOXINFO* pCBI) const
72{
73        return ::GetComboBoxInfo(m_hWnd, pCBI) ? true : false;
74}
75
76//
77
78unsigned int ComboBox::GetCount() const
79{
80        return (unsigned int)SendMessage(CB_GETCOUNT, 0, 0);
81}
82
83//
84
85int ComboBox::GetCurSel() const
86{
87        return (int)SendMessage(CB_GETCURSEL, 0, 0);
88}
89
90//
91
92void ComboBox::GetDroppedControlRect(RECT* pRect) const
93{
94        SendMessage(CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)pRect);
95}
96
97//
98
99bool ComboBox::GetDroppedState() const
100{
101        return SendMessage(CB_GETDROPPEDSTATE, 0, 0) ? true : false;
102}
103
104//
105
106unsigned int ComboBox::GetDroppedWidth() const
107{
108        return (unsigned int)SendMessage(CB_GETDROPPEDWIDTH, 0, 0);
109}
110
111//
112
113unsigned int ComboBox::GetEditSel() const
114{
115        return (unsigned int)SendMessage(CB_GETEDITSEL, 0, 0);
116}
117
118//
119
120bool ComboBox::GetExtendedUI() const
121{
122        return SendMessage(CB_GETEXTENDEDUI, 0, 0) ? true : false;
123}
124
125//
126
127unsigned int ComboBox::GetHorizontalExtent() const
128{
129        return (unsigned int)SendMessage(CB_GETHORIZONTALEXTENT, 0, 0);
130}
131
132//
133
134DWORD_PTR ComboBox::GetItemData(int iIndex) const
135{
136        return SendMessage(CB_GETITEMDATA, iIndex, 0);
137}
138
139//
140
141void* ComboBox::GetItemDataPtr(int iIndex) const
142{
143        return (void*)GetItemData(iIndex);
144}
145
146//
147
148unsigned int ComboBox::GetItemHeight(int iIndex) const
149{
150        return (unsigned int)SendMessage(CB_GETITEMHEIGHT, iIndex, 0L);
151}
152
153//
154
155unsigned int ComboBox::GetLBText(int iIndex, char* pszText) const
156{
157        return (unsigned int)SendMessage(CB_GETLBTEXT, iIndex, (LPARAM)pszText);
158}
159
160void ComboBox::GetLBText(int iIndex, std::string& sString) const
161{
162        char text[4096];
163        GetLBText(iIndex, text);
164        sString = text;
165}
166
167//
168
169unsigned int ComboBox::GetLBTextLen(int iIndex) const
170{
171        return (unsigned int)SendMessage(CB_GETLBTEXTLEN, iIndex, 0);
172}
173
174//
175
176LCID ComboBox::GetLocale() const
177{
178        return (LCID)SendMessage(CB_GETLOCALE, 0, 0);
179}
180
181//
182
183int ComboBox::GetTopIndex() const
184{
185        return (int)SendMessage(CB_GETTOPINDEX, 0, 0);
186}
187
188//
189
190bool ComboBox::LimitText(unsigned int iMaxChars)
191{
192        return SendMessage(CB_LIMITTEXT, iMaxChars, 0) ? true : false;
193}
194
195//
196
197void ComboBox::Paste()
198{
199        SendMessage(WM_PASTE, 0, 0);
200}
201
202//
203
204unsigned int ComboBox::SetCurSel(int iSelect)
205{
206        return (unsigned int)SendMessage(CB_SETCURSEL, iSelect, 0);
207}
208
209//
210
211unsigned int ComboBox::SetDroppedWidth(unsigned int iWidth)
212{
213        return (unsigned int)SendMessage(CB_SETDROPPEDWIDTH, iWidth, 0);
214}
215
216//
217
218bool ComboBox::SetEditSel(int iStartChar, int iEndChar)
219{
220        return SendMessage(CB_SETEDITSEL, 0, MAKELONG(iStartChar, iEndChar)) ? true : false;
221}
222
223//
224
225bool ComboBox::SetExtendedUI(bool bExtended)
226{
227        return SendMessage(CB_SETEXTENDEDUI, bExtended, 0) != CB_ERR ? true : false;
228}
229
230//
231
232void ComboBox::SetHorizontalExtent(unsigned int iExtent)
233{
234        SendMessage(CB_SETHORIZONTALEXTENT, iExtent, 0);
235}
236
237//
238
239bool ComboBox::SetItemData(int iIndex, DWORD_PTR dwItemData)
240{
241        return SendMessage(CB_SETITEMDATA, iIndex, (LPARAM)dwItemData) != CB_ERR ? true : false;
242}
243
244//
245
246bool ComboBox::SetItemDataPtr(int iIndex, void* pData)
247{
248        return SetItemData(iIndex, (DWORD_PTR)pData);
249}
250
251//
252
253bool ComboBox::SetItemHeight(int iIndex, unsigned int iItemHeight)
254{
255        return SendMessage(CB_SETITEMHEIGHT, iIndex, MAKELONG(iItemHeight, 0)) != CB_ERR ? true : false;
256}
257
258//
259
260LCID ComboBox::SetLocale(LCID nNewLocale)
261{
262        return (LCID)SendMessage(CB_SETLOCALE, (WPARAM)nNewLocale, 0);
263}
264
265//
266
267bool ComboBox::SetTopIndex(int iIndex)
268{
269        return SendMessage(CB_SETTOPINDEX, iIndex, 0) != CB_ERR ? true : false;
270}
271
272//
273
274void ComboBox::ShowDropDown(bool bShowIt)
275{
276        SendMessage(CB_SHOWDROPDOWN, bShowIt, 0);
277}
278
279//
280
281int ComboBox::AddString(const char* pszString)
282{
283        return (int)SendMessage(CB_ADDSTRING, 0, (LPARAM)pszString);
284}
285
286//
287
288int ComboBox::DeleteString(int iIndex)
289{
290        return (int)SendMessage(CB_DELETESTRING, iIndex, 0);
291}
292
293//
294
295int ComboBox::Dir(unsigned int attr, const char* pszWildCard)
296{
297        return (int)SendMessage(CB_DIR, attr, (LPARAM)pszWildCard);
298}
299
300//
301
302int ComboBox::FindString(int iStartAfter, const char* pszString) const
303{
304        return (int)SendMessage(CB_FINDSTRING, iStartAfter, (LPARAM)pszString);
305}
306
307//
308
309int ComboBox::FindStringExact(int iIndexStart, const char* pszFind) const
310{
311        return (int)SendMessage(CB_FINDSTRINGEXACT, iIndexStart, (LPARAM)pszFind);
312}
313
314//
315
316int ComboBox::InsertString(int iIndex, const char* pszString)
317{
318        return (int)SendMessage(CB_INSERTSTRING, iIndex, (LPARAM)pszString);
319}
320
321//
322
323void ComboBox::ResetContent()
324{
325        SendMessage(CB_RESETCONTENT, 0, 0);
326}
327
328//
329
330int ComboBox::SelectString(int iStartAfter, const char* pszString)
331{
332        return (int)SendMessage(CB_SELECTSTRING, iStartAfter, (LPARAM)pszString);
333}
334
335//
336
337} // namespace GDI
338
339//
340
Note: See TracBrowser for help on using the repository browser.