Crazy Eddies GUI System: FalStaticText.h Source File

Crazy Eddies GUI System 0.7.6

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

- File List

FalStaticText.h

    00001 /***********************************************************************
    00002     filename:   FalStaticText.h
    00003     created:    Tue Jul 5 2005
    00004     author:     Paul D Turner <paul@cegui.org.uk>
    00005 *************************************************************************/
    00006 /***************************************************************************
    00007  *   Copyright (C) 2004 - 2006 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 _FalStaticText_h_
    00029 #define _FalStaticText_h_
    00030
    00031 #include "FalModule.h"
    00032 #include "FalStatic.h"
    00033 #include "FalStaticTextProperties.h"
    00034 #include "../../falagard/CEGUIFalEnums.h"
    00035 #include "../../CEGUIColourRect.h"
    00036 #include <vector>
    00037
    00038 #if defined(_MSC_VER)
    00039 #       pragma warning(push)
    00040 #       pragma warning(disable : 4251)
    00041 #endif
    00042
    00043 // Start of CEGUI namespace section
    00044 namespace CEGUI
    00045 {
    00072     class FALAGARDBASE_API FalagardStaticText : public FalagardStatic
    00073     {
    00074     public:
    00075         static const utf8   TypeName[];
    00076
    00077         /*************************************************************************
    00078             Child Widget name suffix constants
    00079         *************************************************************************/
    00080         static const String VertScrollbarNameSuffix;
    00081         static const String HorzScrollbarNameSuffix;
    00082
    00083         /************************************************************************
    00084             Constructor / Destructor
    00085         *************************************************************************/
    00090         FalagardStaticText(const String& type);
    00091
    00093         ~FalagardStaticText();
    00094
    00095         /************************************************************************
    00096             Scrolled text implementation
    00097         *************************************************************************/
    00102         ColourRect    getTextColours(void) const                {return d_textCols;}
    00103
    00108         HorizontalTextFormatting getHorizontalFormatting(void) const   {return    d_horzFormatting;}
    00109
    00114         VerticalTextFormatting getVerticalFormatting(void) const     {return d_vertFormatting;}
    00115
    00120         void    setTextColours(const ColourRect& colours);
    00121
    00126         void    setVerticalFormatting(VerticalTextFormatting v_fmt);
    00127
    00132         void    setHorizontalFormatting(HorizontalTextFormatting h_fmt);
    00133
    00138         bool    isVerticalScrollbarEnabled(void) const  {return d_enableVertScrollbar;}
    00139
    00144         bool    isHorizontalScrollbarEnabled(void) const    {return d_enableHorzScrollbar;}
    00145
    00150         void    setVerticalScrollbarEnabled(bool setting);
    00151
    00156         void    setHorizontalScrollbarEnabled(bool setting);
    00157
    00159         float getHorizontalTextExtent() const;
    00160
    00162         float getVerticalTextExtent() const;
    00163
    00164         void render(void);
    00165
    00166     protected:
    00168         void updateFormatting() const;
    00170         void updateFormatting(const Size& 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         Rect getTextRenderArea(void) const;
    00182         Size getDocumentSize(const Rect& 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         // properties
    00195         static FalagardStaticTextProperties::TextColours    d_textColoursProperty;
    00196         static FalagardStaticTextProperties::VertFormatting d_vertFormattingProperty;
    00197         static FalagardStaticTextProperties::HorzFormatting d_horzFormattingProperty;
    00198         static FalagardStaticTextProperties::VertScrollbar  d_vertScrollbarProperty;
    00199         static FalagardStaticTextProperties::HorzScrollbar  d_horzScrollbarProperty;
    00200         static FalagardStaticTextProperties::HorzExtent     d_horzExtentProperty;
    00201         static FalagardStaticTextProperties::VertExtent     d_vertExtentProperty;
    00202
    00203         // implementation data
    00205         HorizontalTextFormatting d_horzFormatting;
    00207         VerticalTextFormatting d_vertFormatting;
    00208         ColourRect      d_textCols;
    00209         bool            d_enableVertScrollbar;
    00210         bool            d_enableHorzScrollbar;
    00211
    00213         mutable FormattedRenderedString* d_formattedRenderedString;
    00214
    00215         typedef std::vector<Event::Connection> ConnectionList;
    00216         ConnectionList  d_connections;
    00217
    00219         mutable bool d_formatValid;
    00220     };
    00221
    00222 } // End of  CEGUI namespace section
    00223
    00224 #if defined(_MSC_VER)
    00225 #       pragma warning(pop)
    00226 #endif
    00227
    00228 #endif  // end of guard _FalStaticText_h_