00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "gui/widgets/panel.hpp"
00016
00017 #include "log.hpp"
00018
00019 #define DBG_G LOG_STREAM_INDENT(debug, gui)
00020 #define LOG_G LOG_STREAM_INDENT(info, gui)
00021 #define WRN_G LOG_STREAM_INDENT(warn, gui)
00022 #define ERR_G LOG_STREAM_INDENT(err, gui)
00023
00024 #define DBG_G_D LOG_STREAM_INDENT(debug, gui_draw)
00025 #define LOG_G_D LOG_STREAM_INDENT(info, gui_draw)
00026 #define WRN_G_D LOG_STREAM_INDENT(warn, gui_draw)
00027 #define ERR_G_D LOG_STREAM_INDENT(err, gui_draw)
00028
00029 #define DBG_G_E LOG_STREAM_INDENT(debug, gui_event)
00030 #define LOG_G_E LOG_STREAM_INDENT(info, gui_event)
00031 #define WRN_G_E LOG_STREAM_INDENT(warn, gui_event)
00032 #define ERR_G_E LOG_STREAM_INDENT(err, gui_event)
00033
00034 #define DBG_G_P LOG_STREAM_INDENT(debug, gui_parse)
00035 #define LOG_G_P LOG_STREAM_INDENT(info, gui_parse)
00036 #define WRN_G_P LOG_STREAM_INDENT(warn, gui_parse)
00037 #define ERR_G_P LOG_STREAM_INDENT(err, gui_parse)
00038
00039 namespace gui2 {
00040
00041 void tpanel::draw(surface& surface)
00042 {
00043
00044 const bool is_dirty = dirty();
00045
00046 tcontainer_::draw(surface);
00047
00048
00049 if(is_dirty) {
00050 SDL_Rect rect = get_rect();
00051 canvas(1).draw(true);
00052 blit_surface(canvas(1).surf(), 0, surface, &rect);
00053 }
00054 }
00055
00056 SDL_Rect tpanel::get_client_rect() const
00057 {
00058 const tpanel_definition::tresolution* conf =
00059 dynamic_cast<const tpanel_definition::tresolution*>(config());
00060 assert(conf);
00061
00062 SDL_Rect result = get_rect();
00063 result.x += conf->left_border;
00064 result.y += conf->top_border;
00065 result.w -= conf->left_border + conf->right_border;
00066 result.h -= conf->top_border + conf->bottom_border;
00067
00068 return result;
00069 }
00070
00071 tpoint tpanel::border_space() const
00072 {
00073 const tpanel_definition::tresolution* conf =
00074 dynamic_cast<const tpanel_definition::tresolution*>(config());
00075 assert(conf);
00076
00077 return tpoint(conf->left_border + conf->right_border,
00078 conf->top_border + conf->bottom_border);
00079 }
00080
00081 }
00082