soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SListBox Class Reference

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;amp;strAttribName, const SNS::SStringW &amp;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< LPLBITEMm_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< ISkinObjm_pItemSkin
 
SAutoRefPtr< ISkinObjm_pIconSkin
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SListBox()

SNSBEGIN SListBox::SListBox ( )

Constructor.

Definition at line 15 of file SListbox.cpp.

◆ ~SListBox()

SListBox::~SListBox ( )
virtual

Destructor.

Definition at line 38 of file SListbox.cpp.

Member Function Documentation

◆ AddString()

int SListBox::AddString ( LPCTSTR lpszItem,
int nImage = -1,
LPARAM lParam = 0 )

Add a string to the list box.

Parameters
lpszItemText of the item
nImageIcon index
lParamAdditional parameter
Returns
Index of the added item

Definition at line 187 of file SListbox.cpp.

◆ CreateChildren()

BOOL SListBox::CreateChildren ( SXmlNode xmlNode)
protectedvirtual

Create child items from XML configuration.

Parameters
xmlNodeXML node for the child items
Returns
TRUE if successful, FALSE otherwise

Reimplemented from SWindow.

Definition at line 264 of file SListbox.cpp.

◆ DeleteAll()

void SListBox::DeleteAll ( )

Delete all items in the list box.

Definition at line 148 of file SListbox.cpp.

◆ DeleteString()

BOOL SListBox::DeleteString ( int nIndex)

Delete a specific item.

Parameters
nIndexIndex of the item to delete
Returns
TRUE if successful, FALSE otherwise

Definition at line 164 of file SListbox.cpp.

◆ DrawItem()

void SListBox::DrawItem ( IRenderTarget * pRT,
CRect & rc,
int iItem )
protectedvirtual

Draw an item.

Parameters
pRTRendering target handle
rcRectangle for the item
iItemIndex of the item

Definition at line 339 of file SListbox.cpp.

◆ EnsureVisible()

void SListBox::EnsureVisible ( int nIndex)

Ensure an item is visible.

Parameters
nIndexIndex of the item to ensure visible

Definition at line 204 of file SListbox.cpp.

◆ FindString()

int SListBox::FindString ( int iFindAfter,
LPCTSTR pszText )

Find a string in the list box.

Parameters
iFindAfterIndex after which to start searching
pszTextString to find
Returns
Index of the found item or -1 if not found

Definition at line 250 of file SListbox.cpp.

◆ GetCount()

int SListBox::GetCount ( )

Get the number of items in the list box.

Returns
Number of items

Definition at line 42 of file SListbox.cpp.

◆ GetCurSel()

int SListBox::GetCurSel ( )

Get the index of the currently selected item.

Returns
Index of the selected item

Definition at line 47 of file SListbox.cpp.

◆ GetDesiredSize()

void SListBox::GetDesiredSize ( SIZE * psz,
int nParentWid,
int nParentHei )

Get the desired size of the control.

Parameters
pszOutput size
nParentWidParent container width
nParentHeiParent container height

Definition at line 644 of file SListbox.cpp.

◆ GetItemData()

LPARAM SListBox::GetItemData ( int nIndex)

Get the data associated with an item.

Parameters
nIndexIndex of the item
Returns
Data associated with the item

Definition at line 93 of file SListbox.cpp.

◆ GetItemHeight()

int SListBox::GetItemHeight ( )

Get the height of the items.

Returns
Height of the items

Definition at line 137 of file SListbox.cpp.

◆ GetItemImage()

int SListBox::GetItemImage ( int nIndex)

Get the image of an item.

Parameters
nIndexIndex of the item
Returns
Icon index

Definition at line 119 of file SListbox.cpp.

◆ GetIText()

BOOL SListBox::GetIText ( int nIndex,
BOOL bRawText,
IStringT * str )

Get the text of an item.

Parameters
nIndexIndex of the item
bRawTextWhether to get raw text
strOutput string for the item text
Returns
TRUE if successful, FALSE otherwise

Definition at line 127 of file SListbox.cpp.

◆ GetText()

SStringT SListBox::GetText ( int nIndex,
BOOL bRawText = FALSE ) const
inline

Get the text of an item.

Parameters
nIndexIndex of the item
bRawTextWhether to get raw text
Returns
Text of the item

Definition at line 198 of file SListbox.h.

◆ GetTopIndex()

int SListBox::GetTopIndex ( )

Get the index of the top visible item.

Returns
Index of the top visible item

Definition at line 79 of file SListbox.cpp.

◆ HitTest()

int SListBox::HitTest ( CPoint & pt)
protected

Hit test to determine the item under the mouse.

Parameters
ptMouse coordinates
Returns
Index of the item or -1 if no item

Definition at line 228 of file SListbox.cpp.

◆ InsertItem()

int SListBox::InsertItem ( int nIndex,
LPLBITEM pItem )
protected

Insert a new item.

Parameters
nIndexIndex at which to insert the item
pItemPointer to the item structure
Returns
Index of the inserted item

Definition at line 298 of file SListbox.cpp.

◆ InsertString()

int SListBox::InsertString ( int nIndex,
LPCTSTR lpszItem,
int nImage = -1,
LPARAM lParam = 0 )

Insert a string into the list box.

Parameters
nIndexIndex at which to insert the item
lpszItemText of the item
nImageIcon index
lParamAdditional parameter
Returns
Index of the inserted item

Definition at line 192 of file SListbox.cpp.

◆ LoadItemAttribute()

void SListBox::LoadItemAttribute ( SXmlNode xmlNode,
LPLBITEM pItem )
protected

Load attributes for an item from XML.

Parameters
xmlNodeXML node for the item
pItemPointer to the item structure

Definition at line 288 of file SListbox.cpp.

◆ NotifySelChange()

void SListBox::NotifySelChange ( int nOldSel,
int nNewSel )
protected

Notify of selection change.

Parameters
nOldSelOld selected index
nNewSelNew selected index

Definition at line 427 of file SListbox.cpp.

◆ OnChar()

void SListBox::OnChar ( UINT nChar,
UINT nRepCnt,
UINT nFlags )
protected

Handle character input event.

Parameters
nCharCharacter code
nRepCntRepeat count
nFlagsFlags

Definition at line 551 of file SListbox.cpp.

◆ OnDestroy()

void SListBox::OnDestroy ( )
protected

Handle destroy event.

Definition at line 563 of file SListbox.cpp.

◆ OnGetDlgCode()

UINT SListBox::OnGetDlgCode ( ) const
protectedvirtual

Get the dialog code.

Returns
Dialog code

Definition at line 558 of file SListbox.cpp.

◆ OnKeyDown()

void SListBox::OnKeyDown ( TCHAR nChar,
UINT nRepCnt,
UINT nFlags )
protected

Handle key down event.

Parameters
nCharKey code
nRepCntRepeat count
nFlagsFlags

Definition at line 528 of file SListbox.cpp.

◆ OnLanguageChanged()

HRESULT SListBox::OnLanguageChanged ( )
protectedvirtual

Handle language change event.

Returns
HRESULT

Reimplemented from SWindow.

Definition at line 589 of file SListbox.cpp.

◆ OnLButtonDbClick()

void SListBox::OnLButtonDbClick ( UINT nFlags,
CPoint pt )
protected

Handle left mouse button double-click event.

Parameters
nFlagsFlags
ptMouse coordinates

Definition at line 500 of file SListbox.cpp.

◆ OnLButtonDown()

void SListBox::OnLButtonDown ( UINT nFlags,
CPoint pt )
protected

Handle left mouse button down event.

Parameters
nFlagsFlags
ptMouse coordinates

Definition at line 477 of file SListbox.cpp.

◆ OnLButtonUp()

void SListBox::OnLButtonUp ( UINT nFlags,
CPoint pt )
protected

Handle left mouse button up event.

Parameters
nFlagsFlags
ptMouse coordinates

Definition at line 488 of file SListbox.cpp.

◆ OnMouseLeave()

void SListBox::OnMouseLeave ( )
protected

Handle mouse leave event.

Definition at line 578 of file SListbox.cpp.

◆ OnMouseMove()

void SListBox::OnMouseMove ( UINT nFlags,
CPoint pt )
protected

Handle mouse move event.

Parameters
nFlagsFlags
ptMouse coordinates

Definition at line 512 of file SListbox.cpp.

◆ OnPaint()

void SListBox::OnPaint ( IRenderTarget * pRT)
protected

Paint the control.

Parameters
pRTRendering target handle

Definition at line 451 of file SListbox.cpp.

◆ OnScaleChanged()

void SListBox::OnScaleChanged ( int nScale)
overrideprotectedvirtual

Handle scale change event.

Parameters
nScaleScale factor

Reimplemented from SPanel.

Definition at line 600 of file SListbox.cpp.

◆ OnShowWindow()

void SListBox::OnShowWindow ( BOOL bShow,
UINT nStatus )
protected

Handle show window event.

Parameters
bShowShow flag
nStatusStatus code

Definition at line 569 of file SListbox.cpp.

◆ OnSize()

void SListBox::OnSize ( UINT nType,
CSize size )
protected

Handle size change event.

Parameters
nTypeSize change type
sizeNew size

Definition at line 471 of file SListbox.cpp.

◆ RedrawItem()

void SListBox::RedrawItem ( int iItem)
protected

Redraw a specific item.

Parameters
iItemIndex of the item to redraw

Definition at line 319 of file SListbox.cpp.

◆ SetAttribute()

virtual HRESULT SListBox::SetAttribute ( const SNS::SStringW &amp;amp;amp;amp; strAttribName,
const SNS::SStringW &amp;amp;amp;amp; strValue,
BOOL bLoading = FALSE )
inlinevirtual

Reimplemented from SPanel.

Definition at line 375 of file SListbox.h.

◆ SetCurSel()

BOOL SListBox::SetCurSel ( int nIndex,
BOOL bNotifyChange = FALSE )

Set the currently selected item.

Parameters
nIndexIndex of the item to select
bNotifyChangeWhether to notify of the change
Returns
TRUE if successful, FALSE otherwise

Definition at line 52 of file SListbox.cpp.

◆ SetItemData()

BOOL SListBox::SetItemData ( int nIndex,
LPARAM lParam )

Set the data associated with an item.

Parameters
nIndexIndex of the item
lParamData to associate with the item
Returns
TRUE if successful, FALSE otherwise

Definition at line 101 of file SListbox.cpp.

◆ SetItemHeight()

void SListBox::SetItemHeight ( int nItemHeight)

Set the height of the items.

Parameters
nItemHeightHeight of the items

Definition at line 142 of file SListbox.cpp.

◆ SetItemImage()

BOOL SListBox::SetItemImage ( int nIndex,
int iImage )

Set the image of an item.

Parameters
nIndexIndex of the item
iImageIcon index
Returns
TRUE if successful, FALSE otherwise

Definition at line 110 of file SListbox.cpp.

◆ SetTopIndex()

BOOL SListBox::SetTopIndex ( int nIndex)

Set the index of the top visible item.

Parameters
nIndexIndex of the top visible item
Returns
TRUE if successful, FALSE otherwise

Definition at line 84 of file SListbox.cpp.

◆ UpdateScrollBar()

void SListBox::UpdateScrollBar ( )
protected

Update the scroll bar.

Definition at line 607 of file SListbox.cpp.

Member Data Documentation

◆ m_arrItems

SArray<LPLBITEM> SListBox::m_arrItems
protected

Array of items

Definition at line 355 of file SListbox.h.

◆ m_bHotTrack

BOOL SListBox::m_bHotTrack
protected

Hot tracking flag

Definition at line 361 of file SListbox.h.

◆ m_crItemBg

COLORREF SListBox::m_crItemBg
protected

Background color

Definition at line 366 of file SListbox.h.

◆ m_crItemBg2

COLORREF SListBox::m_crItemBg2
protected

Background color for even rows

Definition at line 367 of file SListbox.h.

◆ m_crItemHotBg

COLORREF SListBox::m_crItemHotBg
protected

Hot item background color

Definition at line 369 of file SListbox.h.

◆ m_crItemSelBg

COLORREF SListBox::m_crItemSelBg
protected

Selected item background color

Definition at line 368 of file SListbox.h.

◆ m_crSelText

COLORREF SListBox::m_crSelText
protected

Selected text color

Definition at line 371 of file SListbox.h.

◆ m_crText

COLORREF SListBox::m_crText
protected

Text color

Definition at line 370 of file SListbox.h.

◆ m_iHoverItem

int SListBox::m_iHoverItem
protected

Index of the item under the mouse

Definition at line 359 of file SListbox.h.

◆ m_iScrollSpeed

int SListBox::m_iScrollSpeed
protected

Scroll speed

Definition at line 360 of file SListbox.h.

◆ m_iSelItem

int SListBox::m_iSelItem
protected

Index of the selected item

Definition at line 358 of file SListbox.h.

◆ m_itemHeight

SLayoutSize SListBox::m_itemHeight
protected

Height of the items

Definition at line 357 of file SListbox.h.

◆ m_pIconSkin

SAutoRefPtr<ISkinObj> SListBox::m_pIconSkin
protected

Definition at line 372 of file SListbox.h.

◆ m_pItemSkin

SAutoRefPtr<ISkinObj> SListBox::m_pItemSkin
protected

Definition at line 372 of file SListbox.h.

◆ m_ptIcon

SLayoutSize SListBox::m_ptIcon[2]
protected

Icon coordinates

Definition at line 363 of file SListbox.h.

◆ m_ptText

SLayoutSize SListBox::m_ptText[2]
protected

Text coordinates

Definition at line 364 of file SListbox.h.


The documentation for this class was generated from the following files: