Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

cswindow.h

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 __CSWINDOW_H__
00021 #define __CSWINDOW_H__
00022 
00023 #include "cscomp.h"
00024 #include "csbutton.h"
00025 
00027 #define CSWID_BUTSYSMENU        0xC500
00028 
00029 #define CSWID_BUTCLOSE          0xC501
00030 
00031 #define CSWID_BUTHIDE           0xC502
00032 
00033 #define CSWID_BUTMAXIMIZE       0xC503
00034 
00035 #define CSWID_TITLEBAR          0xC504
00036 
00037 #define CSWID_MENUBAR           0xC505
00038 
00039 #define CSWID_CLIENT            0xC506
00040 
00041 #define CSWID_SYSMENU           0xC507
00042 
00043 #define CSWID_TOOLBAR           0xC508
00044 
00046 #define CSWS_BUTSYSMENU         0x00000001
00047 
00048 #define CSWS_BUTCLOSE           0x00000002
00049 
00050 #define CSWS_BUTHIDE            0x00000004
00051 
00052 #define CSWS_BUTMAXIMIZE        0x00000008
00053 
00054 #define CSWS_TITLEBAR           0x00000010
00055 
00056 #define CSWS_MENUBAR            0x00000020
00057 
00058 #define CSWS_CLIENTBORDER       0x00000040
00059 
00060 #define CSWS_TOOLBAR            0x00000080
00061 
00062 #define CSWS_TBPOS_MASK         0x00000300
00063 
00064 #define CSWS_TBPOS_TOP          0x00000000
00065 
00066 #define CSWS_TBPOS_BOTTOM       0x00000100
00067 
00068 #define CSWS_TBPOS_LEFT         0x00000200
00069 
00070 #define CSWS_TBPOS_RIGHT        0x00000300
00071 
00072 #define CSWS_DEFAULTVALUE       (CSWS_BUTSYSMENU | CSWS_BUTCLOSE | \
00073                                  CSWS_BUTHIDE | CSWS_BUTMAXIMIZE | \
00074                                  CSWS_TITLEBAR | CSWS_MENUBAR)
00075 
00077 enum csWindowFrameStyle
00078 {
00079   cswfsNone,
00080   cswfsThin,
00081   cswfs3D
00082 };
00083 
00090 enum
00091 {
00095   cscmdWindowSysMenu = 0x00000100,
00103   cscmdWindowSetClient
00104 };
00105 
00112 class csWindow : public csComponent
00113 {
00114 protected:
00116   int WindowStyle;
00118   csWindowFrameStyle FrameStyle;
00120   int BorderWidth, BorderHeight;
00122   int TitlebarHeight;
00124   int MenuHeight;
00126   uint8 Alpha;
00127 
00128 public:
00130   csWindow (csComponent *iParent, const char *iTitle, int iWindowStyle = CSWS_DEFAULTVALUE,
00131     csWindowFrameStyle iFrameStyle = cswfs3D);
00132 
00134   virtual bool SetRect (int xmin, int ymin, int xmax, int ymax);
00135 
00137   virtual bool HandleEvent (iEvent &Event);
00138 
00140   virtual void FixSize (int &newW, int &newH);
00141 
00143   virtual bool Maximize ();
00144 
00146   virtual bool Restore ();
00147 
00149   virtual void SetText (const char *iText);
00151   virtual void GetText (char *oText, int iTextSize) const;
00153   virtual const char *GetText () const;
00154 
00156   virtual void SetState (int mask, bool enable);
00157 
00159   void SetBorderSize (int w, int h);
00161   void GetBorderSize (int &bw, int &bh)
00162   { bw = BorderWidth; bh = BorderHeight; }
00163 
00165   void SetTitlebarHeight (int iHeight);
00167   int GetTitlebarHeight ()
00168   { return TitlebarHeight; }
00169 
00171   void SetMenuBarHeight (int iHeight);
00173   int GetMenuHeight ()
00174   { return MenuHeight; }
00175 
00177   void ClientToWindow (int &ClientW, int &ClientH);
00179   void WindowToClient (int &ClientW, int &ClientH);
00180 
00182   inline int GetWindowStyle ()
00183   { return WindowStyle; }
00184 
00186   void SetFrameStyle (csWindowFrameStyle iFrameStyle);
00188   inline csWindowFrameStyle GetFrameStyle ()
00189   { return FrameStyle; }
00190 
00192   virtual char *GetSkinName ()
00193   { return "Window"; }
00194 
00196   void SetAlpha (uint8 iAlpha);
00198   uint8 GetAlpha ()
00199   { return GetState (CSS_TRANSPARENT) ? Alpha : 0; }
00200 };
00201 
00202 #endif // __CSWINDOW_H__

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000