Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: Sat Jun 25 2005 00003 author: Paul D Turner <paul@cegui.org.uk> 00004 *************************************************************************/ 00005 /*************************************************************************** 00006 * Copyright (C) 2004 - 2009 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 _FalEditbox_h_ 00028 #define _FalEditbox_h_ 00029 00030 #include "CEGUI/WindowRendererSets/Core/Module.h" 00031 #include "CEGUI/widgets/Editbox.h" 00032 00033 #if defined(_MSC_VER) 00034 # pragma warning(push) 00035 # pragma warning(disable : 4251) 00036 #endif 00037 00038 // Start of CEGUI namespace section 00039 namespace CEGUI 00040 { 00075 class COREWRSET_API FalagardEditbox : public EditboxWindowRenderer 00076 { 00077 public: 00079 static const String TypeName; 00080 00082 static const String UnselectedTextColourPropertyName; 00084 static const String SelectedTextColourPropertyName; 00086 static const float DefaultCaretBlinkTimeout; 00087 00092 FalagardEditbox(const String& type); 00093 00099 void setColourRectToUnselectedTextColour(ColourRect& colour_rect) const; 00100 00106 void setColourRectToSelectedTextColour(ColourRect& colour_rect) const; 00107 00120 void setColourRectToOptionalPropertyColour(const String& propertyName, 00121 ColourRect& colour_rect) const; 00122 00124 bool isCaretBlinkEnabled() const; 00126 float getCaretBlinkTimeout() const; 00128 void setCaretBlinkEnabled(bool enable); 00130 void setCaretBlinkTimeout(float seconds); 00131 00143 void setTextFormatting(const HorizontalTextFormatting format); 00144 HorizontalTextFormatting getTextFormatting() const; 00145 00146 void render(); 00147 00148 // overridden from EditboxWindowRenderer base class. 00149 size_t getTextIndexFromPosition(const Vector2f& pt) const; 00150 // overridden from WindowRenderer class 00151 void update(float elapsed); 00152 bool handleFontRenderSizeChange(const Font* const font); 00153 00154 protected: 00156 void renderBaseImagery(const WidgetLookFeel& wlf) const; 00158 void setupVisualString(String& visual) const; 00159 size_t getCaretIndex(const String& visual_string) const; 00160 float calculateTextOffset(const Rectf& text_area, 00161 const float text_extent, 00162 const float caret_width, 00163 const float extent_to_caret); 00164 void renderTextNoBidi(const WidgetLookFeel& wlf, 00165 const String& text, 00166 const Rectf& text_area, 00167 float text_offset); 00168 void renderTextBidi(const WidgetLookFeel& wlf, 00169 const String& text, 00170 const Rectf& text_area, 00171 float text_offset); 00172 bool editboxIsFocussed() const; 00173 bool editboxIsReadOnly() const; 00174 void renderCaret(const ImagerySection& imagery, 00175 const Rectf& text_area, 00176 const float text_offset, 00177 const float extent_to_caret) const; 00178 00179 bool isUnsupportedFormat(const HorizontalTextFormatting format); 00180 00182 float d_lastTextOffset; 00184 bool d_blinkCaret; 00186 float d_caretBlinkTimeout; 00188 float d_caretBlinkElapsed; 00190 bool d_showCaret; 00192 HorizontalTextFormatting d_textFormatting; 00193 }; 00194 00195 } // End of CEGUI namespace section 00196 00197 #if defined(_MSC_VER) 00198 # pragma warning(pop) 00199 #endif 00200 00201 #endif // end of guard _FalEditbox_h_