00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __CS_CSWINDOW_H__
00021 #define __CS_CSWINDOW_H__
00022
00031 #include "cscomp.h"
00032 #include "csbutton.h"
00033
00035 #define CSWID_BUTSYSMENU 0xC500
00036
00037 #define CSWID_BUTCLOSE 0xC501
00038
00039 #define CSWID_BUTHIDE 0xC502
00040
00041 #define CSWID_BUTMAXIMIZE 0xC503
00042
00043 #define CSWID_TITLEBAR 0xC504
00044
00045 #define CSWID_MENUBAR 0xC505
00046
00047 #define CSWID_CLIENT 0xC506
00048
00049 #define CSWID_SYSMENU 0xC507
00050
00051 #define CSWID_TOOLBAR 0xC508
00052
00056
00057 #define CSWS_BUTSYSMENU 0x00000001
00058
00059 #define CSWS_BUTCLOSE 0x00000002
00060
00061 #define CSWS_BUTHIDE 0x00000004
00062
00063 #define CSWS_BUTMAXIMIZE 0x00000008
00064
00065 #define CSWS_TITLEBAR 0x00000010
00066
00067 #define CSWS_MENUBAR 0x00000020
00068
00069 #define CSWS_CLIENTBORDER 0x00000040
00070
00071 #define CSWS_TOOLBAR 0x00000080
00072
00073 #define CSWS_TBPOS_MASK 0x00000300
00074
00075 #define CSWS_TBPOS_TOP 0x00000000
00076
00077 #define CSWS_TBPOS_BOTTOM 0x00000100
00078
00079 #define CSWS_TBPOS_LEFT 0x00000200
00080
00081 #define CSWS_TBPOS_RIGHT 0x00000300
00082
00083 #define CSWS_DEFAULTVALUE \
00084 (CSWS_BUTSYSMENU | CSWS_BUTCLOSE | \
00085 CSWS_BUTHIDE | CSWS_BUTMAXIMIZE | \
00086 CSWS_TITLEBAR | CSWS_MENUBAR)
00087
00089
00090 enum csWindowFrameStyle
00091 {
00092 cswfsNone,
00093 cswfsThin,
00094 cswfs3D
00095 };
00096
00103 enum
00104 {
00108 cscmdWindowSysMenu = 0x00000100,
00116 cscmdWindowSetClient
00117 };
00118
00125 class csWindow : public csComponent
00126 {
00127 protected:
00129 int WindowStyle;
00131 csWindowFrameStyle FrameStyle;
00133 int BorderWidth, BorderHeight;
00135 int TitlebarHeight;
00137 int MenuHeight;
00139 uint8 Alpha;
00140
00141 public:
00143 csWindow (csComponent *iParent, const char *iTitle, int iWindowStyle = CSWS_DEFAULTVALUE,
00144 csWindowFrameStyle iFrameStyle = cswfs3D);
00145
00147 virtual bool SetRect (int xmin, int ymin, int xmax, int ymax);
00148
00150 virtual bool HandleEvent (iEvent &Event);
00151
00153 virtual void FixSize (int &newW, int &newH);
00154
00156 virtual bool Maximize ();
00157
00159 virtual bool Restore ();
00160
00162 virtual void SetText (const char *iText);
00164 virtual void GetText (char *oText, int iTextSize) const;
00166 virtual const char *GetText () const;
00167
00169 virtual void SetState (int mask, bool enable);
00170
00172 void SetBorderSize (int w, int h);
00174 void GetBorderSize (int &bw, int &bh)
00175 { bw = BorderWidth; bh = BorderHeight; }
00176
00178 void SetTitlebarHeight (int iHeight);
00180 int GetTitlebarHeight ()
00181 { return TitlebarHeight; }
00182
00184 void SetMenuBarHeight (int iHeight);
00186 int GetMenuHeight ()
00187 { return MenuHeight; }
00188
00190 void ClientToWindow (int &ClientW, int &ClientH);
00192 void WindowToClient (int &ClientW, int &ClientH);
00193
00195 inline int GetWindowStyle ()
00196 { return WindowStyle; }
00197
00199 void SetFrameStyle (csWindowFrameStyle iFrameStyle);
00201 inline csWindowFrameStyle GetFrameStyle ()
00202 { return FrameStyle; }
00203
00205 virtual char *GetSkinName ()
00206 { return "Window"; }
00207
00209 void SetAlpha (uint8 iAlpha);
00211 uint8 GetAlpha ()
00212 { return GetState (CSS_TRANSPARENT) ? Alpha : 0; }
00213 };
00214
00217 #endif // __CS_CSWINDOW_H__