00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #if !defined(_XRB_WIDGETBACKGROUND_HPP_)
00012 #define _XRB_WIDGETBACKGROUND_HPP_
00013
00014 #include "xrb.hpp"
00015
00016 #include "xrb_color.hpp"
00017 #include "xrb_gltexture.hpp"
00018 #include "xrb_rect.hpp"
00019 #include "xrb_rendercontext.hpp"
00020 #include "xrb_resourcelibrary.hpp"
00021 #include "xrb_vector.hpp"
00022
00023 namespace Xrb
00024 {
00025
00032 class WidgetBackground
00033 {
00034 public:
00035
00036 WidgetBackground () { }
00037 virtual ~WidgetBackground () { }
00038
00042 virtual WidgetBackground *CreateClone () const = 0;
00043
00052 virtual void Draw (
00053 RenderContext const &render_context,
00054 ScreenCoordRect const &widget_screen_rect,
00055 ScreenCoordVector2 const &frame_margins) const = 0;
00056 };
00057
00061 class WidgetBackgroundColored : public WidgetBackground
00062 {
00063 public:
00064
00068 WidgetBackgroundColored (
00069 Color const &color)
00070 :
00071 WidgetBackground()
00072 {
00073 m_color = color;
00074 }
00076 virtual ~WidgetBackgroundColored () { }
00077
00081 virtual WidgetBackground *CreateClone () const;
00082
00089 virtual void Draw (
00090 RenderContext const &render_context,
00091 ScreenCoordRect const &widget_screen_rect,
00092 ScreenCoordVector2 const &frame_margins) const;
00093
00094 private:
00095
00096 Color m_color;
00097 };
00098
00102 class WidgetBackgroundTextured : public WidgetBackground
00103 {
00104 public:
00105
00109 WidgetBackgroundTextured (std::string const &texture_path);
00113 WidgetBackgroundTextured (Resource<GLTexture> const &texture);
00117 virtual ~WidgetBackgroundTextured ();
00118
00122 virtual WidgetBackground *CreateClone () const;
00123
00131 virtual void Draw (
00132 RenderContext const &render_context,
00133 ScreenCoordRect const &widget_screen_rect,
00134 ScreenCoordVector2 const &frame_margins) const;
00135
00136 private:
00137
00138 Resource<GLTexture> m_texture;
00139 };
00140
00179 class WidgetBackgroundStylized : public WidgetBackground
00180 {
00181 public:
00182
00189 WidgetBackgroundStylized (
00190 std::string const &corner_texture_name,
00191 std::string const &top_texture_name,
00192 std::string const &left_texture_name,
00193 std::string const ¢er_texture_name);
00204 WidgetBackgroundStylized (
00205 Resource<GLTexture> const &corner_texture,
00206 Resource<GLTexture> const &top_texture,
00207 Resource<GLTexture> const &left_texture,
00208 Resource<GLTexture> const ¢er_texture);
00213 virtual ~WidgetBackgroundStylized ();
00214
00218 virtual WidgetBackground *CreateClone () const;
00219
00229 virtual void Draw (
00230 RenderContext const &render_context,
00231 ScreenCoordRect const &widget_screen_rect,
00232 ScreenCoordVector2 const &frame_margins) const;
00233
00234 private:
00235
00236 Resource<GLTexture> m_corner_texture;
00237 Resource<GLTexture> m_top_texture;
00238 Resource<GLTexture> m_left_texture;
00239 Resource<GLTexture> m_center_texture;
00240 };
00241
00242 }
00243
00244 #endif // !defined(_XRB_WIDGETBACKGROUND_HPP_)
00245