📄 classwgui_1_1clistbox.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>wGui::CListBox class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> </center><hr><h1>wGui::CListBox Class Reference</h1>A simple listbox class. <a href="#_details">More...</a><p><code>#include <<a class="el" href="wg__listbox_8h-source.html">wg_listbox.h</a>></code><p><p>Inheritance diagram for wGui::CListBox:<p><center><img src="classwGui_1_1CListBox.png" usemap="#wGui::CListBox_map" border="0" alt=""></center><map name="wGui::CListBox_map"><area href="classwGui_1_1CWindow.html" alt="wGui::CWindow" shape="rect" coords="0,56,138,80"><area href="classwGui_1_1CMessageClient.html" alt="wGui::CMessageClient" shape="rect" coords="0,0,138,24"></map><h2>Public Methods</h2><ul><li><a class="el" href="classwGui_1_1CListBox.html#a0">CListBox</a> (const <a class="el" href="classwGui_1_1CRect.html">CRect</a> &WindowRect, <a class="el" href="classwGui_1_1CWindow.html">CWindow</a> *pParent, bool bSingleSelection=false, unsigned int iItemHeight=15, <a class="el" href="classwGui_1_1CFontEngine.html">CFontEngine</a> *pFontEngine=0)<li><a name="a1" doxytag="wGui::CListBox::~CListBox"></a>virtual <a class="el" href="classwGui_1_1CListBox.html#a1">~CListBox</a> (void)<dl class="el"><dd><font size=-1><em>Standard destructor.<br><br></em></font></dl><li><a name="a2" doxytag="wGui::CListBox::GetItemHeight"></a>unsigned int <a class="el" href="classwGui_1_1CListBox.html#a2">GetItemHeight</a> (void)<dl class="el"><dd><font size=-1><em><dl compact><dt><b>Returns: </b></dt><dd>The height of the items in the listbox</dl><br><br></em></font></dl><li><a name="a3" doxytag="wGui::CListBox::SetItemHeight"></a>void <a class="el" href="classwGui_1_1CListBox.html#a3">SetItemHeight</a> (unsigned int iItemHeight)<dl class="el"><dd><font size=-1><em><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>iItemHeight</em> </td><td>The height of the items in the listbox</td></tr></table></dl><br><br></em></font></dl><li>int <a class="el" href="classwGui_1_1CListBox.html#a4">AddItem</a> (<a class="el" href="structwGui_1_1SListItem.html">SListItem</a> ListItem)<li><a class="el" href="structwGui_1_1SListItem.html">SListItem</a> & <a class="el" href="classwGui_1_1CListBox.html#a5">GetItem</a> (int iItemIndex)<li>void <a class="el" href="classwGui_1_1CListBox.html#a6">RemoveItem</a> (int iItemIndex)<li><a name="a7" doxytag="wGui::CListBox::ClearItems"></a>void <a class="el" href="classwGui_1_1CListBox.html#a7">ClearItems</a> (void)<dl class="el"><dd><font size=-1><em>Remove all items from the list.<br><br></em></font></dl><li><a name="a8" doxytag="wGui::CListBox::Size"></a>int <a class="el" href="classwGui_1_1CListBox.html#a8">Size</a> (void)<dl class="el"><dd><font size=-1><em><dl compact><dt><b>Returns: </b></dt><dd>The number of items in the list</dl><br><br></em></font></dl><li>bool <a class="el" href="classwGui_1_1CListBox.html#a9">IsSelected</a> (int iItemIndex)<li>void <a class="el" href="classwGui_1_1CListBox.html#a10">SetSelection</a> (int iItemIndex, bool bSelected)<li>void <a class="el" href="classwGui_1_1CListBox.html#a11">SetAllSelections</a> (bool bSelected)<li>void <a class="el" href="classwGui_1_1CListBox.html#a12">SetDropDown</a> (<a class="el" href="classwGui_1_1CWindow.html">CWindow</a> *pDropDown)<li><a name="a13" doxytag="wGui::CListBox::Draw"></a>virtual void <a class="el" href="classwGui_1_1CListBox.html#a13">Draw</a> (void) const<dl class="el"><dd><font size=-1><em>Draws the button and renders the button label.<br><br></em></font></dl><li>virtual void <a class="el" href="classwGui_1_1CListBox.html#a14">SetWindowRect</a> (const <a class="el" href="classwGui_1_1CRect.html">CRect</a> &WindowRect)<li>virtual bool <a class="el" href="classwGui_1_1CListBox.html#a15">OnMouseButtonDown</a> (<a class="el" href="classwGui_1_1CPoint.html">CPoint</a> Point, unsigned int Button)<li>virtual bool <a class="el" href="classwGui_1_1CListBox.html#a16">OnMouseButtonUp</a> (<a class="el" href="classwGui_1_1CPoint.html">CPoint</a> Point, unsigned int Button)<li>virtual bool <a class="el" href="classwGui_1_1CListBox.html#a17">HandleMessage</a> (<a class="el" href="classwGui_1_1CMessage.html">CMessage</a> *pMessage)</ul><h2>Protected Attributes</h2><ul><li><a name="n0" doxytag="wGui::CListBox::m_pFontEngine"></a><a class="el" href="classwGui_1_1CFontEngine.html">CFontEngine</a> * <a class="el" href="classwGui_1_1CListBox.html#n0">m_pFontEngine</a><dl class="el"><dd><font size=-1><em>A pointer to the font engine to use to render the text.<br><br></em></font></dl><li><a name="n1" doxytag="wGui::CListBox::m_pVScrollbar"></a><a class="el" href="classwGui_1_1CScrollBar.html">CScrollBar</a> * <a class="el" href="classwGui_1_1CListBox.html#n1">m_pVScrollbar</a><dl class="el"><dd><font size=-1><em>A pointer to the vertical scrollbar.<br><br></em></font></dl><li><a name="n2" doxytag="wGui::CListBox::m_iItemHeight"></a>unsigned int <a class="el" href="classwGui_1_1CListBox.html#n2">m_iItemHeight</a><dl class="el"><dd><font size=-1><em>The height of the items in the list.<br><br></em></font></dl><li><a name="n3" doxytag="wGui::CListBox::m_iFocusedItem"></a>int <a class="el" href="classwGui_1_1CListBox.html#n3">m_iFocusedItem</a><dl class="el"><dd><font size=-1><em>The currently focused item.<br><br></em></font></dl><li><a name="n4" doxytag="wGui::CListBox::m_Items"></a>std::vector< <a class="el" href="structwGui_1_1SListItem.html">SListItem</a> > <a class="el" href="classwGui_1_1CListBox.html#n4">m_Items</a><dl class="el"><dd><font size=-1><em>The list of items.<br><br></em></font></dl><li><a name="n5" doxytag="wGui::CListBox::m_SelectedItems"></a>std::vector< bool > <a class="el" href="classwGui_1_1CListBox.html#n5">m_SelectedItems</a><dl class="el"><dd><font size=-1><em>A vector of booleans indicating which items are selected.<br><br></em></font></dl><li><a name="n6" doxytag="wGui::CListBox::m_RenderedStrings"></a>std::vector< <a class="el" href="classwGui_1_1CRenderedString.html">CRenderedString</a> > <a class="el" href="classwGui_1_1CListBox.html#n6">m_RenderedStrings</a><dl class="el"><dd><font size=-1><em>A vector of the rendered strings.<br><br></em></font></dl><li><a name="n7" doxytag="wGui::CListBox::m_bSingleSelection"></a>const bool <a class="el" href="classwGui_1_1CListBox.html#n7">m_bSingleSelection</a><dl class="el"><dd><font size=-1><em>If true, only one item can be selected at a time.<br><br></em></font></dl><li><a name="n8" doxytag="wGui::CListBox::m_pDropDown"></a><a class="el" href="classwGui_1_1CWindow.html">CWindow</a> * <a class="el" href="classwGui_1_1CListBox.html#n8">m_pDropDown</a><dl class="el"><dd><font size=-1><em>A pointer to the dropdown control if this a part of one.<br><br></em></font></dl></ul><hr><a name="_details"></a><h2>Detailed Description</h2>A simple listbox class.<p>The button will generate CTRL_VALUECHANGE messages when a different listbox item is selected The iNewValue of the message is the index of the item that was selected <p><p>Definition at line <a class="el" href="wg__listbox_8h-source.html#l00058">58</a> of file <a class="el" href="wg__listbox_8h-source.html">wg_listbox.h</a>.<hr><h2>Constructor & Destructor Documentation</h2><a name="a0" doxytag="wGui::CListBox::CListBox"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> wGui::CListBox::CListBox </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const <a class="el" href="classwGui_1_1CRect.html">CRect</a> & </td> <td class="mdname" nowrap> <em>WindowRect</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap><a class="el" href="classwGui_1_1CWindow.html">CWindow</a> * </td> <td class="mdname" nowrap> <em>pParent</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>bool </td> <td class="mdname" nowrap> <em>bSingleSelection</em> = false, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>unsigned int </td> <td class="mdname" nowrap> <em>iItemHeight</em> = 15, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap><a class="el" href="classwGui_1_1CFontEngine.html">CFontEngine</a> * </td> <td class="mdname" nowrap> <em>pFontEngine</em> = 0</td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Constructs a new listbox <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>WindowRect</em> </td><td>A <a class="el" href="classwGui_1_1CRect.html">CRect</a> that defines the outer limits of the control </td></tr><tr><td valign=top><em>pParent</em> </td><td>A pointer to the parent window </td></tr><tr><td valign=top><em>bSingleSelection</em> </td><td>If true, only one item can be selected at a time, defaults to false </td></tr><tr><td valign=top><em>iItemHeight</em> </td><td>The height of the items in the list, defaults to 15 </td></tr><tr><td valign=top><em>pFontEngine</em> </td><td>A pointer to the font engine to use when drawing the control If this is left out (or set to 0) it will use the default font engine specified by the <a class="el" href="classwGui_1_1CApplication.html">CApplication</a> (which must be set before instantiating this object) </td></tr></table></dl><p>Definition at line <a class="el" href="wg__listbox_8cpp-source.html#l00035">35</a> of file <a class="el" href="wg__listbox_8cpp-source.html">wg_listbox.cpp</a>.<p>References <a class="el" href="wg__rect_8h-source.html#l00091">wGui::CRect::Bottom()</a>, <a class="el" href="wg__rect_8cpp-source.html#l00090">wGui::CRect::Grow()</a>, <a class="el" href="wg__rect_8h-source.html#l00130">wGui::CRect::Height()</a>, <a class="el" href="wg__window_8h-source.html#l00194">wGui::CWindow::m_BGColor</a>, <a class="el" href="wg__window_8h-source.html#l00197">wGui::CWindow::m_ClientRect</a>, <a class="el" href="wg__listbox_8h-source.html#l00147">m_pFontEngine</a>, <a class="el" href="wg__listbox_8h-source.html#l00148">m_pVScrollbar</a>, <a class="el" href="wg__window_8h-source.html#l00212">wGui::CWindow::m_sClassName</a>, <a class="el" href="wg__window_8h-source.html#l00191">wGui::CWindow::m_WindowRect</a>, <a class="el" href="wg__rect_8h-source.html#l00088">wGui::CRect::Right()</a>, <a class="el" href="wg__scrollbar_8cpp-source.html#l00085">wGui::CScrollBar::SetLimits()</a>, <a class="el" href="wg__rect_8h-source.html#l00082">wGui::CRect::Top()</a>, and <a class="el" href="wg__rect_8h-source.html#l00127">wGui::CRect::Width()</a>. </td> </tr></table><hr><h2>Member Function Documentation</h2><a name="a4" doxytag="wGui::CListBox::AddItem"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> int wGui::CListBox::AddItem </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="structwGui_1_1SListItem.html">SListItem</a> </td> <td class="mdname1" valign="top" nowrap> <em>ListItem</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Adds a new item to the list <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>ListItem</em> </td><td>A <a class="el" href="structwGui_1_1SListItem.html">SListItem</a> structure with the data for the item </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd>The index of the added item </dl><p>Definition at line <a class="el" href="wg__listbox_8cpp-source.html#l00077">77</a> of file <a class="el" href="wg__listbox_8cpp-source.html">wg_listbox.cpp</a>.<p>References <a class="el" href="wg__listbox_8h-source.html#l00151">m_Items</a>, <a class="el" href="wg__listbox_8h-source.html#l00147">m_pFontEngine</a>, <a class="el" href="wg__listbox_8h-source.html#l00148">m_pVScrollbar</a>, <a class="el" href="wg__listbox_8h-source.html#l00153">m_RenderedStrings</a>, <a class="el" href="wg__listbox_8h-source.html#l00152">m_SelectedItems</a>, <a class="el" href="wg__scrollbar_8cpp-source.html#l00085">wGui::CScrollBar::SetLimits()</a>, <a class="el" href="wg__listbox_8h-source.html#l00047">wGui::SListItem::sItemText</a>, and <a class="el" href="wg__window_8cpp-source.html#l00213">wGui::CWindow::StartDrawProc()</a>.<p>Referenced by <a class="el" href="wg__dropdown_8h-source.html#l00065">wGui::CDropDown::AddItem()</a>. </td> </tr></table><a name="a5" doxytag="wGui::CListBox::GetItem"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> <a class="el" href="structwGui_1_1SListItem.html">SListItem</a>& wGui::CListBox::GetItem </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">int </td> <td class="mdname1" valign="top" nowrap> <em>iItemIndex</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap><code> [inline]</code></td> </tr> </table> </td> </tr></table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -