Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: Tue Jul 5 2005 00003 author: Paul D Turner <paul@cegui.org.uk> 00004 *************************************************************************/ 00005 /*************************************************************************** 00006 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00007 * 00008 * Permission is hereby granted, free of charge, to any person obtaining 00009 * a copy of this software and associated documentation files (the 00010 * "Software"), to deal in the Software without restriction, including 00011 * without limitation the rights to use, copy, modify, merge, publish, 00012 * distribute, sublicense, and/or sell copies of the Software, and to 00013 * permit persons to whom the Software is furnished to do so, subject to 00014 * the following conditions: 00015 * 00016 * The above copyright notice and this permission notice shall be 00017 * included in all copies or substantial portions of the Software. 00018 * 00019 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00020 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00021 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00022 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00023 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00024 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00025 * OTHER DEALINGS IN THE SOFTWARE. 00026 ***************************************************************************/ 00027 #ifndef _FalStaticText_h_ 00028 #define _FalStaticText_h_ 00029 00030 #include "CEGUI/WindowRendererSets/Core/Module.h" 00031 #include "CEGUI/WindowRendererSets/Core/Static.h" 00032 #include "CEGUI/falagard/Enums.h" 00033 #include "CEGUI/ColourRect.h" 00034 #include <vector> 00035 00036 #if defined(_MSC_VER) 00037 # pragma warning(push) 00038 # pragma warning(disable : 4251) 00039 #endif 00040 00041 // Start of CEGUI namespace section 00042 namespace CEGUI 00043 { 00070 class COREWRSET_API FalagardStaticText : public FalagardStatic 00071 { 00072 public: 00073 static const String TypeName; 00074 00075 /************************************************************************* 00076 Child Widget name constants 00077 *************************************************************************/ 00078 static const String VertScrollbarName; 00079 static const String HorzScrollbarName; 00080 00081 /************************************************************************ 00082 Constructor / Destructor 00083 *************************************************************************/ 00088 FalagardStaticText(const String& type); 00089 00091 ~FalagardStaticText(); 00092 00093 /************************************************************************ 00094 Scrolled text implementation 00095 *************************************************************************/ 00100 ColourRect getTextColours(void) const {return d_textCols;} 00101 00106 HorizontalTextFormatting getHorizontalFormatting(void) const {return d_horzFormatting;} 00107 00112 VerticalTextFormatting getVerticalFormatting(void) const {return d_vertFormatting;} 00113 00118 void setTextColours(const ColourRect& colours); 00119 00124 void setVerticalFormatting(VerticalTextFormatting v_fmt); 00125 00130 void setHorizontalFormatting(HorizontalTextFormatting h_fmt); 00131 00136 bool isVerticalScrollbarEnabled(void) const {return d_enableVertScrollbar;} 00137 00142 bool isHorizontalScrollbarEnabled(void) const {return d_enableHorzScrollbar;} 00143 00148 void setVerticalScrollbarEnabled(bool setting); 00149 00154 void setHorizontalScrollbarEnabled(bool setting); 00155 00157 float getHorizontalTextExtent() const; 00158 00160 float getVerticalTextExtent() const; 00161 00162 // overridden from base class 00163 bool handleFontRenderSizeChange(const Font* const font); 00164 void render(void); 00165 00166 protected: 00168 void updateFormatting() const; 00170 void updateFormatting(const Sizef& sz) const; 00171 00172 // overridden from FalagardStatic base class 00173 void onLookNFeelAssigned(); 00174 void onLookNFeelUnassigned(); 00175 00176 // text field with scrollbars methods 00177 void renderScrolledText(void); 00178 void configureScrollbars(void); 00179 Scrollbar* getVertScrollbar(void) const; 00180 Scrollbar* getHorzScrollbar(void) const; 00181 Rectf getTextRenderArea(void) const; 00182 Sizef getDocumentSize(const Rectf& renderArea) const; 00183 void setupStringFormatter() const; 00184 00185 // overridden event handlers 00186 bool onTextChanged(const EventArgs& e); 00187 bool onSized(const EventArgs& e); 00188 bool onFontChanged(const EventArgs& e); 00189 bool onMouseWheel(const EventArgs& e); 00190 00191 // event subscribers 00192 bool handleScrollbarChange(const EventArgs& e); 00193 00194 // implementation data 00196 HorizontalTextFormatting d_horzFormatting; 00198 VerticalTextFormatting d_vertFormatting; 00199 ColourRect d_textCols; 00200 bool d_enableVertScrollbar; 00201 bool d_enableHorzScrollbar; 00202 00204 mutable FormattedRenderedString* d_formattedRenderedString; 00205 00206 typedef std::vector<Event::Connection> ConnectionList; 00207 ConnectionList d_connections; 00208 00210 mutable bool d_formatValid; 00211 }; 00212 00213 } // End of CEGUI namespace section 00214 00215 #if defined(_MSC_VER) 00216 # pragma warning(pop) 00217 #endif 00218 00219 #endif // end of guard _FalStaticText_h_