gui/widgets/minimap.hpp

Go to the documentation of this file.
00001 /* $Id: minimap.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_MINIMAP_HPP_INCLUDED
00017 #define GUI_WIDGETS_MINIMAP_HPP_INCLUDED
00018 
00019 #include "gui/widgets/control.hpp"
00020 
00021 class config;
00022 
00023 namespace gui2 {
00024 
00025 /**
00026  * The basic minimap class.
00027  *
00028  * This minimap can only show a minimap, but it can't be interacted with. For
00029  * that the tminimap_interactive class will be created.
00030  */
00031 class tminimap : public tcontrol
00032 {
00033 public:
00034     tminimap() :
00035         tcontrol(1),
00036         map_data_(),
00037         terrain_(NULL)
00038     {
00039     }
00040 
00041     /***** ***** ***** ***** Inherited ***** ***** ***** *****/
00042 
00043     /** Inherited from tcontrol. */
00044     void set_active(const bool /*active*/) {}
00045 
00046     /** Inherited from tcontrol. */
00047     bool get_active() const { return true; }
00048 
00049     /** Inherited from tcontrol. */
00050     unsigned get_state() const { return 0; }
00051 
00052     /** Inherited from tcontrol. */
00053     bool disable_click_dismiss() const { return false; }
00054 
00055     /***** ***** ***** setters / getters for members ***** ****** *****/
00056 
00057     void set_map_data(const std::string& map_data)
00058         { if(map_data != map_data_) { map_data_ = map_data; set_dirty(); } }
00059 
00060     std::string get_map_data() const { return map_data_; }
00061 
00062     const std::string& map_data() const { return map_data_; }
00063 
00064     void set_config(const ::config* terrain) { terrain_ = terrain; }
00065 
00066 private:
00067 
00068     /** The map data to be used to generate the map. */
00069     std::string map_data_;
00070 
00071     /**
00072      * The config object with the terrain data.
00073      *
00074      * This config must be set before the object can be drawn.
00075      */
00076     const ::config* terrain_;
00077 
00078     /**
00079      * Gets the image for the minimap.
00080      *
00081      * @param w                   The wanted width of the image.
00082      * @param h                   The wanted height of the image.
00083      *
00084      * @returns                   The image, NULL upon error.
00085      */
00086     const surface get_image(const int w, const int h) const;
00087 
00088     /** Inherited from tcontrol. */
00089     void impl_draw_background(surface& frame_buffer);
00090     void impl_draw_background(
00091               surface& frame_buffer
00092             , int x_offset
00093             , int y_offset);
00094 
00095     /** Inherited from tcontrol. */
00096     const std::string& get_control_type() const;
00097 };
00098 
00099 } // namespace gui2
00100 
00101 #endif
00102 
 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