gui/widgets/panel.hpp

Go to the documentation of this file.
00001 /* $Id: panel.hpp 54007 2012-04-28 19:16:10Z mordante $ */
00002 /*
00003    Copyright (C) 2008 - 2012 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 as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY.
00012 
00013    See the COPYING file for more details.
00014 */
00015 
00016 #ifndef GUI_WIDGETS_PANEL_HPP_INCLUDED
00017 #define GUI_WIDGETS_PANEL_HPP_INCLUDED
00018 
00019 #include "gui/widgets/container.hpp"
00020 
00021 namespace gui2 {
00022 
00023 /**
00024  * Visible container to hold multiple widgets.
00025  *
00026  * This widget can draw items beyond the widgets it holds and in front of them.
00027  * A panel is always active so these functions return dummy values.
00028  */
00029 class tpanel : public tcontainer_
00030 {
00031 
00032 public:
00033 
00034     /**
00035      * Constructor.
00036      *
00037      * @param canvas_count        The canvas count for tcontrol.
00038      */
00039     explicit tpanel(const unsigned canvas_count = 2) :
00040         tcontainer_(canvas_count)
00041     {
00042     }
00043 
00044     /**
00045      * Returns the client rect.
00046      *
00047      * The client rect is the area which is used for child items. The rest of
00048      * the area of this widget is used for its own decoration.
00049      *
00050      * @returns                   The client rect.
00051      */
00052     virtual SDL_Rect get_client_rect() const;
00053 
00054     /** Inherited from tcontrol. */
00055     bool get_active() const { return true; }
00056 
00057     /** Inherited from tcontrol. */
00058     unsigned get_state() const { return 0; }
00059 
00060 private:
00061 
00062     /** Inherited from tcontrol. */
00063     void impl_draw_background(surface& frame_buffer);
00064     void impl_draw_background(
00065               surface& frame_buffer
00066             , int x_offset
00067             , int y_offset);
00068 
00069     /** Inherited from tcontrol. */
00070     void impl_draw_foreground(surface& frame_buffer);
00071     void impl_draw_foreground(
00072               surface& frame_buffer
00073             , int x_offset
00074             , int y_offset);
00075 
00076     /** Inherited from tcontrol. */
00077     const std::string& get_control_type() const;
00078 
00079     /** Inherited from tcontainer_. */
00080     tpoint border_space() const;
00081 
00082     /** Inherited from tcontainer_. */
00083     void set_self_active(const bool /*active*/) {}
00084 
00085 };
00086 
00087 } // namespace gui2
00088 
00089 #endif
00090 
00091 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:55 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs