00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __CS_CSSTATIC_H__
00021 #define __CS_CSSTATIC_H__
00022
00031 #include "cscomp.h"
00032
00034 enum csStaticStyle
00035 {
00037 csscsEmpty,
00039 csscsLabel,
00041 csscsFrameLabel,
00043 csscsRectangle,
00045 csscsBitmap,
00047 csscsText
00048 };
00049
00053
00054 #define CSSTA_HALIGNMASK 0x00000003
00055
00056 #define CSSTA_LEFT 0x00000000
00057
00058 #define CSSTA_RIGHT 0x00000001
00059
00060 #define CSSTA_HCENTER 0x00000002
00061
00062 #define CSSTA_VALIGNMASK 0x0000000C
00063
00064 #define CSSTA_TOP 0x00000000
00065
00066 #define CSSTA_BOTTOM 0x00000004
00067
00068 #define CSSTA_VCENTER 0x00000008
00069
00070 #define CSSTA_WRAPMASK 0x00000030
00071
00072 #define CSSTA_WORDWRAP 0x00000010
00073
00074 #define CSSTA_CHARWRAP 0x00000020
00075
00077
00078 enum
00079 {
00087 cscmdStaticHotKeyEvent = 0x00000700,
00094 cscmdStaticMouseEvent,
00103 cscmdStaticSetBitmap,
00111 cscmdStaticGetBitmap
00112 };
00113
00126 class csStatic : public csComponent
00127 {
00128 protected:
00129
00130 int underline_pos;
00131
00132 csStaticStyle style;
00133
00134 csComponent *link;
00135
00136 csPixmap *Bitmap;
00137
00138 int TextAlignment;
00139
00140 csComponent *oldKO;
00141
00142 bool linkactive;
00143
00144 bool linkdisabled;
00145
00146 public:
00148 csStatic (csComponent *iParent, csComponent *iLink, const char *iText,
00149 csStaticStyle iStyle = csscsLabel);
00151 csStatic (csComponent *iParent, csStaticStyle iStyle = csscsRectangle);
00153 csStatic (csComponent *iParent, csPixmap *iBitmap);
00154
00156 virtual ~csStatic ();
00157
00159 virtual void SetText (const char *iText);
00160
00162 virtual void Draw ();
00163
00165 virtual bool HandleEvent (iEvent &Event);
00166
00168 virtual bool PostHandleEvent (iEvent &Event);
00169
00171 virtual void SuggestSize (int &w, int &h);
00172
00174 void SetTextAlign (int iTextAlignment)
00175 { TextAlignment = iTextAlignment; }
00176
00178 void SetLink (csComponent *iLink)
00179 { link = iLink; CheckUp (); }
00180
00181 protected:
00182
00183 void Init (csStaticStyle iStyle);
00184
00185 bool IsHotKey (iEvent &Event);
00186
00187 void CheckUp ();
00188 };
00189
00192 #endif // __CS_CSSTATIC_H__