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

CEGUITextItem.h

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUITextItem.h
00003         created:        31/3/2005
00004         author:         Tomas Lindquist Olsen (based on code by Paul D Turner)
00005         
00006         purpose:        Interface to base class for TextItem 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 _CEGUITextItem_h_
00027 #define _CEGUITextItem_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "CEGUIWindow.h"
00031 #include "elements/CEGUIItemEntry.h"
00032 #include "elements/CEGUITextItemProperties.h"
00033 #include "CEGUIFont.h"
00034 
00035 
00036 #if defined(_MSC_VER)
00037 #       pragma warning(push)
00038 #       pragma warning(disable : 4251)
00039 #endif
00040 
00041 
00042 // Start of CEGUI namespace section
00043 namespace CEGUI
00044 {
00045 
00050 class CEGUIEXPORT TextItem : public ItemEntry
00051 {
00052 public:
00053         /*************************************************************************
00054                 Constants
00055         *************************************************************************/
00056         static const colour             DefaultTextColour;              
00057 
00058 
00059         /*************************************************************************
00060                 Accessors
00061         *************************************************************************/
00069         TextFormatting getTextFormatting() const                {return d_textFormatting;}
00070 
00071 
00081     float   getTextXOffset(void) const                          {return d_textXOffset;}
00082 
00083 
00091         colour getTextColour(void) const                        {return d_textColour;}
00092 
00093 
00094         /*************************************************************************
00095                 Manipulators
00096         *************************************************************************/
00101         void setTextFormatting(TextFormatting format)   {d_textFormatting=format;}
00102 
00103 
00111         void setTextColour(const colour& col)                   {d_textColour=col;}
00112 
00113 
00126     void   setTextXOffset(float offset)                         {d_textXOffset=offset;}
00127 
00128 
00129         /*************************************************************************
00130                 Pure functions from ItemEntry
00131         *************************************************************************/
00140         virtual Size getItemPixelSize(void);
00141 
00142 
00143         /*************************************************************************
00144                 Construction and Destruction
00145         *************************************************************************/
00150         TextItem(const String& type, const String& name);
00151 
00152 
00157         virtual ~TextItem(void);
00158 
00159 
00160 protected:
00161         /*************************************************************************
00162                 Abstract Implementation Functions (must be provided by derived class)
00163         *************************************************************************/
00164 
00165         /*************************************************************************
00166                 Overridden event handlers
00167         *************************************************************************/
00176         virtual void    onTextChanged(WindowEventArgs& e);
00177 
00178 
00179         /*************************************************************************
00180                 Implementation Functions
00181         *************************************************************************/
00182     virtual void populateRenderCache();
00183 
00184 
00195         virtual bool    testClassName_impl(const String& class_name) const
00196         {
00197                 if (class_name==(const utf8*)"TextItem")        return true;
00198                 return ItemEntry::testClassName_impl(class_name);
00199         }
00200 
00201 
00202         /*************************************************************************
00203                 Implementation Rendering Functions
00204         *************************************************************************/
00205 
00206         /*************************************************************************
00207                 Implementation Data
00208         *************************************************************************/
00209         colour d_textColour;                            
00210         TextFormatting d_textFormatting;        
00211 
00212         //text-offset
00213     float d_textXOffset;                
00214 
00215 
00216 private:
00217         /*************************************************************************
00218                 Static Properties for this class
00219         *************************************************************************/
00220         static TextItemProperties::TextColour           d_textColourProperty;
00221         static TextItemProperties::TextFormatting       d_textFormattingProperty;
00222         static TextItemProperties::TextXOffset          d_textXOffsetProperty;
00223 
00224         /*************************************************************************
00225                 Private methods
00226         *************************************************************************/
00227         void    addTextItemProperties(void);
00228 };
00229 
00230 } // End of  CEGUI namespace section
00231 
00232 
00233 #if defined(_MSC_VER)
00234 #       pragma warning(pop)
00235 #endif
00236 
00237 
00238 #endif  // end of guard _CEGUITextItem_h_

Generated on Wed Sep 7 09:56:34 2005 for Crazy Eddies GUI System by  doxygen 1.4.3