CEGUIStaticText.h

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 CEGUIEXPORT 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                 HorzJustified,                  
00065                 WordWrapLeftAligned,    
00066                 WordWrapRightAligned,   
00067                 WordWrapCentred,                
00068                 WordWrapJustified               
00069         };
00070 
00071 
00076         enum VertFormatting
00077         {
00078                 TopAligned,             
00079                 BottomAligned,  
00080                 VertCentred     
00081         };
00082 
00083 
00084         /*************************************************************************
00085                 Construction and Destruction
00086         *************************************************************************/
00091         StaticText(const String& type, const String& name);
00092 
00093 
00098         virtual ~StaticText(void);
00099 
00100 
00101         /*************************************************************************
00102                 Accessors
00103         *************************************************************************/
00111         ColourRect      getTextColours(void) const              {return d_textCols;}
00112 
00113         
00121         HorzFormatting  getHorizontalFormatting(void) const             {return d_horzFormatting;}
00122 
00123 
00131         VertFormatting  getVerticalFormatting(void) const               {return d_vertFormatting;}
00132 
00133 
00142         bool    isVerticalScrollbarEnabled(void) const;
00143 
00144 
00153         bool    isHorizontalScrollbarEnabled(void) const;
00154 
00155 
00156         // overridden (again) so scroll bars are not clipped when they are active
00157         virtual Rect    getUnclippedInnerRect(void) const;
00158 
00159 
00160         /*************************************************************************
00161                 Manipulators
00162         *************************************************************************/
00173         virtual void    initialise(void);
00174 
00175 
00186         void    setTextColours(const ColourRect& colours);
00187 
00188 
00208         void    setTextColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
00209 
00210 
00221         void    setTextColours(const colour& col)               {setTextColours(col, col, col, col);}
00222 
00223 
00237         void    setFormatting(HorzFormatting h_fmt, VertFormatting v_fmt);
00238 
00239 
00250         void    setVerticalFormatting(VertFormatting v_fmt);
00251 
00252 
00263         void    setHorizontalFormatting(HorzFormatting h_fmt);
00264 
00265 
00274         void    setVerticalScrollbarEnabled(bool setting);
00275 
00276 
00285         void    setHorizontalScrollbarEnabled(bool setting);
00286 
00287 
00288 protected:
00289         /*************************************************************************
00290                 Overridden from base class
00291         *************************************************************************/
00292         virtual void populateRenderCache();
00293 
00294 
00295         /*************************************************************************
00296                 Overridden events
00297         *************************************************************************/
00298         virtual void    onTextChanged(WindowEventArgs& e);
00299         virtual void    onSized(WindowEventArgs& e);
00300         virtual void    onFontChanged(WindowEventArgs& e);
00301         virtual void    onMouseWheel(MouseEventArgs& e);
00302 
00303 
00304         /*************************************************************************
00305                 Implementation methods
00306         *************************************************************************/
00315         virtual Rect    getTextRenderArea(void) const;
00316 
00317 
00322         void    configureScrollbars(void);
00323 
00324 
00335         virtual bool    testClassName_impl(const String& class_name) const
00336         {
00337                 if (class_name==(const utf8*)"StaticText")      return true;
00338                 return Static::testClassName_impl(class_name);
00339         }
00340 
00341 
00342         /*************************************************************************
00343                 Implementation Methods (abstract)
00344         *************************************************************************/
00355         virtual Scrollbar*      createVertScrollbar(const String& name) const           = 0;
00356  
00357 
00368         virtual Scrollbar*      createHorzScrollbar(const String& name) const           = 0;
00369 
00370 
00371         /*************************************************************************
00372                 Event subscribers
00373         *************************************************************************/
00374         bool    handleScrollbarChange(const EventArgs& e);
00375 
00376 
00377         /*************************************************************************
00378                 Implementation Data
00379         *************************************************************************/
00380         HorzFormatting  d_horzFormatting;               
00381         VertFormatting  d_vertFormatting;               
00382         ColourRect              d_textCols;                             
00383         Scrollbar*              d_vertScrollbar;                
00384         Scrollbar*              d_horzScrollbar;                
00385         bool                    d_enableVertScrollbar;  
00386         bool                    d_enableHorzScrollbar;  
00387 
00388 private:
00389         /*************************************************************************
00390                 Static Properties for this class
00391         *************************************************************************/
00392         static StaticTextProperties::TextColours        d_textColoursProperty;
00393         static StaticTextProperties::VertFormatting     d_vertFormattingProperty;
00394         static StaticTextProperties::HorzFormatting     d_horzFormattingProperty;
00395         static StaticTextProperties::VertScrollbar      d_vertScrollbarProperty;
00396         static StaticTextProperties::HorzScrollbar      d_horzScrollbarProperty;
00397 
00398 
00399         /*************************************************************************
00400                 Private methods
00401         *************************************************************************/
00402         void    addStaticTextProperties(void);
00403 };
00404 
00405 } // End of  CEGUI namespace section
00406 
00407 #if defined(_MSC_VER)
00408 #       pragma warning(pop)
00409 #endif
00410 
00411 #endif  // end of guard _CEGUIStaticText_h_

Generated on Sat Nov 26 09:34:49 2005 for Crazy Eddies GUI System by  doxygen 1.4.5