10#if !defined(OWL_COMBOBOX_H)
14#if defined(BI_HAS_PRAGMA_ONCE)
54 auto GetInfo()
const -> COMBOBOXINFO;
62 int GetTextLen()
const;
63 int GetText(LPTSTR str,
int maxChars)
const;
65 void SetText(LPCTSTR str);
69 void SetTextLimit(
uint textlimit);
71 int GetEditSel(
int& startPos,
int& endPos);
72 std::pair<int, int> GetEditSel();
73 int SetEditSel(
int startPos,
int endPos);
80 void ShowList(
bool show =
true);
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);
92 virtual int AddString(LPCTSTR str);
94 virtual int InsertString(LPCTSTR str,
int index);
96 virtual int DeleteString(
int index);
98 virtual void ClearList();
99 virtual int DirectoryList(
uint attrs, LPCTSTR fileSpec);
102 virtual int GetCount()
const;
103 virtual int FindString(LPCTSTR find,
int startIndex = -1)
const;
105 virtual int FindStringExact(LPCTSTR find,
int startIndex = -1)
const;
107 virtual int SetSelStringExact(LPCTSTR find,
int startIndex = -1);
110 virtual int GetStringLen(
int index)
const;
111 virtual int GetString(LPTSTR str,
int index)
const;
114 virtual int GetTopIndex()
const;
115 virtual int SetTopIndex(
int index);
116 virtual int GetHorizontalExtent()
const;
117 virtual void SetHorizontalExtent(
int horzExtent);
119 virtual int GetSelIndex()
const;
120 virtual int SetSelIndex(
int index);
121 virtual int SetSelString(LPCTSTR findStr,
int startIndex = -1);
123 virtual LPARAM GetItemData(
int index)
const;
124 virtual int SetItemData(
int index, LPARAM itemData);
126 int GetItemHeight(
int index)
const;
127 int SetItemHeight(
int index,
int height);
129 int InitStorage(
int numItemsToAdd,
uint32 memoryToAllocate);
146 void CleanupWindow();
201 void AddString(LPCTSTR str,
bool isSelected =
false);
203 void AddStringItem(LPCTSTR str, LPARAM itemData,
bool isSelected =
false);
207 void Select(
int index);
208 void SelectString(LPCTSTR str);
210 int GetSelCount()
const;
211 void ResetSelections();
212 int GetSelStringLength()
const;
213 void GetSelString(LPTSTR buffer,
int bufferSize)
const;
319 return static_cast<bool>(
SendMessage(CB_SETEXTENDEDUI, extended));
349 return static_cast<int>(
SendMessage(CB_SETDROPPEDWIDTH, width, 0));
378 return static_cast<int>(
SendMessage(CB_DELETESTRING, index));
516 return static_cast<int>(
SendMessage(CB_SETTOPINDEX, index));
557 return static_cast<int>(
SendMessage(CB_SETCURSEL, index));
576 SendMessage(CB_FINDSTRINGEXACT, startIndex,
reinterpret_cast<LPARAM
>(find)));
586 return static_cast<LPARAM
>(
const_cast<TComboBox*
>(
this)->SendMessage(CB_GETITEMDATA, index));
595 return static_cast<int>(
SendMessage(CB_SETITEMDATA, index, itemData));
649 return (
int)
SendMessage(CB_INITSTORAGE, numItemsToAdd, memoryToAllocate);
688 return SelIndex == CB_ERR ? 0 : 1;
#define PRECONDITION(condition)
An interface object that represents a transfer buffer for a TComboBox.
int GetSelCount() const
Returns the number of items selected, either 0 or 1.
TComboBoxData & operator=(const TComboBoxData &tCBD)
void SelectString(const tstring &str)
void AddStringItem(const tstring &str, LPARAM itemData, bool isSelected=false)
TStringArray & GetStrings()
Returns the array of strings (the Strings data member) to transfer to or from a combo box's associate...
int GetSelIndex()
Returns the index (the SelIndex data member) of the selected item in the strings array.
tstring & GetSelection()
Returns the currently selected string (the Selection data member) to transfer to or from a combo box.
const tstring & GetSelString() const
TComboBoxData()
Constructs a TComboBoxData object, initializes Strings and ItemDatas to empty arrays,...
TLParamArray & GetItemDatas()
Returns the array of DWORDs to transfer to or from a combo box's associated list box.
void AddString(const tstring &str, bool isSelected=false)
void ResetSelections()
Resets the index of the selected item and the currently selected string.
void AddString(LPCTSTR str, bool isSelected=false)
Adds the specified string to the array of Strings.
You can use TComboBox to create a combo box or a combo box control in a parent TWindow,...
TComboBox(TWindow *parent, int id, int x, int y, int w, int h, uint32 style, uint textLimit, TModule *module=0)
Constructs a combo box object with the specified parent window (parent), control ID (Id),...
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...
int GetItemHeight(int index) const
Returns the height in pixels of the Combo box's list items.
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,...
void ShowList(bool show=true)
Shows or hides the drop down or drop down list combo box depending on the value of show.
int InitStorage(int numItemsToAdd, uint32 memoryToAllocate)
Allocates memory for storing combo box items.
virtual void SetHorizontalExtent(int horzExtent)
Set the width, in pixels, by which a list box can be scrolled horizontally (the scrollable width).
int SetItemHeight(int index, int height)
Sets the height of the list items or the edit control portion in a combo box.
void Clear()
Clear the text.
auto GetButtonRect() const -> TRect
virtual void ClearList()
Clear all the entries in list part of the associated combobox.
auto GetButtonState() const -> uint
auto GetInfo() const -> COMBOBOXINFO
Returns a COMBOBOXINFO struct containing information about the combobox.
int SetExtendedUI(bool Extended)
Specifies whether the combo box uses the extended user interface or the default user interface.
virtual int GetTopIndex() const
Returns the zero-based index of the first visible item in the list box portion of a combo box.
int SetEditSel(int startPos, int endPos)
Selects characters that are between startPos and endPos in the edit control of the combo box.
auto GetEditRect() const -> TRect
virtual int SetTopIndex(int index)
The system scrolls the list box contents so that either the string specified by index appears at the ...
uint GetDroppedWidth() const
Returns the minimum allowable width, in pixels, of the list box of a combo box with the CBS_DROPDOWN ...
auto GetListHandle() const -> THandle
virtual int DeleteString(int index)
Deletes the string at the passed index in the associated list part of a combo box.
bool GetExtendedUI() const
Determines if the combo box has the extended user interface, which differs from the default user inte...
int GetTextLen() const
Returns the text length (excluding the terminating zero) of the edit control or static portion of the...
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...
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...
virtual int SetSelStringExact(LPCTSTR find, int startIndex=-1)
DLN added.
void SetText(const tstring &str)
void HideList()
Hides the drop down list of a drop down or drop down list combo box.
uint GetTextLimit()
Return the limit of new characters that can be entered into the edit control portion of the combobox.
int SetDroppedWidth(uint width)
Sets the maximum allowable width, in pixels, of the list box of a combo box with the CBS_DROPDOWN or ...
virtual int AddString(LPCTSTR str)
Adds a string to an associated list part of a combo box.
virtual int SetItemData(int index, LPARAM itemData)
Sets the 32-bit value associated with the TComboBox's item.
bool GetDroppedState() const
For drop down combo boxes, determines if a list box is visible.
auto GetEditHandle() const -> THandle
virtual int GetCount() const
Return the number of entries in list part of the associated combobox.
virtual int GetHorizontalExtent() const
Retrieves from a combo box the width, in pixels, by which the list box can be scrolled horizontally (...
virtual int GetSelIndex() const
Returns the index of the list selection or a negative value if none exists.
virtual int SetSelIndex(int index)
Selects a string of characters in a combo box.
virtual LPARAM GetItemData(int index) const
Returns the 32-bit value associated with the combo box's item.
void Transfer(TComboBoxData &data, TTransferDirection direction)
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...
virtual int DirectoryList(uint attrs, LPCTSTR fileSpec)
Fills the combo box with file names from a specified directory.
virtual int GetStringLen(int index) const
Return the length of the string at the passed index in the associated combo list excluding the termin...
void SetText(LPCTSTR str)
Selects the first string in the associated list box that begins with the supplied str.
virtual int DirectoryList(uint attrs, LPCTSTR fileSpec)
Adds a list of file names to a list box.
virtual int AddString(LPCTSTR str)
Adds str to the list box, returning its position in the list (0 is the first position).
virtual int FindString(LPCTSTR str, int startIndex=-1) const
Returns the index of the first string in the associated listbox which begins with the passed string.
virtual int InsertString(LPCTSTR str, int index)
Inserts str in the list box at the position supplied in index, and returns the item's actual position...
TListBox(TWindow *parent, int id, int x, int y, int w, int h, TModule *module=0)
Constructs a list box object with the supplied parent window (parent) library ID (module),...
virtual int SetSelStringExact(LPCTSTR str, int startIndex=-1)
Selects the item that matches the given string exactly.
virtual int FindStringExact(LPCTSTR str, int startIndex=-1) const
Return the index of the first string in the list part which is exactly same as the passed string.
virtual int GetString(TCHAR *str, int index) const
Retrieves the contents of the string at the passed index of the associated listbox.
virtual int SetSelString(LPCTSTR str, int startIndex=-1)
For single-selection list boxes.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TRect is a mathematical class derived from tagRect.
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
int GetWindowText(TCHAR *str, int maxCount) const
Copies the window's title into a buffer pointed to by string.
TResult SendMessage(TMsgId, TParam1=0, TParam2=0) const
Sends a message (msg) to a specified window or windows.
HWND THandle
TWindow encapsulates an HWND.
HWND GetHandle() const
Returns the handle of the window.
int GetWindowTextLength() const
Returns the length, in characters, of the specified window's title.
#define DECLARE_STREAMABLE_OWL(cls, ver)
#define DECLARE_STREAMABLE_INLINES(cls)
TTransferDirection
The TTransferDirection enum describes the constants that the transfer function uses to determine how ...
Definition of class TListBox and TlistBoxData.
Object Windows Library (OWLNext Core).
TObjectArray< tstring > TStringArray
LPARAM TParam2
Second parameter type.
TParam2 MkParam2(const T1 &lo, const T2 &hi)
TTypedArray< LPARAM, LPARAM, TStandardAllocator > TLParamArray
#define CONST_CAST(targetType, object)