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

📄 wg_scrollbar.h

📁 一个小巧的嵌入式图形系统wGUI, 可以用VC编译
💻 H
字号:
// wg_scrollbar.h//// CScrollBar 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_SCROLLBAR_H_#define _WG_SCROLLBAR_H_#include "wg_window.h"#include "wg_painter.h"#include "wg_button.h"namespace wGui{//! A scroll barclass CScrollBar : public CWindow{public:	//! The types of scrollbars possible	enum EScrollBarType	{		VERTICAL,  //!< A standard vertical scrollbar		HORIZONTAL  //!< A standard horizontal scrollbar	};	//! Constructs a scroll bar, initilizes the limits to 0, and 100 with the position at 0  	//! \param WindowRect A CRect that defines the outer limits of the control	//! \param pParent A pointer to the parent window	//! \param ScrollBarType Indicates if this is to be a vertical or horizontal scrollbar	CScrollBar(const CRect& WindowRect, CWindow* pParent, EScrollBarType ScrollBarType);	//! Standard destructor	virtual ~CScrollBar(void);	//! Set the limits of the scroll bar	void SetLimits(int Min, int Max);	//! \return The minimum limit of the scroll bar	int GetMinLimit(void) { return m_iMin; }	//! \return The maximum limit of the scroll bar	int GetMaxLimit(void) { return m_iMax; }	//! Set the current thumb position	void SetPosition(int iPosition);	//! \return The current progress value	int GetPosition(void) { return m_iPosition; }	// CWindow overrides	//! Draws the scroll bar	virtual void Draw(void) const;	//! Giving a control a new WindowRect will move and resize the control	//! \param WindowRect A CRect that defines the outer limits of the control	virtual void SetWindowRect(const CRect& WindowRect);	//! Move the window and any child windows	//! \param MoveDistance The relative distance to move the window	virtual void MoveWindow(const CPoint& MoveDistance);	//! This is called whenever the scrollbar 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 scrollbar	virtual bool OnMouseButtonDown(CPoint Point, unsigned int Button);	// CMessageClient overrides	//! CScrollBars handle MOUSE_BUTTONDOWN and MOUSE_BUTTONUP messages	//! \param pMessage A pointer to the message	virtual bool HandleMessage(CMessage* pMessage);private:	EScrollBarType m_ScrollBarType;  //!< The type of scroll bar	int m_iMin;  //!< The minimum value of the scroll bar	int m_iMax;  //!< The maximum value of the scroll bar	int m_iPosition;  //!< The current position of the scroll bar thumb	CPictureButton* m_pBtnUpLeft;  //!< A pointer to the Up or Left button	CPictureButton* m_pBtnDownRight;  //! A pointer to the Down or Right button	CRect m_ThumbRect;  //!< The thumb rect	bool m_bDragging;  //!< Indicates if the thumb is currently being draggedprivate:	void operator=(CScrollBar) { }  //!< The assignment operator is not allowed for CWindow derived objects};}#endif  // _WG_SCROLLBAR_H_

⌨️ 快捷键说明

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