|
csstatic.h00001 /* 00002 Crystal Space Windowing System: static control 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 __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 // Character number that should be underlined (-1 == none) 00118 int underline_pos; 00119 // Static component style 00120 csStaticStyle style; 00121 // Component to which this label is linked 00122 csComponent *link; 00123 // The bitmap (if style == csscsBitmap) 00124 csPixmap *Bitmap; 00125 // Text alignment (for csscsText style) 00126 int TextAlignment; 00127 // Old keyboard and mouse owner 00128 csComponent *oldKO; 00129 // link is focused? 00130 bool linkactive; 00131 // link is focused? 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 // Common part of constructors 00171 void Init (csStaticStyle iStyle); 00172 // Check if event is a hotkey event 00173 bool IsHotKey (iEvent &Event); 00174 // Check if focused status of link has changed 00175 void CheckUp (); 00176 }; 00177 00178 #endif // __CSSTATIC_H__ Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |