00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __CSSTATIC_H__
00021 #define __CSSTATIC_H__
00022
00023 #include "cscomp.h"
00024
00026 enum csStaticStyle
00027 {
00029 csscsEmpty,
00031 csscsLabel,
00033 csscsFrameLabel,
00035 csscsRectangle,
00037 csscsBitmap,
00039 csscsText
00040 };
00041
00043 #define CSSTA_HALIGNMASK 0x00000003
00044
00045 #define CSSTA_LEFT 0x00000000
00046
00047 #define CSSTA_RIGHT 0x00000001
00048
00049 #define CSSTA_HCENTER 0x00000002
00050
00051 #define CSSTA_VALIGNMASK 0x0000000C
00052
00053 #define CSSTA_TOP 0x00000000
00054
00055 #define CSSTA_BOTTOM 0x00000004
00056
00057 #define CSSTA_VCENTER 0x00000008
00058
00059 #define CSSTA_WRAPMASK 0x00000030
00060
00061 #define CSSTA_WORDWRAP 0x00000010
00062
00063 #define CSSTA_CHARWRAP 0x00000020
00064
00066 enum
00067 {
00075 cscmdStaticHotKeyEvent = 0x00000700,
00082 cscmdStaticMouseEvent,
00091 cscmdStaticSetBitmap,
00099 cscmdStaticGetBitmap
00100 };
00101
00114 class csStatic : public csComponent
00115 {
00116 protected:
00117
00118 int underline_pos;
00119
00120 csStaticStyle style;
00121
00122 csComponent *link;
00123
00124 csPixmap *Bitmap;
00125
00126 int TextAlignment;
00127
00128 csComponent *oldKO;
00129
00130 bool linkactive;
00131
00132 bool linkdisabled;
00133
00134 public:
00136 csStatic (csComponent *iParent, csComponent *iLink, const char *iText,
00137 csStaticStyle iStyle = csscsLabel);
00139 csStatic (csComponent *iParent, csStaticStyle iStyle = csscsRectangle);
00141 csStatic (csComponent *iParent, csPixmap *iBitmap);
00142
00144 virtual ~csStatic ();
00145
00147 virtual void SetText (const char *iText);
00148
00150 virtual void Draw ();
00151
00153 virtual bool HandleEvent (iEvent &Event);
00154
00156 virtual bool PostHandleEvent (iEvent &Event);
00157
00159 virtual void SuggestSize (int &w, int &h);
00160
00162 void SetTextAlign (int iTextAlignment)
00163 { TextAlignment = iTextAlignment; }
00164
00166 void SetLink (csComponent *iLink)
00167 { link = iLink; CheckUp (); }
00168
00169 protected:
00170
00171 void Init (csStaticStyle iStyle);
00172
00173 bool IsHotKey (iEvent &Event);
00174
00175 void CheckUp ();
00176 };
00177
00178 #endif // __CSSTATIC_H__