Crazy Eddies GUI System: CEGUIFalDimensions.h Source File

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

# CEGUIFalDimensions.h

    00001 /************************************************************************
    00002     filename:   CEGUIFalDimensions.h
    00003     created:    Mon Jun 13 2005
    00004     author:     Paul D Turner <paul@cegui.org.uk>
    00005 *************************************************************************/
    00006 /*************************************************************************
    00007     Crazy Eddie's GUI System (http://www.cegui.org.uk)
    00008     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
    00009
    00010     This library is free software; you can redistribute it and/or
    00011     modify it under the terms of the GNU Lesser General Public
    00012     License as published by the Free Software Foundation; either
    00013     version 2.1 of the License, or (at your option) any later version.
    00014
    00015     This library is distributed in the hope that it will be useful,
    00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00018     Lesser General Public License for more details.
    00019
    00020     You should have received a copy of the GNU Lesser General Public
    00021     License along with this library; if not, write to the Free Software
    00022     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00023 *************************************************************************/
    00024 #ifndef _CEGUIFalDimensions_h_
    00025 #define _CEGUIFalDimensions_h_
    00026
    00027 #include "falagard/CEGUIFalEnums.h"
    00028 #include "CEGUIString.h"
    00029 #include "CEGUIUDim.h"
    00030
    00031 // Start of CEGUI namespace section
    00032 namespace CEGUI
    00033 {
    00038     class CEGUIEXPORT BaseDim
    00039     {
    00040     public:
    00041         BaseDim();
    00042
    00043         virtual ~BaseDim();
    00044
    00056         float getValue(const Window& wnd) const;
    00057
    00075         float getValue(const Window& wnd, const Rect& container) const;
    00076
    00089         BaseDim* clone() const;
    00090
    00099         DimensionOperator getDimensionOperator() const;
    00100
    00112         void setDimensionOperator(DimensionOperator op);
    00113
    00121         const BaseDim* getOperand() const;
    00122
    00134         void setOperand(const BaseDim& operand);
    00135
    00146         void writeXMLToStream(OutStream& out_stream) const;
    00147
    00148     protected:
    00154         virtual float getValue_impl(const Window& wnd) const = 0;
    00155
    00161         virtual float getValue_impl(const Window& wnd, const Rect& container) const = 0;
    00162
    00169         virtual BaseDim* clone_impl() const = 0;
    00170
    00177         virtual void writeXMLElementName_impl(OutStream& out_stream) const = 0;
    00178
    00185         virtual void writeXMLElementAttributes_impl(OutStream& out_stream) const = 0;
    00186
    00187     private:
    00188         DimensionOperator   d_operator;
    00189         BaseDim*            d_operand;
    00190     };
    00191
    00192
    00197     class CEGUIEXPORT AbsoluteDim : public BaseDim
    00198     {
    00199     public:
    00207         AbsoluteDim(float val);
    00208
    00213         void setValue(float val);
    00214
    00215     protected:
    00216         // Implementation of the base class interface
    00217         float getValue_impl(const Window& wnd) const;
    00218         float getValue_impl(const Window& wnd, const Rect& container) const;
    00219         void writeXMLElementName_impl(OutStream& out_stream) const;
    00220         void writeXMLElementAttributes_impl(OutStream& out_stream) const;
    00221
    00222         BaseDim* clone_impl() const;
    00223
    00224     private:
    00225         float d_val;
    00226     };
    00227
    00228
    00233     class CEGUIEXPORT ImageDim : public BaseDim
    00234     {
    00235     public:
    00250         ImageDim(const String& imageset, const String& image, DimensionType dim);
    00251
    00265         void setSourceImage(const String& imageset, const String& image);
    00266
    00278         void setSourceDimension(DimensionType dim);
    00279
    00280     protected:
    00281         // Implementation of the base class interface
    00282         float getValue_impl(const Window& wnd) const;
    00283         float getValue_impl(const Window& wnd, const Rect& container) const;
    00284         void writeXMLElementName_impl(OutStream& out_stream) const;
    00285         void writeXMLElementAttributes_impl(OutStream& out_stream) const;
    00286         BaseDim* clone_impl() const;
    00287
    00288     private:
    00289         String d_imageset;
    00290         String d_image;
    00291         DimensionType d_what;
    00292     };
    00293
    00294
    00304     class CEGUIEXPORT WidgetDim : public BaseDim
    00305     {
    00306     public:
    00318         WidgetDim(const String& name, DimensionType dim);
    00319
    00330         void setWidgetName(const String& name);
    00331
    00343         void setSourceDimension(DimensionType dim);
    00344
    00345     protected:
    00346         // Implementation of the base class interface
    00347         float getValue_impl(const Window& wnd) const;
    00348         float getValue_impl(const Window& wnd, const Rect& container) const;
    00349         void writeXMLElementName_impl(OutStream& out_stream) const;
    00350         void writeXMLElementAttributes_impl(OutStream& out_stream) const;
    00351         BaseDim* clone_impl() const;
    00352
    00353     private:
    00354         String d_widgetName;
    00355         DimensionType d_what;
    00356     };
    00357
    00358
    00363     class CEGUIEXPORT UnifiedDim : public BaseDim
    00364     {
    00365     public:
    00378         UnifiedDim(const UDim& value, DimensionType dim);
    00379
    00380     protected:
    00381         // Implementation of the base class interface
    00382         float getValue_impl(const Window& wnd) const;
    00383         float getValue_impl(const Window& wnd, const Rect& container) const;
    00384         void writeXMLElementName_impl(OutStream& out_stream) const;
    00385         void writeXMLElementAttributes_impl(OutStream& out_stream) const;
    00386         BaseDim* clone_impl() const;
    00387
    00388     private:
    00389         UDim d_value;
    00390         DimensionType d_what;
    00391     };
    00392
    00397     class CEGUIEXPORT FontDim : public BaseDim
    00398     {
    00399     public:
    00422         FontDim(const String& name, const String& font, const String& text, FontMetricType metric, float padding = 0);
    00423
    00424     protected:
    00425         // Implementation of the base class interface
    00426         float getValue_impl(const Window& wnd) const;
    00427         float getValue_impl(const Window& wnd, const Rect& container) const;
    00428         void writeXMLElementName_impl(OutStream& out_stream) const;
    00429         void writeXMLElementAttributes_impl(OutStream& out_stream) const;
    00430         BaseDim* clone_impl() const;
    00431
    00432     private:
    00433         String  d_font;
    00434         String  d_text;
    00435         String  d_childSuffix;
    00436         FontMetricType d_metric;
    00437         float   d_padding;
    00438     };
    00439
    00444     class CEGUIEXPORT PropertyDim : public BaseDim
    00445     {
    00446     public:
    00458         PropertyDim(const String& name, const String& property);
    00459
    00460     protected:
    00461         // Implementation of the base class interface
    00462         float getValue_impl(const Window& wnd) const;
    00463         float getValue_impl(const Window& wnd, const Rect& container) const;
    00464         void writeXMLElementName_impl(OutStream& out_stream) const;
    00465         void writeXMLElementAttributes_impl(OutStream& out_stream) const;
    00466         BaseDim* clone_impl() const;
    00467
    00468     private:
    00469         String d_property;
    00470         String  d_childSuffix;
    00471     };
    00472
    00481     class CEGUIEXPORT Dimension
    00482     {
    00483     public:
    00488         Dimension();
    00489
    00494         ~Dimension();
    00495
    00506         Dimension(const BaseDim& dim, DimensionType type);
    00507
    00512         Dimension(const Dimension& other);
    00513
    00518         Dimension& operator=(const Dimension& other);
    00519
    00527         const BaseDim& getBaseDimension() const;
    00528
    00539         void setBaseDimension(const BaseDim& dim);
    00540
    00548         DimensionType getDimensionType() const;
    00549
    00560         void setDimensionType(DimensionType type);
    00561
    00572         void writeXMLToStream(OutStream& out_stream) const;
    00573
    00574     private:
    00575         BaseDim*        d_value;
    00576         DimensionType   d_type;
    00577     };
    00578
    00579
    00589     class CEGUIEXPORT ComponentArea
    00590     {
    00591     public:
    00603         Rect getPixelRect(const Window& wnd) const;
    00604
    00619         Rect getPixelRect(const Window& wnd, const Rect& container) const;
    00620
    00631         void writeXMLToStream(OutStream& out_stream) const;
    00632
    00641         bool isAreaFetchedFromProperty() const;
    00642
    00650         const String& getAreaPropertySource() const;
    00651
    00662         void setAreaPropertySource(const String& property);
    00663
    00664
    00665         Dimension d_left;
    00666         Dimension d_top;
    00667         Dimension d_right_or_width;
    00668         Dimension d_bottom_or_height;
    00669
    00670     private:
    00671         String  d_areaProperty;
    00672     };
    00673
    00674 } // End of  CEGUI namespace section
    00675
    00676
    00677 #endif  // end of guard _CEGUIFalDimensions_h_