Crazy Eddies GUI System: FalEditbox.h Source File

Crazy Eddies GUI System 0.7.6

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

FalEditbox.h

    00001 /***********************************************************************
    00002     filename:   FalEditbox.h
    00003     created:    Sat Jun 25 2005
    00004     author:     Paul D Turner <paul@cegui.org.uk>
    00005 *************************************************************************/
    00006 /***************************************************************************
    00007  *   Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
    00008  *
    00009  *   Permission is hereby granted, free of charge, to any person obtaining
    00010  *   a copy of this software and associated documentation files (the
    00011  *   "Software"), to deal in the Software without restriction, including
    00012  *   without limitation the rights to use, copy, modify, merge, publish,
    00013  *   distribute, sublicense, and/or sell copies of the Software, and to
    00014  *   permit persons to whom the Software is furnished to do so, subject to
    00015  *   the following conditions:
    00016  *
    00017  *   The above copyright notice and this permission notice shall be
    00018  *   included in all copies or substantial portions of the Software.
    00019  *
    00020  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    00021  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    00022  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    00023  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
    00024  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    00025  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    00026  *   OTHER DEALINGS IN THE SOFTWARE.
    00027  ***************************************************************************/
    00028 #ifndef _FalEditbox_h_
    00029 #define _FalEditbox_h_
    00030
    00031 #include "FalModule.h"
    00032 #include "../../elements/CEGUIEditbox.h"
    00033 #include "FalEditboxProperties.h"
    00034
    00035 #if defined(_MSC_VER)
    00036 #       pragma warning(push)
    00037 #       pragma warning(disable : 4251)
    00038 #endif
    00039
    00040 // Start of CEGUI namespace section
    00041 namespace CEGUI
    00042 {
    00077 class FALAGARDBASE_API FalagardEditbox : public EditboxWindowRenderer
    00078 {
    00079 public:
    00081     static const utf8 TypeName[];
    00083     static const String UnselectedTextColourPropertyName;
    00085     static const String SelectedTextColourPropertyName;
    00087     static const float DefaultCaretBlinkTimeout;
    00088
    00093     FalagardEditbox(const String& type);
    00094
    00103     colour getUnselectedTextColour() const;
    00104
    00113     colour getSelectedTextColour() const;
    00114
    00124     colour getOptionalPropertyColour(const String& propertyName) const;
    00125
    00127     bool isCaretBlinkEnabled() const;
    00129     float getCaretBlinkTimeout() const;
    00131     void setCaretBlinkEnabled(bool enable);
    00133     void setCaretBlinkTimeout(float seconds);
    00134
    00146     void setTextFormatting(const HorizontalTextFormatting format);
    00147     HorizontalTextFormatting getTextFormatting() const;
    00148
    00149     void render();
    00150
    00151     // overridden from EditboxWindowRenderer base class.
    00152     size_t getTextIndexFromPosition(const Point& pt) const;
    00153     // overridden from WindowRenderer class
    00154     void update(float elapsed);
    00155
    00156 protected:
    00157     // properties
    00158     static FalagardEditboxProperties::BlinkCaret d_blinkCaretProperty;
    00159     static FalagardEditboxProperties::BlinkCaretTimeout d_blinkCaretTimeoutProperty;
    00160     static FalagardEditboxProperties::TextFormatting d_textFormattingProperty;
    00161
    00163     void renderBaseImagery(const WidgetLookFeel& wlf) const;
    00165     void setupVisualString(String& visual) const;
    00166     size_t getCaretIndex(const String& visual_string) const;
    00167     float calculateTextOffset(const Rect& text_area,
    00168                               const float text_extent,
    00169                               const float caret_width,
    00170                               const float extent_to_caret);
    00171     void renderTextNoBidi(const WidgetLookFeel& wlf,
    00172                           const String& text,
    00173                           const Rect& text_area,
    00174                           float text_offset);
    00175     void renderTextBidi(const WidgetLookFeel& wlf,
    00176                         const String& text,
    00177                         const Rect& text_area,
    00178                         float text_offset);
    00179     bool editboxIsFocussed() const;
    00180     void renderCaret(const ImagerySection& imagery,
    00181                      const Rect& text_area,
    00182                      const float text_offset,
    00183                      const float extent_to_caret) const;
    00184
    00185     bool isUnsupportedFormat(const HorizontalTextFormatting format);
    00186
    00188     float d_lastTextOffset;
    00190     bool d_blinkCaret;
    00192     float d_caretBlinkTimeout;
    00194     float d_caretBlinkElapsed;
    00196     bool d_showCaret;
    00198     HorizontalTextFormatting d_textFormatting;
    00199 };
    00200
    00201 } // End of  CEGUI namespace section
    00202
    00203 #if defined(_MSC_VER)
    00204 #       pragma warning(pop)
    00205 #endif
    00206
    00207 #endif  // end of guard _FalEditbox_h_