container.cpp

Go to the documentation of this file.
00001 /* $Id: container.cpp 26774 2008-05-22 16:30:51Z mordante $ */
00002 /*
00003    copyright (C) 2008 by mark de wever <koraq@xs4all.nl>
00004    part of the battle for wesnoth project http://www.wesnoth.org/
00005 
00006    this program is free software; you can redistribute it and/or modify
00007    it under the terms of the gnu general public license version 2
00008    or at your option any later version.
00009    this program is distributed in the hope that it will be useful,
00010    but without any warranty.
00011 
00012    see the copying file for more details.
00013 */
00014 
00015 #include "gui/widgets/container.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 
00040 namespace gui2 {
00041 
00042 void tcontainer_::draw(surface& surface)
00043 {
00044     // Inherited.
00045     tcontrol::draw(surface);
00046 
00047     grid_.draw(surface);
00048 }
00049 
00050 tpoint tcontainer_::get_minimum_size() const
00051 {
00052     tpoint size = grid_.get_maximum_size();
00053     tpoint border_size = border_space();
00054 
00055     if(size.x) {
00056         size.x += border_size.x;
00057     }
00058 
00059     if(size.y) {
00060         size.y += border_size.y;
00061     }
00062 
00063     return size;
00064 }
00065 
00066 tpoint tcontainer_::get_best_size() const
00067 {
00068     tpoint size = grid_.get_best_size();
00069     tpoint border_size = border_space();
00070 
00071     if(size.x) {
00072         size.x += border_size.x;
00073     }
00074 
00075     if(size.y) {
00076         size.y += border_size.y;
00077     }
00078 
00079     return size;
00080 }
00081 
00082 } // namespace gui2
00083 

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs