Crazy Eddie's GUI System  0.8.7
RenderedStringComponent.h
1 /***********************************************************************
2  created: 24/05/2009
3  author: Paul Turner
4  *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  ***************************************************************************/
27 #ifndef _CEGUIRenderedStringComponent_h_
28 #define _CEGUIRenderedStringComponent_h_
29 
30 #include "CEGUI/Size.h"
31 #include "CEGUI/Rect.h"
32 #include "CEGUI/falagard/Enums.h"
33 
34 #if defined(_MSC_VER)
35 # pragma warning(push)
36 # pragma warning(disable : 4251)
37 #endif
38 
39 // Start of CEGUI namespace section
40 namespace CEGUI
41 {
47 class CEGUIEXPORT RenderedStringComponent :
48  public AllocatedObject<RenderedStringComponent>
49 {
50 public:
53 
59  void setPadding(const Rectf& padding);
61  void setLeftPadding(const float padding);
63  void setRightPadding(const float padding);
65  void setTopPadding(const float padding);
67  void setBottomPadding(const float padding);
69  const Rectf& getPadding() const;
71  float getLeftPadding() const;
73  float getRightPadding() const;
75  float getTopPadding() const;
77  float getBottomPadding() const;
79  void setAspectLock(const bool setting);
81  bool getAspectLock() const;
82 
84  virtual void draw(const Window* ref_wnd, GeometryBuffer& buffer,
85  const Vector2f& position, const ColourRect* mod_colours,
86  const Rectf* clip_rect, const float vertical_space,
87  const float space_extra) const = 0;
88 
90  virtual Sizef getPixelSize(const Window* ref_wnd) const = 0;
91 
93  virtual bool canSplit() const = 0;
94 
105  virtual RenderedStringComponent* split(const Window* ref_wnd,
106  float split_point,
107  bool first_component) = 0;
108 
110  virtual RenderedStringComponent* clone() const = 0;
111 
113  virtual size_t getSpaceCount() const = 0;
114 
116  virtual void setSelection(const Window* ref_wnd,
117  const float start, const float end) = 0;
118 
119 protected:
122 
131 };
132 
133 } // End of CEGUI namespace section
134 
135 #if defined(_MSC_VER)
136 # pragma warning(pop)
137 #endif
138 
139 #endif // end of guard _CEGUIRenderedStringComponent_h_
Definition: MemoryAllocatedObject.h:110
Class that holds details of colours for the four corners of a rectangle.
Definition: ColourRect.h:45
Abstract class defining the interface for objects that buffer geometry for later rendering.
Definition: GeometryBuffer.h:44
Interface for Image.
Definition: Image.h:161
Base class representing a part of a rendered string. The 'part' represented may be a text string,...
Definition: RenderedStringComponent.h:49
void setTopPadding(const float padding)
set the top padding value.
void setAspectLock(const bool setting)
set the aspect-lock state
virtual bool canSplit() const =0
return whether the component can be split
void setVerticalFormatting(VerticalFormatting fmt)
Set the VerticalFormatting option for this component.
void setLeftPadding(const float padding)
set the left padding value.
virtual ~RenderedStringComponent()
Destructor.
const Image * d_selectionImage
Image to draw for selection.
Definition: RenderedStringComponent.h:130
virtual RenderedStringComponent * split(const Window *ref_wnd, float split_point, bool first_component)=0
split the component as close to split_point as possible, returning a new RenderedStringComponent of t...
bool d_aspectLock
true if the aspect ratio should be maintained where possible.
Definition: RenderedStringComponent.h:128
float getLeftPadding() const
return the left padding value.
bool getAspectLock() const
return the aspect-lock state
RenderedStringComponent()
Protected constructor.
void setRightPadding(const float padding)
set the right padding value.
float getTopPadding() const
return the top padding value.
virtual void draw(const Window *ref_wnd, GeometryBuffer &buffer, const Vector2f &position, const ColourRect *mod_colours, const Rectf *clip_rect, const float vertical_space, const float space_extra) const =0
draw the component.
const Rectf & getPadding() const
return the current padding value Rect.
Rectf d_padding
Rect object holding the padding values for this component.
Definition: RenderedStringComponent.h:124
float getRightPadding() const
return the right padding value.
virtual RenderedStringComponent * clone() const =0
clone this component.
void setPadding(const Rectf &padding)
set the padding values.
VerticalFormatting d_verticalFormatting
Vertical formatting to be used for this component.
Definition: RenderedStringComponent.h:126
VerticalFormatting getVerticalFormatting() const
return the current VerticalFormatting option.
float getBottomPadding() const
return the bottom padding value.
virtual void setSelection(const Window *ref_wnd, const float start, const float end)=0
mark some region appropriate given /a start and /a end as selected.
virtual Sizef getPixelSize(const Window *ref_wnd) const =0
return the pixel size of the rendered component.
void setBottomPadding(const float padding)
set the Bottom padding value.
virtual size_t getSpaceCount() const =0
return the total number of spacing characters in the string.
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:151
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
VerticalFormatting
Enumeration of possible values to indicate the vertical formatting to be used for an image component.
Definition: Enums.h:59