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

📄 wg_frame.h

📁 一个小巧的嵌入式图形系统wGUI, 可以用VC编译
💻 H
字号:
// wg_frame.h//// CFrame interface// Frames are windows within a view that have their own window management controls//// 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_FRAME_H_#define _WG_FRAME_H_#include "wg_window.h"#include "wg_view.h"#include "wg_button.h"namespace wGui{//! NOTE - This class is not yet fully functional!//! Frames are windows within a view that have their own window management controls//! The CFrame class allows the user to create multiple windows within the view.  Unfortunately they're still bounded by the view//! but it's a slight workaround for the SDL limitation of only 1 SDL view per appclass CFrame : public CWindow{public:  	//! \param WindowRect A CRect that defines the outer limits of the control	//! \param pParent A pointer to the parent view	//! \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)	//! \param sTitle The window title, which will appear in the title bar of the view	//! \param bResizable If true, the window will be resizable	CFrame(const CRect& WindowRect, CView* pParent, CFontEngine* pFontEngine, std::string sTitle, bool bResizable = true);	//! Standard destructor	virtual ~CFrame(void);	//! Set the color of the title bar	//! \param TitleBarColor The new color for the title bar	void SetTitleBarColor(CRGBColor& TitleBarColor) { m_TitleBarColor = TitleBarColor; }	//! Set the color of the title bar text	//! \param TitleBarTextColor The new color for the title bar text	void SetTitleBarTextColor(CRGBColor& TitleBarTextColor) { m_TitleBarTextColor = TitleBarTextColor; }	//! Set the height of the title bar	//! \param iTitleBarHeight	void SetTitleBarHeight(int iTitleBarHeight);	//! \return true if the frame is resizable	bool IsResizable(void) { return m_bResizable; }	//! Attaches a standard menu to the frame, if the frame already has a menu, the old menu will be deleted	//! \param pMenu A pointer to the menu, the CFrame is then responsible for cleaning it up, passing in 0 will delete the current menu	void AttachMenu(CMenu* pMenu);	//! \return A pointer to the frame's menu, 0 if the view doesn't have a menu	CMenu* GetMenu(void) { return m_pMenu; }	// CWindow overrides	//! Draws the frame and renders the title 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);	//! Set the title bar text of the frame	//! \param sText The text to assign to the view	virtual void SetWindowText(const std::string& sText);	//! This is called whenever the frame 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 frame	virtual bool OnMouseButtonDown(CPoint Point, unsigned int Button);	// CMessageClient overrides	//! CFrame handles no messages at the moment	//! \param pMessage A pointer to the message	virtual bool HandleMessage(CMessage* pMessage);protected:	CPictureButton* m_pFrameCloseButton;  //!< The close button for the frame	CRGBColor m_TitleBarColor;  //!< The title bar color, defaults to blue	CRGBColor m_TitleBarTextColor;  //!< The title bar text color, defaults to the default line color	int m_iTitleBarHeight;  //!< The height of the title bar, defaults to 12	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	bool m_bResizable;  //!< Indicates if the view is resizable	CMenu* m_pMenu;  //!< A pointer to the view's menuprivate:	CRect m_TitleBarRect;  //!< A place to cache the title bar rect	bool m_bDragMode;  //!< Indicates if the window is currently being dragged	CPoint m_DragPointerStart;  //!< The location of the cursor when the drag was started	SDL_Surface* m_pSavedSurface;  //!< A pointer to a bitmap of what lies underneath the dragged frame	CRect m_SavedSurfaceRect;  //!< A rect for the saved surface	void operator=(CFrame) { }  //!< The assignment operator is not allowed for CWindow derived objects};}#endif // _WG_FRAME_H_

⌨️ 快捷键说明

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