OWLNext    7.0
Borland's Object Windows Library for the modern age
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
combobox.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1991, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Definition of class TComboBox and TComboBoxData the base class for all
7/// combobox controls.
8//----------------------------------------------------------------------------
9
10#if !defined(OWL_COMBOBOX_H)
11#define OWL_COMBOBOX_H
12
13#include <owl/private/defs.h>
14#if defined(BI_HAS_PRAGMA_ONCE)
15# pragma once
16#endif
17
18#include <owl/listbox.h>
19#include <utility>
20
21
22namespace owl {
23
24class _OWLCLASS TComboBoxData;
25
26#include <owl/preclass.h>
27
28//
29/// \addtogroup ctrl
30/// @{
31/// \class TComboBox
32// ~~~~~ ~~~~~~~~~
33/// You can use TComboBox to create a combo box or a combo box control in a parent
34/// TWindow, or to facilitate communication between your application and the combo
35/// box controls of TDialog. TComboBox objects inherit most of their behavior from
36/// TListBox. This class is streamable.
37///
38/// There are three types of combo boxes: simple, drop down, and drop down list.
39/// These types are governed by the style constants CBS_SIMPLE, CBS_DROPDOWN, and
40/// CBS_DROPDOWNLIST. These constants, supplied to the constructor of a TComboBox,
41/// indicate the type of combo box element to create.
42//
43/// \todo Add support for new Windows Vista messages CB_SETCUEBANNER and CB_GETCUEBANNER
44//
46 : public TListBox
47{
48 public:
49 TComboBox(TWindow* parent, int id, int x, int y, int w, int h, uint32 style, uint textLimit, TModule* module = 0);
50 TComboBox(TWindow* parent, int resourceId, uint textLimit = 0, TModule* module = 0);
51 TComboBox(THandle hWnd, TModule* module = 0);
52 ~TComboBox();
53
54 auto GetInfo() const -> COMBOBOXINFO;
55 auto GetButtonRect() const -> TRect {return GetInfo().rcButton;}
56 auto GetButtonState() const -> uint {return GetInfo().stateButton;}
57
58 // For combo box's edit subcontrol
59 //
60 auto GetEditHandle() const -> THandle {return GetInfo().hwndItem;}
61 auto GetEditRect() const -> TRect {return GetInfo().rcItem;}
62 int GetTextLen() const;
63 int GetText(LPTSTR str, int maxChars) const;
64 tstring GetText() const {return GetWindowText();}
65 void SetText(LPCTSTR str);
66 void SetText(const tstring& str) {SetText(str.c_str());}
67
68 uint GetTextLimit();
69 void SetTextLimit(uint textlimit);
70
71 int GetEditSel(int& startPos, int& endPos);
72 std::pair<int, int> GetEditSel();
73 int SetEditSel(int startPos, int endPos);
74
75 void Clear();
76
77 // For drop down combo boxes
78 //
79 auto GetListHandle() const -> THandle {return GetInfo().hwndList;}
80 void ShowList(bool show = true);
81 void HideList();
82
83 void GetDroppedControlRect(TRect& Rect) const;
84 bool GetDroppedState() const;
85 bool GetExtendedUI() const;
86 int SetExtendedUI(bool Extended);
87 uint GetDroppedWidth() const;
88 int SetDroppedWidth(uint width);
89
90 // Combo's List box virtual functions
91 //
92 virtual int AddString(LPCTSTR str);
93 using TListBox::AddString; // Inject string-aware overload.
94 virtual int InsertString(LPCTSTR str, int index);
95 using TListBox::InsertString; // Inject string-aware overload.
96 virtual int DeleteString(int index);
97
98 virtual void ClearList();
99 virtual int DirectoryList(uint attrs, LPCTSTR fileSpec);
100 using TListBox::DirectoryList; // Inject string-aware overload.
101
102 virtual int GetCount() const;
103 virtual int FindString(LPCTSTR find, int startIndex = -1) const;
104 using TListBox::FindString; // Inject string-aware overload.
105 virtual int FindStringExact(LPCTSTR find, int startIndex = -1) const;
106 using TListBox::FindStringExact; // Inject string-aware overload.
107 virtual int SetSelStringExact(LPCTSTR find, int startIndex = -1); //DLN added
108 using TListBox::SetSelStringExact; // Inject string-aware overload.
109
110 virtual int GetStringLen(int index) const;
111 virtual int GetString(LPTSTR str, int index) const;
112 using TListBox::GetString; // Inject string-aware overload.
113
114 virtual int GetTopIndex() const;
115 virtual int SetTopIndex(int index);
116 virtual int GetHorizontalExtent() const;
117 virtual void SetHorizontalExtent(int horzExtent);
118
119 virtual int GetSelIndex() const;
120 virtual int SetSelIndex(int index);
121 virtual int SetSelString(LPCTSTR findStr, int startIndex = -1);
122 using TListBox::SetSelString; // Inject string-aware overload.
123 virtual LPARAM GetItemData(int index) const;
124 virtual int SetItemData(int index, LPARAM itemData);
125
126 int GetItemHeight(int index) const;
127 int SetItemHeight(int index, int height);
128
129 int InitStorage(int numItemsToAdd, uint32 memoryToAllocate);
130
131 // Safe overload
132 //
134
135 protected:
136
137 // Override TWindow virtual member functions
138 //
139 virtual uint Transfer(void* buffer, TTransferDirection direction);
140
141 protected:
142 // Override TWindow virtual member functions
143 //
144 virtual auto GetWindowClassName() -> TWindowClassName;
145 void SetupWindow();
146 void CleanupWindow();
147
149 uint TextLimit; ///< Maximum length of text in edit subcontrol
150
151 private:
152 // Hidden to prevent accidental copying or assignment
153 //
154 TComboBox(const TComboBox&);
156
158};
159
161
162//
163// combo box notification macros. methods are: void method()
164//
165// EV_CBN_CLOSEUP(id, method)
166// EV_CBN_DBLCLK(id, method)
167// EV_CBN_DROPDOWN(id, method)
168// EV_CBN_EDITCHANGE(id, method)
169// EV_CBN_EDITUPDATE(id, method)
170// EV_CBN_ERRSPACE(id, method)
171// EV_CBN_KILLFOCUS(id, method)
172// EV_CBN_SELCHANGE(id, method)
173// EV_CBN_SELENDCANCEL(id, method)
174// EV_CBN_SELENDOK(id, method)
175// EV_CBN_SETFOCUS(id, method)
176
177//
178/// \class TComboBoxData
179// ----- -------------
180/// An interface object that represents a transfer buffer for a TComboBox.
181//
183 public:
186
187 /// 30.05.2007 - Submitted by Frank Rast:
188 /// TComboBoxData needs a copy constructor because the
189 /// default copy constructor does not deep copy the
190 /// protected data of this class. For the same reason a
191 /// assignment operator is needed.
193 TComboBoxData &operator=(const TComboBoxData& tCBD);
194
195
196 TStringArray& GetStrings();
197 TLParamArray& GetItemDatas();
198 int GetSelIndex();
199 tstring& GetSelection();
200
201 void AddString(LPCTSTR str, bool isSelected = false);
202 void AddString(const tstring& str, bool isSelected = false) {AddString(str.c_str(), isSelected);}
203 void AddStringItem(LPCTSTR str, LPARAM itemData, bool isSelected = false);
204 void AddStringItem(const tstring& str, LPARAM itemData, bool isSelected = false) {AddStringItem(str.c_str(), itemData, isSelected);}
205 void Clear();
206
207 void Select(int index);
208 void SelectString(LPCTSTR str);
209 void SelectString(const tstring& str) {SelectString(str.c_str());}
210 int GetSelCount() const;
211 void ResetSelections();
212 int GetSelStringLength() const;
213 void GetSelString(LPTSTR buffer, int bufferSize) const;
214 const tstring& GetSelString() const {return Selection;}
215
216
218 TStringArray* Strings; ///< Array of class string to transfer to or from a combo box's associated list box.
219 TLParamArray* ItemDatas; ///< Array of data associated with the items of the combo box.
220 tstring Selection; ///< The currently selected string to transfer to or from a combo box.
221 int SelIndex; ///< The zero based index to the currently selected string; negative if no string is
222 ///< selected.
223
224};
225/// @}
226
227#include <owl/posclass.h>
228
229
230//----------------------------------------------------------------------------
231// Inline implementations
232//
233
234//
235/// Returns the text length (excluding the terminating zero) of the edit control or
236/// static portion of the combo box.
237//
238inline int TComboBox::GetTextLen() const {
240 return GetWindowTextLength();
241}
242
243//
244/// Return the limit of new characters that can be entered into the edit
245/// control portion of the combobox.
246//
248 return TextLimit;
249}
250
251//
252/// Hides the drop down list of a drop down or drop down list combo box.
253//
254inline void TComboBox::HideList() {
255 ShowList(false);
256}
257
258//
259/// Retrieves up to maxChars characters in the edit or static portion of the combo
260/// box. The number of characters retrieved is returned
261//
262inline int TComboBox::GetText(LPTSTR str, int maxChars) const {
264 return GetWindowText(str, maxChars);
265}
266
267//
268/// Selects characters that are between startPos and endPos in the edit control of
269/// the combo box. Returns CB_ERR if the combo box does not have an edit control.
270//
273 return static_cast<int>(SendMessage(CB_SETEDITSEL, 0, MkParam2(startPos, endPos)));
274}
275
276//
277/// Clear the text
278//
279inline void TComboBox::Clear() {
280 SetText(_T(""));
281}
282
283//
284/// For drop down combo boxes, determines if a list box is visible.
285//
286inline bool TComboBox::GetDroppedState() const {
288 return static_cast<bool>(CONST_CAST(TComboBox*,this)->SendMessage(CB_GETDROPPEDSTATE));
289}
290
291//
292/// Determines if the combo box has the extended user interface, which differs from
293/// the default user interface in the following ways:
294/// - Displays the list box if the user clicks the static text field.
295/// - Displays the list box if the user presses the Down key.
296/// - Disables scrolling in the static text field if the item list is
297/// not visible.
298///
299/// Returns true if the combo box has the extended user interface; otherwise
300/// returns false.
301//
302inline bool TComboBox::GetExtendedUI() const {
304 return static_cast<bool>(CONST_CAST(TComboBox*,this)->SendMessage(CB_GETEXTENDEDUI));
305}
306
307//
308/// Specifies whether the combo box uses the extended user interface or the default
309/// user interface. A value of true selects the extended user interface; a value of
310/// false selects the standard user interface. If the operation succeeds, the return
311/// value is CB_OKAY. If an error occurs, it is CB_ERR.
312///
313/// By default, the F4 key opens or closes the list and the DOWN ARROW changes the
314/// current selection. In the extended user interface, the F4 key is disabled and
315/// the DOWN ARROW key opens the drop-down list.
316//
319 return static_cast<bool>(SendMessage(CB_SETEXTENDEDUI, extended));
320}
321
322//
323/// Returns the minimum allowable width, in pixels, of the list box of a
324/// combo box with the CBS_DROPDOWN or CBS_DROPDOWNLIST style on success; otherwise
325/// returns CB_ERR.
326///
327/// By default, the minimum allowable width of the drop-down list box is 0. The
328/// width of the list box is either the minimum allowable width or the combo box
329/// width, whichever is larger.
330//
332{
334 return static_cast<uint>(CONST_CAST(TComboBox*,this)->SendMessage(CB_GETDROPPEDWIDTH));
335}
336
337//
338/// Sets the maximum allowable width, in pixels, of the list box of a
339/// combo box with the CBS_DROPDOWN or CBS_DROPDOWNLIST style. Returns the new width
340/// of the box on success; otherwise returns CB_ERR.
341///
342/// By default, the minimum allowable width of the drop-down list box is 0. The
343/// width of the list box is either the minimum allowable width or the combo box
344/// width, whichever is larger.
345//
347{
349 return static_cast<int>(SendMessage(CB_SETDROPPEDWIDTH, width, 0));
350}
351//
352/// Adds a string to an associated list part of a combo box. Returns the index of
353/// the string in the list. The first entry is at index zero. Returns a negative
354/// value if an error occurs.
355//
358 return static_cast<int>(SendMessage(CB_ADDSTRING, 0, TParam2(str)));
359}
360
361//
362/// Insert a string in list part of the associated combobox at the passed
363/// index, returning the index of the string in the list
364/// A negative value is returned if an error occurs
365//
366inline int TComboBox::InsertString(LPCTSTR str, int index) {
368 return static_cast<int>(SendMessage(CB_INSERTSTRING, index, TParam2(str)));
369}
370
371//
372/// Deletes the string at the passed index in the associated list part of a combo
373/// box. Returns a count of the entries remaining in the list or a negative value if
374/// an error occurs.
375//
376inline int TComboBox::DeleteString(int index) {
378 return static_cast<int>(SendMessage(CB_DELETESTRING, index));
379}
380
381//
382/// Fills the combo box with file names from a specified directory.
383///
384/// fileSpec points to the null-terminated string that specifies the filename to add
385/// to the list. If the filename contains wildcards (for example, *.*), all files
386/// that match the wildcards and have the attributes specified by the uAttrs
387/// parameter are added to the list.
388///
389/// attrs can be any combination of:
390/// - \c \b DDL_ARCHIVE Includes archived files.
391/// - \c \b DDL_DIRECTORY Includes subdirectories. Subdirectory names are enclosed in square
392/// brackets ([ ]).
393/// - \c \b DDL_DRIVES Includes drives. Drives are listed in the form [-x-], where x is
394/// the drive letter.
395/// - \c \b DDL_EXCLUSIVE Includes only files with the specified attributes. By default,
396/// read-write files are listed even if DDL_READWRITE is not specified.
397/// - \c \b DDL_HIDDEN Includes hidden files.
398/// - \c \b DDL_READONLY Includes read-only files.
399/// - \c \b DDL_READWRITE Includes read-write files with no additional attributes.
400/// - \c \b DDL_SYSTEM Includes system files.
401//
404 return static_cast<int>(SendMessage(CB_DIR, attrs, TParam2(fileSpec)));
405}
406
407//
408/// Clear all the entries in list part of the associated combobox
409//
414
415//
416/// Return the number of entries in list part of the associated combobox. A
417/// negative value is returned if an error occurs
418//
419inline int TComboBox::GetCount() const {
421 return static_cast<int>(CONST_CAST(TComboBox*,this)->SendMessage(CB_GETCOUNT));
422}
423
424//
425/// Return the index of the first string in list part of the associated
426/// combobox which begins with the passed string.
427//
428/// Search for a match beginning at the passed startIndex. If a match is not
429/// found after the last string has been compared, the search continues from
430/// the beginning of the list until a match is found or until the list has been
431/// completely traversed.
432//
433/// Search from beginning of list when -1 is passed as the startIndex.
434//
435/// Return the index of the selected string. A negative value is returned if an
436/// error occurs.
437//
438inline int TComboBox::FindString(LPCTSTR find, int startIndex) const {
440 return static_cast<int>(CONST_CAST(TComboBox*,this)->
442}
443
444/// Return the index of the first string in list part of the associated
445/// combobox which is exactly same with the passed string.
446//
447/// Search for a exact match at the passed SearchIndex. If a match is not
448/// found after the last string has been compared, the search continues from
449/// the beginning of the list until a match is found or until the list has been
450/// completely traversed.
451//
452/// Search from beginning of list when -1 is passed as the index
453//
454/// Return the index of the selected string. A negative value is returned if an
455/// error occurs
456//
457/// \note If you create the combo box with an owner-drawn style but without the
458/// CBS_HASSTRINGS style, what FindStringExact does depends on whether your
459/// application uses the CBS_SORT style. If you use the CBS_SORT style,
460/// WM_COMPAREITEM messages are sent to the owner of the combo box to determine
461/// which item matches the specified string. If you do not use the CBS_SORT style,
462/// FindStringExact searches for a list item that matches the value of the find
463/// parameter.
464//
467 return static_cast<int>(CONST_CAST(TComboBox*,this)->
469}
470
471//
472/// Retrieve the contents of the string at the passed index of list part of the
473/// associated combobox, returning the length of the string (in bytes excluding
474/// the terminating 0) as the value of the call
475//
476/// A negative value is returned if the passed index is not valid
477//
478/// The buffer must be large enough for the string and the terminating 0
479//
480inline int TComboBox::GetString(LPTSTR str, int index) const {
482 return static_cast<int>(CONST_CAST(TComboBox*,this)->
483 SendMessage(CB_GETLBTEXT, index, TParam2(str)));
484}
485
486//
487/// Return the length of the string at the passed index in the associated combo
488/// list excluding the terminating 0
489//
490/// A negative value is returned if an error occurs
491//
492inline int TComboBox::GetStringLen(int index) const {
494 return static_cast<int>(CONST_CAST(TComboBox*,this)->
496}
497
498//
499/// Returns the zero-based index of the first visible item in the list box portion
500/// of a combo box. Initially the item with index 0 is at the top of the list box,
501/// but if the list box contents have been scrolled, another item may be at the top.
502/// CB_ERR is returned on failure.
503//
504inline int TComboBox::GetTopIndex() const {
506 return static_cast<int>(CONST_CAST(TComboBox*,this)->SendMessage(CB_GETTOPINDEX));
507}
508
509//
510/// The system scrolls the list box contents so that either the string specified by
511/// index appears at the top of the list box or the maximum scroll range has been
512/// reached. On success 0 is returned; on failure CB_ERR is returned.
513//
514inline int TComboBox::SetTopIndex(int index) {
516 return static_cast<int>(SendMessage(CB_SETTOPINDEX, index));
517}
518
519//
520/// Retrieves from a combo box the width, in pixels, by which the list box can be
521/// scrolled horizontally (the scrollable width). This is applicable only if the
522/// list box has a horizontal scroll bar.
523//
526 return static_cast<int>(CONST_CAST(TComboBox*,this)->SendMessage(CB_GETHORIZONTALEXTENT));
527}
528
529//
530/// Set the width, in pixels, by which a list box can be scrolled horizontally (the
531/// scrollable width). If the width of the list box is smaller than this value, the
532/// horizontal scroll bar horizontally scrolls items in the list box. If the width
533/// of the list box is equal to or greater than this value, the horizontal scroll
534/// bar is hidden or, if the combo box has the CBS_DISABLENOSCROLL style, disabled.
535//
540
541//
542/// Returns the index of the list selection or a negative value if none exists.
543//
544inline int TComboBox::GetSelIndex() const {
546 return static_cast<int>(CONST_CAST(TComboBox*,this)->SendMessage(CB_GETCURSEL));
547}
548
549//
550/// Selects a string of characters in a combo box. index specifies the index of the
551/// string of characters in the list box to select. If the index is 0, the first
552/// line in the list box is selected. If the index is -1, the current selection is
553/// removed. If an error occurs, a negative value is returned.
554//
555inline int TComboBox::SetSelIndex(int index) {
557 return static_cast<int>(SendMessage(CB_SETCURSEL, index));
558}
559
560//
561/// Selects a string of characters in the associated list box and sets the contents
562/// of the associated edit control to the supplied string.
563//
568
569//
570/// DLN added
571//
573{
575 int index = static_cast<int>(CONST_CAST(TComboBox*,this)->
576 SendMessage(CB_FINDSTRINGEXACT, startIndex,reinterpret_cast<LPARAM>(find)));
577 return SetSelIndex(index);
578}
579
580
581//
582/// Returns the 32-bit value associated with the combo box's item.
583//
584inline LPARAM TComboBox::GetItemData(int index) const {
586 return static_cast<LPARAM>(const_cast<TComboBox*>(this)->SendMessage(CB_GETITEMDATA, index));
587}
588
589//
590/// Sets the 32-bit value associated with the TComboBox's item. If an error occurs,
591/// returns a negative value.
592//
593inline int TComboBox::SetItemData(int index, LPARAM itemData) {
595 return static_cast<int>(SendMessage(CB_SETITEMDATA, index, itemData));
596}
597
598//
599/// Returns the height in pixels of the Combo box's list items. If an error occurs,
600/// returns a negative value.
601//
602inline int TComboBox::GetItemHeight(int index) const {
604 return static_cast<int>(CONST_CAST(TComboBox*,this)->
606}
607
608//
609/// Sets the height of the list items or the edit control portion in a combo box. If
610/// the index or height is invalid, returns a negative value.
611//
612inline int TComboBox::SetItemHeight(int index, int height) {
614 return static_cast<int>(SendMessage(CB_SETITEMHEIGHT, index, MkParam2(height, 0)));
615}
616
617//
618/// Allocates memory for storing combo box items. An application sends
619/// this message before adding a large number of items to a combo box.
620///
621/// numItemsToAdd specifies the number of items to add. Windows 95: The wParam
622/// parameter is limited to 16-bit values. This means combo boxes cannot contain
623/// more than 32,767 items. Although the number of items is restricted, the total
624/// size in bytes of the items in a combo box is limited only by available memory.
625///
626/// memoryToAllocate specifies the amount of memory, in bytes, to allocate for item
627/// strings.
628///
629/// The return value is the maximum number of items that the memory object can store
630/// before another memory reallocation is needed, if successful. It is LB_ERRSPACE
631/// if not enough memory is available.
632///
633/// LB_INITSTORAGE Remarks:
634///
635/// Windows 95: This message helps speed up the initialization of list boxes that
636/// have a large number of items (more than 100). It reserves the specified amount
637/// of memory so that subsequent CB_ADDSTRING, CB_INSERTSTRING, CB_DIR, and
638/// CB_ADDFILE messages take the shortest possible time. You can use estimates for
639/// the cItems and cb parameters. If you overestimate, the extra memory is
640/// allocated; if you underestimate, the normal allocation is used for items that
641/// exceed the requested amount.
642///
643/// Windows NT: This message is not needed on Windows NT. It does not reserve the
644/// specified amount of memory, because available memory is virtually unlimited. The
645/// return value is always the value specified in the numItemsToAdd parameter.
646//
651
652//
653/// Returns the array of strings (the Strings data member) to transfer to or from a
654/// combo box's associated list box.
655//
657 return *Strings;
658}
659
660//
661/// Returns the array of DWORDs to transfer to or from a combo box's associated list
662/// box.
663//
665 return *ItemDatas;
666}
667
668//
669/// Returns the index (the SelIndex data member) of the selected item in the strings
670/// array.
671//
673 return SelIndex;
674}
675
676//
677/// Returns the currently selected string (the Selection data member) to transfer to
678/// or from a combo box.
679//
681 return Selection;
682}
683
684//
685/// Returns the number of items selected, either 0 or 1.
686//
687inline int TComboBoxData::GetSelCount() const {
688 return SelIndex == CB_ERR ? 0 : 1;
689}
690
691//
692/// Resets the index of the selected item and the currently selected string.
693//
695 SelIndex = CB_ERR;
696 Selection = _T("");
697}
698
699
700} // OWL namespace
701
702
703#endif // OWL_COMBOBOX_H
#define PRECONDITION(condition)
Definition checks.h:227
An interface object that represents a transfer buffer for a TComboBox.
Definition combobox.h:182
int GetSelCount() const
Returns the number of items selected, either 0 or 1.
Definition combobox.h:687
void SelectString(const tstring &str)
Definition combobox.h:209
void AddStringItem(const tstring &str, LPARAM itemData, bool isSelected=false)
Definition combobox.h:204
TStringArray & GetStrings()
Returns the array of strings (the Strings data member) to transfer to or from a combo box's associate...
Definition combobox.h:656
int GetSelIndex()
Returns the index (the SelIndex data member) of the selected item in the strings array.
Definition combobox.h:672
tstring & GetSelection()
Returns the currently selected string (the Selection data member) to transfer to or from a combo box.
Definition combobox.h:680
const tstring & GetSelString() const
Definition combobox.h:214
TLParamArray & GetItemDatas()
Returns the array of DWORDs to transfer to or from a combo box's associated list box.
Definition combobox.h:664
void AddString(const tstring &str, bool isSelected=false)
Definition combobox.h:202
void ResetSelections()
Resets the index of the selected item and the currently selected string.
Definition combobox.h:694
You can use TComboBox to create a combo box or a combo box control in a parent TWindow,...
Definition combobox.h:47
virtual int SetSelString(LPCTSTR findStr, int startIndex=-1)
Selects a string of characters in the associated list box and sets the contents of the associated edi...
Definition combobox.h:564
tstring GetText() const
Definition combobox.h:64
int GetItemHeight(int index) const
Returns the height in pixels of the Combo box's list items.
Definition combobox.h:602
virtual int GetString(TCHAR *str, int index) const
Retrieve the contents of the string at the passed index of list part of the associated combobox,...
Definition combobox.h:480
void ShowList(bool show=true)
Shows or hides the drop down or drop down list combo box depending on the value of show.
Definition combobox.cpp:312
int InitStorage(int numItemsToAdd, uint32 memoryToAllocate)
Allocates memory for storing combo box items.
Definition combobox.h:647
virtual void SetHorizontalExtent(int horzExtent)
Set the width, in pixels, by which a list box can be scrolled horizontally (the scrollable width).
Definition combobox.h:536
int SetItemHeight(int index, int height)
Sets the height of the list items or the edit control portion in a combo box.
Definition combobox.h:612
void Clear()
Clear the text.
Definition combobox.h:279
auto GetButtonRect() const -> TRect
Definition combobox.h:55
virtual void ClearList()
Clear all the entries in list part of the associated combobox.
Definition combobox.h:410
auto GetButtonState() const -> uint
Definition combobox.h:56
int SetExtendedUI(bool Extended)
Specifies whether the combo box uses the extended user interface or the default user interface.
Definition combobox.h:317
virtual int GetTopIndex() const
Returns the zero-based index of the first visible item in the list box portion of a combo box.
Definition combobox.h:504
int SetEditSel(int startPos, int endPos)
Selects characters that are between startPos and endPos in the edit control of the combo box.
Definition combobox.h:271
auto GetEditRect() const -> TRect
Definition combobox.h:61
virtual int SetTopIndex(int index)
The system scrolls the list box contents so that either the string specified by index appears at the ...
Definition combobox.h:514
uint GetDroppedWidth() const
Returns the minimum allowable width, in pixels, of the list box of a combo box with the CBS_DROPDOWN ...
Definition combobox.h:331
auto GetListHandle() const -> THandle
Definition combobox.h:79
virtual int DeleteString(int index)
Deletes the string at the passed index in the associated list part of a combo box.
Definition combobox.h:376
bool GetExtendedUI() const
Determines if the combo box has the extended user interface, which differs from the default user inte...
Definition combobox.h:302
int GetTextLen() const
Returns the text length (excluding the terminating zero) of the edit control or static portion of the...
Definition combobox.h:238
virtual int FindString(LPCTSTR find, int startIndex=-1) const
Return the index of the first string in list part of the associated combobox which begins with the pa...
Definition combobox.h:438
virtual int InsertString(LPCTSTR str, int index)
Insert a string in list part of the associated combobox at the passed index, returning the index of t...
Definition combobox.h:366
virtual int SetSelStringExact(LPCTSTR find, int startIndex=-1)
DLN added.
Definition combobox.h:572
void SetText(const tstring &str)
Definition combobox.h:66
void HideList()
Hides the drop down list of a drop down or drop down list combo box.
Definition combobox.h:254
uint GetTextLimit()
Return the limit of new characters that can be entered into the edit control portion of the combobox.
Definition combobox.h:247
int SetDroppedWidth(uint width)
Sets the maximum allowable width, in pixels, of the list box of a combo box with the CBS_DROPDOWN or ...
Definition combobox.h:346
virtual int AddString(LPCTSTR str)
Adds a string to an associated list part of a combo box.
Definition combobox.h:356
virtual int SetItemData(int index, LPARAM itemData)
Sets the 32-bit value associated with the TComboBox's item.
Definition combobox.h:593
bool GetDroppedState() const
For drop down combo boxes, determines if a list box is visible.
Definition combobox.h:286
auto GetEditHandle() const -> THandle
Definition combobox.h:60
virtual int GetCount() const
Return the number of entries in list part of the associated combobox.
Definition combobox.h:419
virtual int GetHorizontalExtent() const
Retrieves from a combo box the width, in pixels, by which the list box can be scrolled horizontally (...
Definition combobox.h:524
virtual int GetSelIndex() const
Returns the index of the list selection or a negative value if none exists.
Definition combobox.h:544
virtual int SetSelIndex(int index)
Selects a string of characters in a combo box.
Definition combobox.h:555
virtual LPARAM GetItemData(int index) const
Returns the 32-bit value associated with the combo box's item.
Definition combobox.h:584
void Transfer(TComboBoxData &data, TTransferDirection direction)
Definition combobox.h:133
virtual int FindStringExact(LPCTSTR find, int startIndex=-1) const
Return the index of the first string in list part of the associated combobox which is exactly same wi...
Definition combobox.h:465
virtual int DirectoryList(uint attrs, LPCTSTR fileSpec)
Fills the combo box with file names from a specified directory.
Definition combobox.h:402
virtual int GetStringLen(int index) const
Return the length of the string at the passed index in the associated combo list excluding the termin...
Definition combobox.h:492
void SetText(LPCTSTR str)
Selects the first string in the associated list box that begins with the supplied str.
Definition combobox.cpp:249
An interface object that represents a corresponding list box element.
Definition listbox.h:43
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
Definition module.h:47
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
tstring GetWindowText() const
String-aware overload.
Definition window.cpp:4415
TResult SendMessage(TMsgId, TParam1=0, TParam2=0) const
Sends a message (msg) to a specified window or windows.
Definition window.cpp:3288
HWND THandle
TWindow encapsulates an HWND.
Definition window.h:418
HWND GetHandle() const
Returns the handle of the window.
Definition window.h:2020
int GetWindowTextLength() const
Returns the length, in characters, of the specified window's title.
Definition window.h:2641
#define _T(x)
Definition cygwin.h:51
#define DECLARE_STREAMABLE_OWL(cls, ver)
Definition objstrm.h:1529
#define DECLARE_STREAMABLE_INLINES(cls)
Definition objstrm.h:1538
TTransferDirection
The TTransferDirection enum describes the constants that the transfer function uses to determine how ...
Definition window.h:92
Definition of class TListBox and TlistBoxData.
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
unsigned long uint32
Definition number.h:34
LPARAM TParam2
Second parameter type.
Definition dispatch.h:55
TParam2 MkParam2(const T1 &lo, const T2 &hi)
Definition dispatch.h:65
std::string tstring
Definition defs.h:79
unsigned int uint
Definition number.h:25
#define protected_data
Definition defs.h:208
#define public_data
Definition defs.h:207
#define CONST_CAST(targetType, object)
Definition defs.h:273
#define _OWLCLASS
Definition defs.h:338