csws/csstatic.h
Go to the documentation of this file.00001 /* 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 __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 // Character number that should be underlined (-1 == none) 00130 int underline_pos; 00131 // Static component style 00132 csStaticStyle style; 00133 // Component to which this label is linked 00134 csComponent *link; 00135 // The bitmap (if style == csscsBitmap) 00136 csPixmap *Bitmap; 00137 // Text alignment (for csscsText style) 00138 int TextAlignment; 00139 // Old keyboard and mouse owner 00140 csComponent *oldKO; 00141 // link is focused? 00142 bool linkactive; 00143 // link is focused? 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 // Common part of constructors 00183 void Init (csStaticStyle iStyle); 00184 // Check if event is a hotkey event 00185 bool IsHotKey (iEvent &Event); 00186 // Check if focused status of link has changed 00187 void CheckUp (); 00188 }; 00189 00192 #endif // __CS_CSSTATIC_H__
Generated for Crystal Space by doxygen 1.2.18