wg_frame.h

00001 // wg_frame.h
00002 //
00003 // CFrame interface
00004 // Frames are windows within a view that have their own window management controls
00005 //
00006 // Copyright (c) 2002-2004 Rob Wiskow
00007 // rob-dev@boxedchaos.com
00008 //
00009 // This library is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU Lesser General Public
00011 // License as published by the Free Software Foundation; either
00012 // version 2.1 of the License, or (at your option) any later version.
00013 //
00014 // This library is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00017 // Lesser General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU Lesser General Public
00020 // License along with this library; if not, write to the Free Software
00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00022 //
00023 
00024 
00025 #ifndef _WG_FRAME_H_
00026 #define _WG_FRAME_H_
00027 
00028 #include "wg_window.h"
00029 #include "wg_view.h"
00030 #include "wg_button.h"
00031 
00032 
00033 namespace wGui
00034 {
00035 
00037 
00040 
00041 class CFrame : public CWindow
00042 {
00043 public:
00050      CFrame(const CRect& WindowRect, CView* pParent, CFontEngine* pFontEngine = 0, const std::wstring& sTitle = L"", bool bResizable = true);
00051 
00053      virtual ~CFrame(void);
00054 
00057      void SetTitleBarColor(CRGBColor& TitleBarColor) { m_TitleBarColor = TitleBarColor; }
00058 
00061      void SetTitleBarTextColor(CRGBColor& TitleBarTextColor) { m_TitleBarTextColor = TitleBarTextColor; }
00062 
00065      void SetTitleBarHeight(int iTitleBarHeight);
00066 
00069      bool IsResizable(void) const { return m_bResizable; }
00070 
00073      void AttachMenu(CMenu* pMenu);
00074 
00077      CMenu* GetMenu(void) const { return m_pMenu; }
00078 
00080      void CloseFrame(void);
00081 
00084      bool IsModal(void) const { return m_bModal; }
00085 
00088      void SetModal(bool bModal);
00089 
00090 
00091      // CWindow overrides
00093      virtual void Draw(void) const;
00094 
00099      virtual void PaintToSurface(SDL_Surface& ScreenSurface, SDL_Surface& FloatingSurface, const CPoint& Offset) const;
00100 
00103      virtual void SetWindowRect(const CRect& WindowRect);
00104 
00107      virtual void SetWindowText(const std::wstring& sText);
00108 
00114      virtual bool OnMouseButtonDown(CPoint Point, unsigned int Button);
00115 
00116 
00117      // CMessageClient overrides
00120      virtual bool HandleMessage(CMessage* pMessage);
00121 
00122 
00123 protected:
00124      CPictureButton* m_pFrameCloseButton;  
00125      CRGBColor m_TitleBarColor;  
00126      CRGBColor m_TitleBarTextColor;  
00127      int m_iTitleBarHeight;  
00128      CFontEngine* m_pFontEngine;  
00129      std::auto_ptr<CRenderedString> m_pRenderedString;  
00130      bool m_bResizable;  
00131      bool m_bModal;  
00132      CMenu* m_pMenu;  
00133 
00134 private:
00135      CRect m_TitleBarRect;  
00136      bool m_bDragMode;  
00137      CPoint m_DragPointerStart;  
00138      CRect m_FrameGhostRect;  
00139      void operator=(CFrame) { }  
00140 };
00141 
00142 }
00143 
00144 #endif // _WG_FRAME_H_
00145 

Generated on Wed May 16 23:11:25 2007 for wGui by  doxygen 1.5.1