📄 wg_view.h
字号:
// wg_view.h//// CView 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_VIEW_H_#define _WG_VIEW_H_#include "wg_window.h"#include "SDL.h"#include "wg_menu.h"namespace{const int DEFAULT_BPP = 16;}namespace wGui{//! A general view class//! A CView creates itself as a root window (it has no parent)//! and responds to APP_PAINT messages with itself or 0 as the destination, and will redraw all of it's children as well as itself//! Because of a limitation in SDL, there can be only one Viewclass CView : public CWindow{public: //! \param Rect A CRect that defines the outer limits of the control //! \param sTitle The window title, which will appear in the title bar of the view //! \param bResizable If true, the window will be resizable (defaults to true) //! \param bFullScreen If true, the window will be created full-screen, and the bResizable parameter will be ignored (defaults to false) CView(const CRect& Rect, std::string sTitle, bool bResizable = true, bool bFullScreen = false); //! Standard Destructor virtual ~CView(void); //! \return true if the view is resizable bool IsResizable(void) { return m_bResizable; } //! \return true if the view was created as fullscreen bool IsFullScreen(void) { return m_bFullScreen; } //! Attaches a standard menu to the view, if the view already has a menu, the old menu will be deleted //! \param pMenu A pointer to the menu, the CView is then responsible for cleaning it up, passing in 0 will delete the current menu void AttachMenu(CMenu* pMenu); //! \return A pointer to the view's menu, 0 if the view doesn't have a menu CMenu* GetMenu(void) { return m_pMenu; } // CWindow Overrides //! Set the WindowText of the view, which is used as the window caption //! \param sText The text to assign to the view virtual void SetWindowText(const std::string& sText); // CMessageClient overrides //! Handles APP_PAINT messages with itself or 0 as the destination, and will redraw all of it's children as well as itself virtual bool HandleMessage(CMessage* pMessage);protected: bool m_bResizable; //!< Indicates if the view is resizable bool m_bFullScreen; //!< Indicates if the view was created as fullscreen CMenu* m_pMenu; //!< A pointer to the view's menuprivate: //! A pointer to the one allowed view, this is due to the SDL limitation of having only one window static CView* m_pInstance; void operator=(CView) { } //!< The assignment operator is not allowed for CWindow derived objects};}#endif // _WG_VIEW_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -