Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages
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 "csextern.h" 00032 00033 #include "cscomp.h" 00034 00036 enum csStaticStyle 00037 { 00039 csscsEmpty, 00041 csscsLabel, 00043 csscsFrameLabel, 00045 csscsRectangle, 00047 csscsBitmap, 00049 csscsText 00050 }; 00051 00055 00056 #define CSSTA_HALIGNMASK 0x00000003 00057 00058 #define CSSTA_LEFT 0x00000000 00059 00060 #define CSSTA_RIGHT 0x00000001 00061 00062 #define CSSTA_HCENTER 0x00000002 00063 00064 #define CSSTA_VALIGNMASK 0x0000000C 00065 00066 #define CSSTA_TOP 0x00000000 00067 00068 #define CSSTA_BOTTOM 0x00000004 00069 00070 #define CSSTA_VCENTER 0x00000008 00071 00072 #define CSSTA_WRAPMASK 0x00000030 00073 00074 #define CSSTA_WORDWRAP 0x00000010 00075 00076 #define CSSTA_CHARWRAP 0x00000020 00077 00079 00080 enum 00081 { 00089 cscmdStaticHotKeyEvent = 0x00000700, 00096 cscmdStaticMouseEvent, 00105 cscmdStaticSetBitmap, 00113 cscmdStaticGetBitmap 00114 }; 00115 00128 class CS_CSWS_EXPORT csStatic : public csComponent 00129 { 00130 protected: 00131 // Character number that should be underlined (-1 == none) 00132 size_t underline_pos; 00133 // Static component style 00134 csStaticStyle style; 00135 // Component to which this label is linked 00136 csComponent *link; 00137 // The bitmap (if style == csscsBitmap) 00138 csPixmap *Bitmap; 00139 // Text alignment (for csscsText style) 00140 int TextAlignment; 00141 // Old keyboard and mouse owner 00142 csComponent *oldKO; 00143 // link is focused? 00144 bool linkactive; 00145 // link is focused? 00146 bool linkdisabled; 00147 00148 public: 00150 csStatic (csComponent *iParent, csComponent *iLink, const char *iText, 00151 csStaticStyle iStyle = csscsLabel); 00153 csStatic (csComponent *iParent, csStaticStyle iStyle = csscsRectangle); 00155 csStatic (csComponent *iParent, csPixmap *iBitmap); 00156 00158 virtual ~csStatic (); 00159 00161 virtual void SetText (const char *iText); 00162 00164 virtual void Draw (); 00165 00167 virtual bool HandleEvent (iEvent &Event); 00168 00170 virtual bool PostHandleEvent (iEvent &Event); 00171 00173 virtual void SuggestSize (int &w, int &h); 00174 00176 void SetTextAlign (int iTextAlignment) 00177 { TextAlignment = iTextAlignment; } 00178 00180 void SetLink (csComponent *iLink) 00181 { link = iLink; CheckUp (); } 00182 00183 protected: 00184 // Common part of constructors 00185 void Init (csStaticStyle iStyle); 00186 // Check if event is a hotkey event 00187 bool IsHotKey (iEvent &Event); 00188 // Check if focused status of link has changed 00189 void CheckUp (); 00190 }; 00191 00194 #endif // __CS_CSSTATIC_H__
Generated for Crystal Space by doxygen 1.3.9.1