Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CEGUIStaticText.h

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUIStaticText.h
00003         created:        4/6/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Defines interface for a static text widget
00007 *************************************************************************/
00008 /*************************************************************************
00009     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #ifndef _CEGUIStaticText_h_
00027 #define _CEGUIStaticText_h_
00028 
00029 #include "elements/CEGUIStatic.h"
00030 #include "elements/CEGUIStaticTextProperties.h"
00031 
00032 
00033 #if defined(_MSC_VER)
00034 #       pragma warning(push)
00035 #       pragma warning(disable : 4251)
00036 #endif
00037 
00038 
00039 // Start of CEGUI namespace section
00040 namespace CEGUI
00041 {
00046 class CEGUIBASE_API StaticText : public Static
00047 {
00048 public:
00049         static const String EventNamespace;                             
00050 
00051 
00052         /*************************************************************************
00053                 Formatting Enumerations
00054         *************************************************************************/
00059         enum HorzFormatting
00060         {
00061                 LeftAligned,                    
00062                 RightAligned,                   
00063                 HorzCentred,                    
00064                 WordWrapLeftAligned,    
00065                 WordWrapRightAligned,   
00066                 WordWrapCentred,                
00067         };
00068 
00069 
00074         enum VertFormatting
00075         {
00076                 TopAligned,             
00077                 BottomAligned,  
00078                 VertCentred,    
00079         };
00080 
00081 
00082         /*************************************************************************
00083                 Construction and Destruction
00084         *************************************************************************/
00089         StaticText(const String& type, const String& name);
00090 
00091 
00096         virtual ~StaticText(void);
00097 
00098 
00099         /*************************************************************************
00100                 Accessors
00101         *************************************************************************/
00109         ColourRect      getTextColours(void) const              {return d_textCols;}
00110 
00111         
00119         HorzFormatting  getHorizontalFormatting(void) const             {return d_horzFormatting;}
00120 
00121 
00129         VertFormatting  getVerticalFormatting(void) const               {return d_vertFormatting;}
00130 
00131 
00140         bool    isVerticalScrollbarEnabled(void) const;
00141 
00142 
00151         bool    isHorizontalScrollbarEnabled(void) const;
00152 
00153 
00154         // overridden (again) so scroll bars are not clipped when they are active
00155         virtual Rect    getUnclippedInnerRect(void) const;
00156 
00157 
00158         /*************************************************************************
00159                 Manipulators
00160         *************************************************************************/
00171         virtual void    initialise(void);
00172 
00173 
00184         void    setTextColours(const ColourRect& colours);
00185 
00186 
00206         void    setTextColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
00207 
00208 
00219         void    setTextColours(const colour& col)               {setTextColours(col, col, col, col);}
00220 
00221 
00235         void    setFormatting(HorzFormatting h_fmt, VertFormatting v_fmt);
00236 
00237 
00248         void    setVerticalFormatting(VertFormatting v_fmt);
00249 
00250 
00261         void    setHorizontalFormatting(HorzFormatting h_fmt);
00262 
00263 
00272         void    setVerticalScrollbarEnabled(bool setting);
00273 
00274 
00283         void    setHorizontalScrollbarEnabled(bool setting);
00284 
00285 
00286 protected:
00287         /*************************************************************************
00288                 Overridden from base class
00289         *************************************************************************/
00300         virtual void    drawSelf(float z);
00301 
00302 
00303         /*************************************************************************
00304                 Overridden events
00305         *************************************************************************/
00306         virtual void    onTextChanged(WindowEventArgs& e);
00307         virtual void    onSized(WindowEventArgs& e);
00308         virtual void    onFontChanged(WindowEventArgs& e);
00309         virtual void    onMouseWheel(MouseEventArgs& e);
00310 
00311 
00312         /*************************************************************************
00313                 Implementation methods
00314         *************************************************************************/
00323         virtual Rect    getTextRenderArea(void) const;
00324 
00325 
00333         virtual void    layoutComponentWidgets();
00334 
00335 
00340         void    configureScrollbars(void);
00341 
00342 
00343         /*************************************************************************
00344                 Implementation Methods (abstract)
00345         *************************************************************************/
00353         virtual Scrollbar*      createVertScrollbar(void) const         = 0;
00354  
00355 
00363         virtual Scrollbar*      createHorzScrollbar(void) const         = 0;
00364 
00365 
00366         /*************************************************************************
00367                 Event subscribers
00368         *************************************************************************/
00369         bool    handleScrollbarChange(const EventArgs& e);
00370 
00371 
00372         /*************************************************************************
00373                 Implementation Data
00374         *************************************************************************/
00375         HorzFormatting  d_horzFormatting;               
00376         VertFormatting  d_vertFormatting;               
00377         ColourRect              d_textCols;                             
00378         Scrollbar*              d_vertScrollbar;                
00379         Scrollbar*              d_horzScrollbar;                
00380         bool                    d_enableVertScrollbar;  
00381         bool                    d_enableHorzScrollbar;  
00382 
00383 private:
00384         /*************************************************************************
00385                 Static Properties for this class
00386         *************************************************************************/
00387         static StaticTextProperties::TextColours        d_textColoursProperty;
00388         static StaticTextProperties::VertFormatting     d_vertFormattingProperty;
00389         static StaticTextProperties::HorzFormatting     d_horzFormattingProperty;
00390         static StaticTextProperties::VertScrollbar      d_vertScrollbarProperty;
00391         static StaticTextProperties::HorzScrollbar      d_horzScrollbarProperty;
00392 
00393 
00394         /*************************************************************************
00395                 Private methods
00396         *************************************************************************/
00397         void    addStaticTextProperties(void);
00398 };
00399 
00400 } // End of  CEGUI namespace section
00401 
00402 #if defined(_MSC_VER)
00403 #       pragma warning(pop)
00404 #endif
00405 
00406 #endif  // end of guard _CEGUIStaticText_h_

Generated on Wed Feb 16 12:41:07 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1