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

📄 wg_editbox.h

📁 一个小巧的嵌入式图形系统wGUI, 可以用VC编译
💻 H
字号:
// wg_editbox.h//// CEditBox 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_EDITBOX_H_#define _WG_EDITBOX_H_#include "wg_window.h"#include "wg_painter.h"#include "wg_renderedstring.h"#include "wg_resources.h"#include <memory>namespace wGui{//! A simple edit box control//! The CEditBox will generate CTRL_VALUECHANGE messages every time the text changesclass CEditBox : public CWindow{public:	//! Construct a new Edit control  	//! \param WindowRect A CRect that defines the outer limits of the control	//! \param pParent A pointer to the parent window	//! \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)	CEditBox(const CRect& WindowRect, CWindow* pParent, CFontEngine* pFontEngine = 0);	//! Standard destructor	virtual ~CEditBox(void) { }	//! Set the Password mask state of the control	//! \param bUseMask  If set to true, the control will act as a password mask box	void SetUsePasswordMask(bool bUseMask) { m_bUseMask = bUseMask; }	//! \return true if the control is a password box	bool UsingPasswordMask(void) { return m_bUseMask; }	//! Set the Read-only state of the control	//! \param bReadOnly  If set to true, the control will not take any keyboard input	void SetReadOnly(bool bReadOnly);	//! \return true if the control is read-only	bool IsReadOnly(void) { return m_bReadOnly; }	//! \return The currently selected text in the edit box	std::string GetSelText(void) const;	// CWindow overrides	//! Renders the text contents of a control, and the cursor	virtual void Draw(void) const;	//! Set the WindowText of the control	//! \param sText The text to assign to the window	virtual void SetWindowText(const std::string& sText);	//! This is called whenever the editbox is clicked on by the mouse	//! Only the topmost window that bounds the point will be called by the system	//! \param Point The point where the mouse clicked	//! \param Button A bitfield indicating which button the window was clicked with	//! \return True if it's in the bounds of the editbox	virtual bool OnMouseButtonDown(CPoint Point, unsigned int Button);	// CMessageClient overrides	//! CEditBox will handle MOUSE_BUTTONDOWN and KEYBOARD_KEYDOWN messages	//! \param pMessage A pointer to the message that needs to be handled	virtual bool HandleMessage(CMessage* pMessage);protected:	//! Deletes the selected portion of the string	//! \internal	//! \param psString A pointer to the buffer	void SelDelete(std::string* psString);	CFontEngine* m_pFontEngine; //!< A pointer to the font engine to use to render the text	std::auto_ptr<CRenderedString> m_pRenderedString; //!< An autopointer to the rendered version of the string	unsigned char m_FontSize;  //!< The font size (in points)	unsigned int m_SelStart;  //!< Selection start point, in charachters	int m_SelLength;  //!< Selection length, in charachters	unsigned int m_DragStart;  //!< The position where the draw started	mutable int m_ScrollOffset;  //!< The offset of the left side of the string, used for scrolling in the edit box	bool m_bReadOnly;  //!< If true, the text of the control cannot be changed	bool m_bMouseDown; //!< Set to true when the mouse button goes down	bool m_bUseMask; //!< Set to true if you want the edit box to act as a password box and have a mask of astrisks	bool m_bLastMouseMoveInside;  //!< True if the cursor was inside the control on the last MOUSE_MOVE messageprivate:	void operator=(CEditBox) { }  //!< The assignment operator is not allowed for CWindow derived objects};}#endif // _WG_EDITBOX_H_

⌨️ 快捷键说明

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