CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

cswindow.h

Go to the documentation of this file.
00001 /*
00002     Crystal Space Windowing System: window class
00003     Copyright (C) 1998,1999 by Andrew Zabolotny <bit@eltech.ru>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef __CS_CSWINDOW_H__
00021 #define __CS_CSWINDOW_H__
00022 
00031 #include "csextern.h"
00032  
00033 #include "cscomp.h"
00034 #include "csbutton.h"
00035 
00037 #define CSWID_BUTSYSMENU        0xC500
00038 
00039 #define CSWID_BUTCLOSE          0xC501
00040 
00041 #define CSWID_BUTHIDE           0xC502
00042 
00043 #define CSWID_BUTMAXIMIZE       0xC503
00044 
00045 #define CSWID_TITLEBAR          0xC504
00046 
00047 #define CSWID_MENUBAR           0xC505
00048 
00049 #define CSWID_CLIENT            0xC506
00050 
00051 #define CSWID_SYSMENU           0xC507
00052 
00053 #define CSWID_TOOLBAR           0xC508
00054 
00058 
00059 #define CSWS_BUTSYSMENU         0x00000001
00060 
00061 #define CSWS_BUTCLOSE           0x00000002
00062 
00063 #define CSWS_BUTHIDE            0x00000004
00064 
00065 #define CSWS_BUTMAXIMIZE        0x00000008
00066 
00067 #define CSWS_TITLEBAR           0x00000010
00068 
00069 #define CSWS_MENUBAR            0x00000020
00070 
00071 #define CSWS_CLIENTBORDER       0x00000040
00072 
00073 #define CSWS_TOOLBAR            0x00000080
00074 
00075 #define CSWS_TBPOS_MASK         0x00000300
00076 
00077 #define CSWS_TBPOS_TOP          0x00000000
00078 
00079 #define CSWS_TBPOS_BOTTOM       0x00000100
00080 
00081 #define CSWS_TBPOS_LEFT         0x00000200
00082 
00083 #define CSWS_TBPOS_RIGHT        0x00000300
00084 
00085 #define CSWS_DEFAULTVALUE       \
00086         (CSWS_BUTSYSMENU | CSWS_BUTCLOSE | \
00087          CSWS_BUTHIDE | CSWS_BUTMAXIMIZE | \
00088          CSWS_TITLEBAR | CSWS_MENUBAR)
00089 
00091 
00092 enum csWindowFrameStyle
00093 {
00094   cswfsNone,
00095   cswfsThin,
00096   cswfs3D
00097 };
00098 
00105 enum
00106 {
00110   cscmdWindowSysMenu = 0x00000100,
00118   cscmdWindowSetClient
00119 };
00120 
00127 class CS_CSWS_EXPORT csWindow : public csComponent
00128 {
00129 protected:
00131   int WindowStyle;
00133   csWindowFrameStyle FrameStyle;
00135   int BorderWidth, BorderHeight;
00137   int TitlebarHeight;
00139   int MenuHeight;
00141   uint8 Alpha;
00142 
00143 public:
00145   csWindow (csComponent *iParent, const char *iTitle, int iWindowStyle = CSWS_DEFAULTVALUE,
00146     csWindowFrameStyle iFrameStyle = cswfs3D);
00147 
00149   virtual bool SetRect (int xmin, int ymin, int xmax, int ymax);
00150 
00152   virtual bool HandleEvent (iEvent &Event);
00153 
00155   virtual void FixSize (int &newW, int &newH);
00156 
00158   virtual bool Maximize ();
00159 
00161   virtual bool Restore ();
00162 
00164   virtual void SetText (const char *iText);
00166   virtual void GetText (char *oText, int iTextSize) const;
00168   virtual const char *GetText () const;
00169 
00171   virtual void SetState (int mask, bool enable);
00172 
00174   void SetBorderSize (int w, int h);
00176   void GetBorderSize (int &bw, int &bh)
00177   { bw = BorderWidth; bh = BorderHeight; }
00178 
00180   void SetTitlebarHeight (int iHeight);
00182   int GetTitlebarHeight ()
00183   { return TitlebarHeight; }
00184 
00186   void SetMenuBarHeight (int iHeight);
00188   int GetMenuHeight ()
00189   { return MenuHeight; }
00190 
00192   void ClientToWindow (int &ClientW, int &ClientH);
00194   void WindowToClient (int &ClientW, int &ClientH);
00195 
00197   inline int GetWindowStyle ()
00198   { return WindowStyle; }
00199 
00201   void SetFrameStyle (csWindowFrameStyle iFrameStyle);
00203   inline csWindowFrameStyle GetFrameStyle ()
00204   { return FrameStyle; }
00205 
00207   virtual char *GetSkinName ()
00208   { return "Window"; }
00209 
00211   void SetAlpha (uint8 iAlpha);
00213   uint8 GetAlpha ()
00214   { return GetState (CSS_TRANSPARENT) ? Alpha : 0; }
00215 };
00216 
00219 #endif // __CS_CSWINDOW_H__

Generated for Crystal Space by doxygen 1.3.9.1