00001 #ifndef GUI_BACKDROP_HPP
00002 #define GUI_BACKDROP_HPP
00003
00004 #include <utils.hpp>
00005 #include "gui_sprite.hpp"
00006
00007 namespace gui
00008 {
00009 class frame;
00010
00012 class backdrop
00013 {
00014 public :
00015
00016 enum edge_type
00017 {
00018 EDGE_LEFT,
00019 EDGE_RIGHT,
00020 EDGE_TOP,
00021 EDGE_BOTTOM,
00022 EDGE_TOPLEFT,
00023 EDGE_TOPRIGHT,
00024 EDGE_BOTTOMLEFT,
00025 EDGE_BOTTOMRIGHT
00026 };
00027
00029
00031 explicit backdrop(frame* pParent);
00032
00034
00036 void copy_from(const backdrop& mbackdrop);
00037
00039
00041 void set_background(const std::string& sBackgroundFile);
00042
00044
00046 const std::string& get_background_file() const;
00047
00049
00053 void set_background_color(const color& mColor);
00054
00056
00058 color get_background_color() const;
00059
00061
00063 void set_backgrond_tilling(bool bBackgroundTilling);
00064
00066
00068 bool is_background_tilling() const;
00069
00071
00074 void set_tile_size(uint uiTileSize);
00075
00077
00079 uint get_tile_size() const;
00080
00082
00085 void set_background_insets(const std::array<int,4>& lInsets);
00086
00088
00093 void set_background_insets(int iLeft, int iRight, int iTop, int iBottom);
00094
00096
00098 const std::array<int,4>& get_background_insets() const;
00099
00101
00104 void set_edge_insets(const std::array<int,4>& lInsets);
00105
00107
00112 void set_edge_insets(int iLeft, int iRight, int iTop, int iBottom);
00113
00115
00117 const std::array<int,4>& get_edge_insets() const;
00118
00120
00133 void set_edge(const std::string& sEdgeFile);
00134
00136
00138 const std::string& get_edge_file() const;
00139
00141
00145 void set_edge_color(const color& mColor);
00146
00148
00150 color get_edge_color() const;
00151
00153
00156 void set_edge_size(uint uiEdgeSize);
00157
00159
00161 uint get_edge_size() const;
00162
00164
00166 void set_vertex_color(const color& mColor);
00167
00169 void render() const;
00170
00171 private :
00172
00173 frame* pParent_;
00174 std::string sBackgroundFile_;
00175 std::string sEdgeFile_;
00176 color mBackgroundColor_;
00177 color mEdgeColor_;
00178
00179 mutable utils::refptr<sprite> pBackground_;
00180 mutable std::array<utils::refptr<sprite>,8> lEdgeList_;
00181
00182 bool bBackgroundTilling_;
00183 uint uiTileSize_;
00184 uint uiOriginalTileSize_;
00185 std::array<int,4> lBackgroundInsets_;
00186 std::array<int,4> lEdgeInsets_;
00187 uint uiEdgeSize_;
00188 uint uiOriginalEdgeSize_;
00189 };
00190 }
00191
00192 #endif