List Box Control. More...
#include <SListbox.h>
Public Member Functions | |
SListBox () | |
Constructor. | |
virtual | ~SListBox () |
Destructor. | |
int | GetCount () SCONST OVERRIDE |
Get the number of items in the list box. | |
int | GetCurSel () SCONST OVERRIDE |
Get the index of the currently selected item. | |
BOOL | SetCurSel (int nIndex, BOOL bNotifyChange=FALSE) OVERRIDE |
Set the currently selected item. | |
int | GetTopIndex () SCONST OVERRIDE |
Get the index of the top visible item. | |
BOOL | SetTopIndex (int nIndex) OVERRIDE |
Set the index of the top visible item. | |
int | GetItemHeight () SCONST OVERRIDE |
Get the height of the items. | |
void | SetItemHeight (int nItemHeight) OVERRIDE |
Set the height of the items. | |
LPARAM | GetItemData (int nIndex) SCONST OVERRIDE |
Get the data associated with an item. | |
BOOL | SetItemData (int nIndex, LPARAM lParam) OVERRIDE |
Set the data associated with an item. | |
BOOL | GetIText (int nIndex, BOOL bRawText, IStringT *str) SCONST OVERRIDE |
Get the text of an item. | |
void | DeleteAll () OVERRIDE |
Delete all items in the list box. | |
BOOL | DeleteString (int nIndex) OVERRIDE |
Delete a specific item. | |
int | AddString (LPCTSTR lpszItem, int nImage=-1, LPARAM lParam=0) OVERRIDE |
Add a string to the list box. | |
int | InsertString (int nIndex, LPCTSTR lpszItem, int nImage=-1, LPARAM lParam=0) OVERRIDE |
Insert a string into the list box. | |
void | EnsureVisible (int nIndex) OVERRIDE |
Ensure an item is visible. | |
int | FindString (int iFindAfter, LPCTSTR pszText) SCONST OVERRIDE |
Find a string in the list box. | |
void | GetDesiredSize (SIZE *psz, int nParentWid, int nParentHei) OVERRIDE |
Get the desired size of the control. | |
BOOL | SetItemImage (int nIndex, int iImage) OVERRIDE |
Set the image of an item. | |
int | GetItemImage (int nIndex) OVERRIDE |
Get the image of an item. | |
SStringT | GetText (int nIndex, BOOL bRawText=FALSE) const |
Get the text of an item. | |
virtual HRESULT | SetAttribute (const SNS::SStringW &amp;amp;amp;strAttribName, const SNS::SStringW &amp;amp;amp;strValue, BOOL bLoading=FALSE) |
Protected Member Functions | |
void | RedrawItem (int iItem) |
Redraw a specific item. | |
int | HitTest (CPoint &pt) |
Hit test to determine the item under the mouse. | |
void | UpdateScrollBar () |
Update the scroll bar. | |
virtual HRESULT | OnLanguageChanged () |
Handle language change event. | |
void | OnScaleChanged (int nScale) override |
Handle scale change event. | |
virtual BOOL | CreateChildren (SXmlNode xmlNode) |
Create child items from XML configuration. | |
void | LoadItemAttribute (SXmlNode xmlNode, LPLBITEM pItem) |
Load attributes for an item from XML. | |
int | InsertItem (int nIndex, LPLBITEM pItem) |
Insert a new item. | |
virtual void | DrawItem (IRenderTarget *pRT, CRect &rc, int iItem) |
Draw an item. | |
void | NotifySelChange (int nOldSel, int nNewSel) |
Notify of selection change. | |
virtual UINT WINAPI | OnGetDlgCode () const |
Get the dialog code. | |
void | OnSize (UINT nType, CSize size) |
Handle size change event. | |
void | OnPaint (IRenderTarget *pRT) |
Paint the control. | |
void | OnLButtonDown (UINT nFlags, CPoint pt) |
Handle left mouse button down event. | |
void | OnLButtonDbClick (UINT nFlags, CPoint pt) |
Handle left mouse button double-click event. | |
void | OnLButtonUp (UINT nFlags, CPoint pt) |
Handle left mouse button up event. | |
void | OnMouseMove (UINT nFlags, CPoint pt) |
Handle mouse move event. | |
void | OnKeyDown (TCHAR nChar, UINT nRepCnt, UINT nFlags) |
Handle key down event. | |
void | OnChar (UINT nChar, UINT nRepCnt, UINT nFlags) |
Handle character input event. | |
void | OnDestroy () |
Handle destroy event. | |
void | OnShowWindow (BOOL bShow, UINT nStatus) |
Handle show window event. | |
void | OnMouseLeave () |
Handle mouse leave event. | |
Protected Attributes | |
SArray< LPLBITEM > | m_arrItems |
SLayoutSize | m_itemHeight |
int | m_iSelItem |
int | m_iHoverItem |
int | m_iScrollSpeed |
BOOL | m_bHotTrack |
SLayoutSize | m_ptIcon [2] |
SLayoutSize | m_ptText [2] |
COLORREF | m_crItemBg |
COLORREF | m_crItemBg2 |
COLORREF | m_crItemSelBg |
COLORREF | m_crItemHotBg |
COLORREF | m_crText |
COLORREF | m_crSelText |
SAutoRefPtr< ISkinObj > | m_pItemSkin |
SAutoRefPtr< ISkinObj > | m_pIconSkin |
List Box Control.
A control that displays a list of items from which the user can select one or more.
Definition at line 38 of file SListbox.h.
SNSBEGIN SListBox::SListBox | ( | ) |
Constructor.
Definition at line 15 of file SListbox.cpp.
|
virtual |
Destructor.
Definition at line 38 of file SListbox.cpp.
int SListBox::AddString | ( | LPCTSTR | lpszItem, |
int | nImage = -1, | ||
LPARAM | lParam = 0 ) |
Add a string to the list box.
lpszItem | Text of the item |
nImage | Icon index |
lParam | Additional parameter |
Definition at line 187 of file SListbox.cpp.
|
protectedvirtual |
Create child items from XML configuration.
xmlNode | XML node for the child items |
Reimplemented from SWindow.
Definition at line 264 of file SListbox.cpp.
void SListBox::DeleteAll | ( | ) |
Delete all items in the list box.
Definition at line 148 of file SListbox.cpp.
BOOL SListBox::DeleteString | ( | int | nIndex | ) |
Delete a specific item.
nIndex | Index of the item to delete |
Definition at line 164 of file SListbox.cpp.
|
protectedvirtual |
Draw an item.
pRT | Rendering target handle |
rc | Rectangle for the item |
iItem | Index of the item |
Definition at line 339 of file SListbox.cpp.
void SListBox::EnsureVisible | ( | int | nIndex | ) |
Ensure an item is visible.
nIndex | Index of the item to ensure visible |
Definition at line 204 of file SListbox.cpp.
int SListBox::FindString | ( | int | iFindAfter, |
LPCTSTR | pszText ) |
Find a string in the list box.
iFindAfter | Index after which to start searching |
pszText | String to find |
Definition at line 250 of file SListbox.cpp.
int SListBox::GetCount | ( | ) |
Get the number of items in the list box.
Definition at line 42 of file SListbox.cpp.
int SListBox::GetCurSel | ( | ) |
Get the index of the currently selected item.
Definition at line 47 of file SListbox.cpp.
void SListBox::GetDesiredSize | ( | SIZE * | psz, |
int | nParentWid, | ||
int | nParentHei ) |
Get the desired size of the control.
psz | Output size |
nParentWid | Parent container width |
nParentHei | Parent container height |
Definition at line 644 of file SListbox.cpp.
LPARAM SListBox::GetItemData | ( | int | nIndex | ) |
Get the data associated with an item.
nIndex | Index of the item |
Definition at line 93 of file SListbox.cpp.
int SListBox::GetItemHeight | ( | ) |
Get the height of the items.
Definition at line 137 of file SListbox.cpp.
int SListBox::GetItemImage | ( | int | nIndex | ) |
Get the image of an item.
nIndex | Index of the item |
Definition at line 119 of file SListbox.cpp.
BOOL SListBox::GetIText | ( | int | nIndex, |
BOOL | bRawText, | ||
IStringT * | str ) |
Get the text of an item.
nIndex | Index of the item |
bRawText | Whether to get raw text |
str | Output string for the item text |
Definition at line 127 of file SListbox.cpp.
|
inline |
Get the text of an item.
nIndex | Index of the item |
bRawText | Whether to get raw text |
Definition at line 198 of file SListbox.h.
int SListBox::GetTopIndex | ( | ) |
Get the index of the top visible item.
Definition at line 79 of file SListbox.cpp.
|
protected |
Hit test to determine the item under the mouse.
pt | Mouse coordinates |
Definition at line 228 of file SListbox.cpp.
|
protected |
Insert a new item.
nIndex | Index at which to insert the item |
pItem | Pointer to the item structure |
Definition at line 298 of file SListbox.cpp.
int SListBox::InsertString | ( | int | nIndex, |
LPCTSTR | lpszItem, | ||
int | nImage = -1, | ||
LPARAM | lParam = 0 ) |
Insert a string into the list box.
nIndex | Index at which to insert the item |
lpszItem | Text of the item |
nImage | Icon index |
lParam | Additional parameter |
Definition at line 192 of file SListbox.cpp.
Load attributes for an item from XML.
xmlNode | XML node for the item |
pItem | Pointer to the item structure |
Definition at line 288 of file SListbox.cpp.
|
protected |
Notify of selection change.
nOldSel | Old selected index |
nNewSel | New selected index |
Definition at line 427 of file SListbox.cpp.
|
protected |
Handle character input event.
nChar | Character code |
nRepCnt | Repeat count |
nFlags | Flags |
Definition at line 551 of file SListbox.cpp.
|
protected |
Handle destroy event.
Definition at line 563 of file SListbox.cpp.
|
protectedvirtual |
|
protected |
Handle key down event.
nChar | Key code |
nRepCnt | Repeat count |
nFlags | Flags |
Definition at line 528 of file SListbox.cpp.
|
protectedvirtual |
Handle language change event.
Reimplemented from SWindow.
Definition at line 589 of file SListbox.cpp.
|
protected |
Handle left mouse button double-click event.
nFlags | Flags |
pt | Mouse coordinates |
Definition at line 500 of file SListbox.cpp.
|
protected |
Handle left mouse button down event.
nFlags | Flags |
pt | Mouse coordinates |
Definition at line 477 of file SListbox.cpp.
|
protected |
Handle left mouse button up event.
nFlags | Flags |
pt | Mouse coordinates |
Definition at line 488 of file SListbox.cpp.
|
protected |
Handle mouse leave event.
Definition at line 578 of file SListbox.cpp.
|
protected |
Handle mouse move event.
nFlags | Flags |
pt | Mouse coordinates |
Definition at line 512 of file SListbox.cpp.
|
protected |
Paint the control.
pRT | Rendering target handle |
Definition at line 451 of file SListbox.cpp.
|
overrideprotectedvirtual |
Handle scale change event.
nScale | Scale factor |
Reimplemented from SPanel.
Definition at line 600 of file SListbox.cpp.
|
protected |
Handle show window event.
bShow | Show flag |
nStatus | Status code |
Definition at line 569 of file SListbox.cpp.
|
protected |
Handle size change event.
nType | Size change type |
size | New size |
Definition at line 471 of file SListbox.cpp.
|
protected |
Redraw a specific item.
iItem | Index of the item to redraw |
Definition at line 319 of file SListbox.cpp.
|
inlinevirtual |
Reimplemented from SPanel.
Definition at line 375 of file SListbox.h.
BOOL SListBox::SetCurSel | ( | int | nIndex, |
BOOL | bNotifyChange = FALSE ) |
Set the currently selected item.
nIndex | Index of the item to select |
bNotifyChange | Whether to notify of the change |
Definition at line 52 of file SListbox.cpp.
BOOL SListBox::SetItemData | ( | int | nIndex, |
LPARAM | lParam ) |
Set the data associated with an item.
nIndex | Index of the item |
lParam | Data to associate with the item |
Definition at line 101 of file SListbox.cpp.
void SListBox::SetItemHeight | ( | int | nItemHeight | ) |
Set the height of the items.
nItemHeight | Height of the items |
Definition at line 142 of file SListbox.cpp.
BOOL SListBox::SetItemImage | ( | int | nIndex, |
int | iImage ) |
Set the image of an item.
nIndex | Index of the item |
iImage | Icon index |
Definition at line 110 of file SListbox.cpp.
BOOL SListBox::SetTopIndex | ( | int | nIndex | ) |
Set the index of the top visible item.
nIndex | Index of the top visible item |
Definition at line 84 of file SListbox.cpp.
|
protected |
Update the scroll bar.
Definition at line 607 of file SListbox.cpp.
|
protected |
Array of items
Definition at line 355 of file SListbox.h.
|
protected |
Hot tracking flag
Definition at line 361 of file SListbox.h.
|
protected |
Background color
Definition at line 366 of file SListbox.h.
|
protected |
Background color for even rows
Definition at line 367 of file SListbox.h.
|
protected |
Hot item background color
Definition at line 369 of file SListbox.h.
|
protected |
Selected item background color
Definition at line 368 of file SListbox.h.
|
protected |
Selected text color
Definition at line 371 of file SListbox.h.
|
protected |
Text color
Definition at line 370 of file SListbox.h.
|
protected |
Index of the item under the mouse
Definition at line 359 of file SListbox.h.
|
protected |
Scroll speed
Definition at line 360 of file SListbox.h.
|
protected |
Index of the selected item
Definition at line 358 of file SListbox.h.
|
protected |
Height of the items
Definition at line 357 of file SListbox.h.
|
protected |
Definition at line 372 of file SListbox.h.
|
protected |
Definition at line 372 of file SListbox.h.
|
protected |
Icon coordinates
Definition at line 363 of file SListbox.h.
|
protected |
Text coordinates
Definition at line 364 of file SListbox.h.