00001 /************************************************************************ 00002 filename: CEGUIRenderableElement.h 00003 created: 14/4/2004 00004 author: Paul D Turner 00005 00006 purpose: Interface for base class of a 'higher-level' renderable 00007 UI entity. 00008 *************************************************************************/ 00009 /************************************************************************* 00010 Crazy Eddie's GUI System (http://www.cegui.org.uk) 00011 Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk) 00012 00013 This library is free software; you can redistribute it and/or 00014 modify it under the terms of the GNU Lesser General Public 00015 License as published by the Free Software Foundation; either 00016 version 2.1 of the License, or (at your option) any later version. 00017 00018 This library is distributed in the hope that it will be useful, 00019 but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00021 Lesser General Public License for more details. 00022 00023 You should have received a copy of the GNU Lesser General Public 00024 License along with this library; if not, write to the Free Software 00025 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00026 *************************************************************************/ 00027 #ifndef _CEGUIRenderableElement_h_ 00028 #define _CEGUIRenderableElement_h_ 00029 00030 #include "CEGUIBase.h" 00031 #include "CEGUISystem.h" 00032 #include "CEGUIColourRect.h" 00033 #include "CEGUIVector.h" 00034 00035 // Start of CEGUI namespace section 00036 namespace CEGUI 00037 { 00042 class CEGUIBASE_API RenderableElement 00043 { 00044 public: 00045 /************************************************************************* 00046 Drawing methods 00047 *************************************************************************/ 00059 void draw(const Vector3& position, const Rect& clip_rect); 00060 00061 00062 /************************************************************************* 00063 Accessors 00064 *************************************************************************/ 00072 RenderableElement* getNextElement(void) const {return d_next;} 00073 00074 00082 ColourRect getColours(void) const {return d_colours;} 00083 00084 00094 Point getPosition(void) const {return Point(d_area.d_left, d_area.d_top);} 00095 00096 00104 Size getSize(void) const {return Size(d_area.getWidth(), d_area.getHeight());} 00105 00106 00114 Rect getRect(void) const {return d_area;} 00115 00116 00126 bool isColourRectPerImage(bool setting) {return d_useColoursPerImage;} 00127 00128 00129 /************************************************************************* 00130 Manipulators 00131 *************************************************************************/ 00146 void setNextElement(RenderableElement* element) {d_next = element;} 00147 00148 00159 void setColours(const ColourRect& colours) {d_colours = colours;} 00160 00161 00181 void setColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour); 00182 00183 00196 void setPosition(const Point& position) {d_area.setPosition(position);} 00197 00198 00206 void setSize(const Size& size) {d_area.setSize(size);} 00207 00208 00219 void setRect(const Rect& area) {d_area = area;} 00220 00221 00234 void setColourRectPerImage(bool setting) {d_useColoursPerImage = setting;} 00235 00236 00237 /************************************************************************* 00238 Construction / Destruction 00239 *************************************************************************/ 00244 RenderableElement(void); 00245 00246 00247 00252 virtual ~RenderableElement(void); 00253 00254 00255 protected: 00256 /************************************************************************* 00257 Implementation methods 00258 *************************************************************************/ 00272 virtual void draw_impl(const Vector3& position, const Rect& clip_rect) const = 0; 00273 00274 00275 /************************************************************************* 00276 Implementation Data 00277 *************************************************************************/ 00278 RenderableElement* d_next; 00279 ColourRect d_colours; 00280 Rect d_area; 00281 bool d_useColoursPerImage; 00282 }; 00283 00284 } // End of CEGUI namespace section 00285 00286 00287 #endif // end of guard _CEGUIRenderableElement_h_