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

📄 wg_dropdown.h

📁 一个小巧的嵌入式图形系统wGUI, 可以用VC编译
💻 H
字号:
// wg_dropdown.h//// CDropDown interface////// Copyright (c) 2002 Rob Wiskow// rob-dev@boxedchaos.com//// This library is free software; you can redistribute it and/or// modify it under the terms of the GNU Lesser General Public// License as published by the Free Software Foundation; either// version 2.1 of the License, or (at your option) any later version.//// This library is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU// Lesser General Public License for more details.//// You should have received a copy of the GNU Lesser General Public// License along with this library; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA//#ifndef _WG_DROPDOWN_H_#define _WG_DROPDOWN_H_#include "wg_window.h"#include "wg_painter.h"#include "wg_editbox.h"#include "wg_listbox.h"#include <memory>namespace wGui{//! A dropdown control, which combines an edit control and a listbox control//! The CDropDown will generate CTRL_VALUECHANGE messages every time the text changesclass CDropDown : public CWindow{public:	//! Construct a new DropDown control	//! \param WindowRect A CRect that defines the outer limits of the control (this only controls the dimensions of the edit control portion of the drop down)	//! \param pParent A pointer to the parent window	//! \param bAllowEdit If false, the edit box will be read only, and the value can only be changed via the drop-down list (true by default)	//! \param iItemHeight The height of the items in the listbox portion of the control, defaults to 15	//! \param pFontEngine 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 CApplication (which must be set before instantiating this object)	CDropDown(const CRect& WindowRect, CWindow* pParent, bool bAllowEdit = true, unsigned int iItemHeight = 15, CFontEngine* pFontEngine = 0);	//! Standard destructor	virtual ~CDropDown(void);	// CWindow overrides	//! Set the WindowText of the control	//! \param sWindowText The text to assign to the window	virtual void SetWindowText(std::string sWindowText);	//! Adds a new item to the list	//! \param ListItem A SListItem structure with the data for the item	//! \return The index of the added item	int AddItem(SListItem ListItem) { return m_pListBox->AddItem(ListItem); }	//! Returns the desired item	//! \param iItemIndex The index of the item to check	//! \return A reference to the SListItem struct	SListItem& GetItem(int iItemIndex) { return m_pListBox->GetItem(iItemIndex); }	//! Remove an item from the list	//! \param iItemIndex The index of the item to remove	void RemoveItem(int iItemIndex) { m_pListBox->RemoveItem(iItemIndex); }	//! Remove all items from the list	void ClearItems(void) { m_pListBox->ClearItems(); }	//! \return The number of items in the list	int Size(void) { return m_pListBox->Size(); }	//! \param iItemIndex The index of the item to check	//! \return true if the item is selected	bool IsSelected(int iItemIndex) { return m_pListBox->IsSelected(iItemIndex); }	//! Set an item as selected	//! \param iItemIndex The index of the item to change	//! \param bSelected Will select the item if true, or unselect if false	void SetSelection(int iItemIndex, bool bSelected) { m_pListBox->SetSelection(iItemIndex, bSelected); }	//! Set the selection for all of the items at once	//! \param bSelected Will select all items if true, or unselect if false	void SetAllSelections(bool bSelected) { m_pListBox->SetAllSelections(bSelected); }	// CMessageClient overrides	//! CDropDown will handle MOUSE_BUTTONDOWN messages	//! \param pMessage A pointer to the message that needs to be handled	virtual bool HandleMessage(CMessage* pMessage);protected:	//! Shows the drop down listbox	void ShowListBox(void);	//! Hides the drop down listbox	void HideListBox(void);	CEditBox* m_pEditBox;  //!< A pointer to the drop down's edit box	CListBox* m_pListBox;  //!< A pointer to teh drop down's list box	CPictureButton* m_pDropButton;  //!< A pointer to the drop down's drop button	bool m_bAllowEdit;  //!< If false, the edit box will be read only, and the value can only be changed via the drop-down listprivate:	void operator=(CDropDown) { }  //!< The assignment operator is not allowed for CWindow derived objects};}#endif // _WG_DROPDOWN_H_

⌨️ 快捷键说明

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