24#define MULTIPLESEL (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)
60 return SelIndices->
Size();
98 if (index !=
LB_ERR && SelIndices->
Find(index) == SelIndices->
NPOS)
99 SelIndices->
Add(index);
123 static_cast<int>((*Strings)[(*SelIndices)[index]].length()) :
152 str = (*Strings)[(*SelIndices)[index]];
177 int x,
int y,
int w,
int h,
244 for (
i = 0;
i < count;
i++) {
301 if (
listBoxData->GetSelIndices()[
j] ==
static_cast<int>(
i)) {
460 for (
int i = 0;
i !=
static_cast<int>(
selections.size()); ++
i)
575 CHECK(
n ==
static_cast<int>(buf.size()));
576 for (
int i = 0;
i !=
n; ++
i)
679struct TListBoxGetString
717#if OWL_PERSISTENT_STREAMS
733TListBox::Streamer::Write(opstream&
os)
const
#define PRECONDITION(condition)
TControl unifies its derived control classes, such as TScrollBar, TControlGadget, and TButton.
Used to transfer the contents of a list box.
void AddString(LPCTSTR str, bool isSelected=false)
Adds the specified string to Strings.
void Clear()
Resets the list box by flushing the ItemDatas and Strings arrays and calling ResetSelections.
~TListBoxData()
Deletes the space allocated for Strings and SelStrings.
TListBoxData()
Constructs Strings and SelStrings. Initializes SelCount to 0.
int GetSelCount() const
Returns the number of items in SelIndices.
void AddStringItem(LPCTSTR str, LPARAM itemData, bool isSelected=false)
Adds a string to the Strings array, optionally selects it, and adds itemData to the ItemDatas array.
int GetSelStringLength(int index=0) const
Returns the length (excluding the terminating NULL) of the string at the specified index in SelIndice...
void SelectString(LPCTSTR str)
Adds the index of the string matching str to SelIndices.
void Select(int index)
Selects the string at the given index.
void GetSelString(TCHAR *buffer, int bufferSize, int index=0) const
Locates the string at the specified index in SelIndices and copies it into buffer.
void ResetSelections()
Flushes SelIndices.
An interface object that represents a corresponding list box element.
virtual int SetItemData(int index, LPARAM itemData)
Sets the custom value associated with the list box item at the specified index position.
virtual int ReplaceString(LPCTSTR str, int index)
Replaces the item in the list at the position supplied in index, and returns that item's actual posit...
virtual LPARAM GetItemData(int index) const
Returns the custom value associated with the item at index set by SetItemData.
tstring GetSelString() const
String-aware overload.
virtual int SetSelIndex(int index)
For single-selection list boxes.
virtual int AddString(LPCTSTR str)
Adds str to the list box, returning its position in the list (0 is the first position).
virtual int GetStringLen(int index) const
Returns the string length (excluding the terminating NULL) of the item at the position index supplied...
void Transfer(TListBoxData &data, TTransferDirection direction)
int SetSelIndexes(int *indexes, int numSelections, bool shouldSet)
For multiple-selection list boxes.
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...
virtual int GetCount() const
Returns the number of items in the list box, or a negative value if an error occurs.
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 DeleteString(int index)
Deletes the item in the list at the position (starting at 0) supplied in index.
bool IsSelected(int index) const
Returns true if the index is selected.
TIntArray GetSelIndexes() const
Container-aware overload.
virtual auto GetWindowClassName() -> TWindowClassName
Returns the name of TListBox's registration class, "LISTBOX".
int GetSelCount() const
Returns the number of selected items in the single- or multiple-selection list box or combo box.
virtual void ClearList()
Clears all the entries in the associated listbox.
int SetSel(int index, bool select)
For multiple-selection list boxes.
bool SetSelected(int index, bool selected=true)
Sets the selection state for the item at the specified index, and returns true if successful.
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.
TStringArray GetSelStrings() const
Container-aware overload.
int SetSelStrings(LPCTSTR *prefixes, int numSelections, bool shouldSet)
For multiple-selection list boxes, selects the strings in the associated list box that begin with the...
virtual int GetSelIndex() const
For single-selection list boxes.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
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...
uint32 GetStyle() const
Gets the style bits of the underlying window or the 'Style' member of the attribute structure associa...
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.
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
void ReadBaseObject(Base *base, ipstream &in)
#define IMPLEMENT_STREAMABLE1(cls, base1)
void WriteBaseObject(Base *base, opstream &out)
TTransferDirection
The TTransferDirection enum describes the constants that the transfer function uses to determine how ...
@ tdSizeData
Return the size of data transferred by the class.
@ tdSetData
Set data from the buffer into the window.
@ tdGetData
Get data from the window into the buffer.
Definition of class TListBox and TlistBoxData.
Object Windows Library (OWLNext Core)
TTypedArray< int, int, TStandardAllocator > TIntArray
TObjectArray< tstring > TStringArray
LPARAM TParam2
Second parameter type.
tstring CopyText(int size, TGetText get_text)
Copies text from a C-string (null-terminated character array) into a string object,...
WPARAM TParam1
First parameter type.
TTypedArray< LPARAM, LPARAM, TStandardAllocator > TLParamArray
#define CONST_CAST(targetType, object)