⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wg__listbox_8h-source.html

📁 一个小巧的嵌入式图形系统wGUI, 可以用VC编译
💻 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>wg_listbox.h Source File</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> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Data Structures</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Data Fields</a> &nbsp; </center><hr><h1>wg_listbox.h</h1><div class="fragment"><pre>00001 <span class="comment">// wg_listbox.h</span>00002 <span class="comment">//</span>00003 <span class="comment">// CListBox interface</span>00004 <span class="comment">//</span>00005 <span class="comment">//</span>00006 <span class="comment">// Copyright (c) 2002 Rob Wiskow</span>00007 <span class="comment">// rob-dev@boxedchaos.com</span>00008 <span class="comment">//</span>00009 <span class="comment">// This library is free software; you can redistribute it and/or</span>00010 <span class="comment">// modify it under the terms of the GNU Lesser General Public</span>00011 <span class="comment">// License as published by the Free Software Foundation; either</span>00012 <span class="comment">// version 2.1 of the License, or (at your option) any later version.</span>00013 <span class="comment">//</span>00014 <span class="comment">// This library is distributed in the hope that it will be useful,</span>00015 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>00016 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>00017 <span class="comment">// Lesser General Public License for more details.</span>00018 <span class="comment">//</span>00019 <span class="comment">// You should have received a copy of the GNU Lesser General Public</span>00020 <span class="comment">// License along with this library; if not, write to the Free Software</span>00021 <span class="comment">// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>00022 <span class="comment">//</span>00023 00024 00025 <span class="preprocessor">#ifndef _WG_LISTBOX_H_</span>00026 <span class="preprocessor"></span><span class="preprocessor">#define _WG_LISTBOX_H_</span>00027 <span class="preprocessor"></span>00028 <span class="preprocessor">#include "wg_window.h"</span>00029 <span class="preprocessor">#include "wg_painter.h"</span>00030 <span class="preprocessor">#include "wg_renderedstring.h"</span>00031 <span class="preprocessor">#include "wg_scrollbar.h"</span>00032 <span class="preprocessor">#include &lt;vector&gt;</span>00033 00034 00035 <span class="keyword">namespace </span>wGui00036 {00037 00039 <a name="l00040"></a><a class="code" href="structwGui_1_1SListItem.html">00040</a> <span class="keyword">struct </span><a class="code" href="structwGui_1_1SListItem.html">SListItem</a>00041 {00042 <span class="keyword">public</span>:<a name="l00044"></a><a class="code" href="structwGui_1_1SListItem.html#a0">00044</a>      <a class="code" href="structwGui_1_1SListItem.html#a0">SListItem</a>(std::string sItemTextIn, <span class="keywordtype">void</span>* pItemDataIn = 0, <a class="code" href="classwGui_1_1CRGBColor.html">CRGBColor</a> ItemColorIn = DEFAULT_LINE_COLOR) :00045           <a class="code" href="structwGui_1_1SListItem.html#m0">sItemText</a>(sItemTextIn), <a class="code" href="structwGui_1_1SListItem.html#m1">pItemData</a>(pItemDataIn), <a class="code" href="structwGui_1_1SListItem.html#m2">ItemColor</a>(ItemColorIn) { }00046 <a name="l00047"></a><a class="code" href="structwGui_1_1SListItem.html#m0">00047</a>      std::string <a class="code" href="structwGui_1_1SListItem.html#m0">sItemText</a>;  <a name="l00048"></a><a class="code" href="structwGui_1_1SListItem.html#m1">00048</a>      <span class="keywordtype">void</span>* <a class="code" href="structwGui_1_1SListItem.html#m1">pItemData</a>;  <a name="l00049"></a><a class="code" href="structwGui_1_1SListItem.html#m2">00049</a>      <a class="code" href="classwGui_1_1CRGBColor.html">CRGBColor</a> <a class="code" href="structwGui_1_1SListItem.html#m2">ItemColor</a>;  00050 };00051 00052 00054 00057 <a name="l00058"></a><a class="code" href="classwGui_1_1CListBox.html">00058</a> <span class="keyword">class </span><a class="code" href="classwGui_1_1CListBox.html">CListBox</a> : <span class="keyword">public</span> <a class="code" href="classwGui_1_1CWindow.html">CWindow</a>00059 {00060 <span class="keyword">public</span>:00068      <a class="code" href="classwGui_1_1CListBox.html#a0">CListBox</a>(<span class="keyword">const</span> <a class="code" href="classwGui_1_1CRect.html">CRect</a>&amp; WindowRect, <a class="code" href="classwGui_1_1CWindow.html">CWindow</a>* pParent, <span class="keywordtype">bool</span> bSingleSelection = <span class="keyword">false</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iItemHeight = 15, <a class="code" href="classwGui_1_1CFontEngine.html">CFontEngine</a>* pFontEngine = 0);00069 00071      <span class="keyword">virtual</span> <a class="code" href="classwGui_1_1CListBox.html#a1">~CListBox</a>(<span class="keywordtype">void</span>);00072 <a name="l00074"></a><a class="code" href="classwGui_1_1CListBox.html#a2">00074</a>      <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classwGui_1_1CListBox.html#a2">GetItemHeight</a>(<span class="keywordtype">void</span>) { <span class="keywordflow">return</span> <a class="code" href="classwGui_1_1CListBox.html#n2">m_iItemHeight</a>; }00075 00077      <span class="keywordtype">void</span> <a class="code" href="classwGui_1_1CListBox.html#a3">SetItemHeight</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iItemHeight);00078 00082      <span class="keywordtype">int</span> <a class="code" href="classwGui_1_1CListBox.html#a4">AddItem</a>(SListItem ListItem);00083 <a name="l00087"></a><a class="code" href="classwGui_1_1CListBox.html#a5">00087</a>      <a class="code" href="structwGui_1_1SListItem.html">SListItem</a>&amp; <a class="code" href="classwGui_1_1CListBox.html#a5">GetItem</a>(<span class="keywordtype">int</span> iItemIndex) { <span class="keywordflow">return</span> <a class="code" href="classwGui_1_1CListBox.html#n4">m_Items</a>[iItemIndex]; }00088 00091      <span class="keywordtype">void</span> <a class="code" href="classwGui_1_1CListBox.html#a6">RemoveItem</a>(<span class="keywordtype">int</span> iItemIndex);00092 00094      <span class="keywordtype">void</span> <a class="code" href="classwGui_1_1CListBox.html#a7">ClearItems</a>(<span class="keywordtype">void</span>);00095 <a name="l00097"></a><a class="code" href="classwGui_1_1CListBox.html#a8">00097</a>      <span class="keywordtype">int</span> <a class="code" href="classwGui_1_1CListBox.html#a8">Size</a>(<span class="keywordtype">void</span>) { <span class="keywordflow">return</span> static_cast&lt;int&gt;(<a class="code" href="classwGui_1_1CListBox.html#n4">m_Items</a>.size()); }00098 <a name="l00101"></a><a class="code" href="classwGui_1_1CListBox.html#a9">00101</a>      <span class="keywordtype">bool</span> <a class="code" href="classwGui_1_1CListBox.html#a9">IsSelected</a>(<span class="keywordtype">int</span> iItemIndex) { <span class="keywordflow">return</span> <a class="code" href="classwGui_1_1CListBox.html#n5">m_SelectedItems</a>[iItemIndex]; }00102 <a name="l00106"></a><a class="code" href="classwGui_1_1CListBox.html#a10">00106</a>      <span class="keywordtype">void</span> <a class="code" href="classwGui_1_1CListBox.html#a10">SetSelection</a>(<span class="keywordtype">int</span> iItemIndex, <span class="keywordtype">bool</span> bSelected) { <a class="code" href="classwGui_1_1CListBox.html#n5">m_SelectedItems</a>[iItemIndex] = bSelected; }00107 00110      <span class="keywordtype">void</span> <a class="code" href="classwGui_1_1CListBox.html#a11">SetAllSelections</a>(<span class="keywordtype">bool</span> bSelected);00111 <a name="l00114"></a><a class="code" href="classwGui_1_1CListBox.html#a12">00114</a>      <span class="keywordtype">void</span> <a class="code" href="classwGui_1_1CListBox.html#a12">SetDropDown</a>(<a class="code" href="classwGui_1_1CWindow.html">CWindow</a>* pDropDown) { <a class="code" href="classwGui_1_1CListBox.html#n8">m_pDropDown</a> = pDropDown; }00115 00116 00117      <span class="comment">// CWindow overrides</span>00119 <span class="comment">     virtual void Draw(void) const;</span>00120 00123      <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classwGui_1_1CListBox.html#a14">SetWindowRect</a>(<span class="keyword">const</span> CRect&amp; WindowRect);00124 00130      <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classwGui_1_1CListBox.html#a15">OnMouseButtonDown</a>(CPoint Point, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Button);00131 00137      <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classwGui_1_1CListBox.html#a16">OnMouseButtonUp</a>(CPoint Point, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Button);00138 00139 00140      <span class="comment">// CMessageClient overrides</span>00143 <span class="comment">     virtual bool HandleMessage(CMessage* pMessage);</span>00144 00145 00146 <span class="keyword">protected</span>:<a name="l00147"></a><a class="code" href="classwGui_1_1CListBox.html#n0">00147</a>      <a class="code" href="classwGui_1_1CFontEngine.html">CFontEngine</a>* <a class="code" href="classwGui_1_1CListBox.html#n0">m_pFontEngine</a>;  <a name="l00148"></a><a class="code" href="classwGui_1_1CListBox.html#n1">00148</a>      <a class="code" href="classwGui_1_1CScrollBar.html">CScrollBar</a>* <a class="code" href="classwGui_1_1CListBox.html#n1">m_pVScrollbar</a>;  <a name="l00149"></a><a class="code" href="classwGui_1_1CListBox.html#n2">00149</a>      <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classwGui_1_1CListBox.html#n2">m_iItemHeight</a>;  <a name="l00150"></a><a class="code" href="classwGui_1_1CListBox.html#n3">00150</a>      <span class="keywordtype">int</span> <a class="code" href="classwGui_1_1CListBox.html#n3">m_iFocusedItem</a>;  <a name="l00151"></a><a class="code" href="classwGui_1_1CListBox.html#n4">00151</a>      std::vector&lt;SListItem&gt; <a class="code" href="classwGui_1_1CListBox.html#n4">m_Items</a>;  <a name="l00152"></a><a class="code" href="classwGui_1_1CListBox.html#n5">00152</a>      std::vector&lt;bool&gt; <a class="code" href="classwGui_1_1CListBox.html#n5">m_SelectedItems</a>;  <a name="l00153"></a><a class="code" href="classwGui_1_1CListBox.html#n6">00153</a>      std::vector&lt;CRenderedString&gt; <a class="code" href="classwGui_1_1CListBox.html#n6">m_RenderedStrings</a>;  <a name="l00154"></a><a class="code" href="classwGui_1_1CListBox.html#n7">00154</a>      <span class="keyword">const</span> <span class="keywordtype">bool</span> <a class="code" href="classwGui_1_1CListBox.html#n7">m_bSingleSelection</a>;  <a name="l00155"></a><a class="code" href="classwGui_1_1CListBox.html#n8">00155</a>      <a class="code" href="classwGui_1_1CWindow.html">CWindow</a>* <a class="code" href="classwGui_1_1CListBox.html#n8">m_pDropDown</a>;  00156 00157 00158 <span class="keyword">private</span>:00159      <span class="keywordtype">void</span> operator=(<a class="code" href="classwGui_1_1CListBox.html">CListBox</a>) { }  00160 };00161 00162 }00163 00164 <span class="preprocessor">#endif  // _WG_LISTBOX_H_</span></pre></div><hr><address style="align: right;"><small>Generated on Sat Oct 25 12:43:23 2003 for wGui by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -