gui/dialogs/editor_resize_map.hpp

Go to the documentation of this file.
00001 /* $Id: editor_resize_map.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
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_DIALOGS_EDITOR_RESIZE_MAP_HPP_INCLUDED
00017 #define GUI_DIALOGS_EDITOR_RESIZE_MAP_HPP_INCLUDED
00018 
00019 #include "gui/dialogs/dialog.hpp"
00020 
00021 namespace gui2 {
00022 
00023 class ttoggle_button;
00024 
00025 class teditor_resize_map : public tdialog
00026 {
00027 public:
00028     enum EXPAND_DIRECTION {
00029         EXPAND_BOTTOM_RIGHT,
00030         EXPAND_BOTTOM,
00031         EXPAND_BOTTOM_LEFT,
00032         EXPAND_RIGHT,
00033         EXPAND_CENTER,
00034         EXPAND_LEFT,
00035         EXPAND_TOP_RIGHT,
00036         EXPAND_TOP,
00037         EXPAND_TOP_LEFT
00038     };
00039 
00040     /**
00041      * Constructor.
00042      *
00043      * @param width [in]          The initial width of the map.
00044      * @param width [out]         The selected width of the map if the dialog
00045      *                            returns @ref twindow::OK undefined otherwise.
00046      *
00047      * @param height [in]         The initial height of the map.
00048      * @param height [out]        The selected height of the map if the dialog
00049      *                            returns @ref twindow::OK undefined otherwise.
00050      *
00051      * @param expand_direction [out]
00052      *                            The selected expand direction if the dialog
00053      *                            returns  @ref twindow::OK undefined
00054      *                            otherwise.
00055      *
00056      * @param copy_edge_terrain [in]
00057      *                            The initial value of the copy edge toggle.
00058      * @param copy_edge_terrain [out]
00059      *                            The final value of the copy edge toggle if
00060      *                            the dialog returns  @ref twindow::OK
00061      *                            undefined otherwise.
00062      */
00063     teditor_resize_map(
00064               int& width
00065             , int& height
00066             , EXPAND_DIRECTION& expand_direction
00067             , bool& copy_edge_terrain);
00068 
00069     /** The excute function see @ref tdialog for more information. */
00070     static bool execute(
00071               int& width
00072             , int& height
00073             , EXPAND_DIRECTION& expand_direction
00074             , bool& copy_edge_terrain
00075             , CVideo& video)
00076     {
00077         return teditor_resize_map(
00078                   width
00079                 , height
00080                 , expand_direction
00081                 , copy_edge_terrain).show(video);
00082     }
00083 
00084 private:
00085 
00086     /** The currently selected width. */
00087     tfield_integer* width_;
00088 
00089     /** The currently selected height. */
00090     tfield_integer* height_;
00091 
00092     /** The original width. */
00093     int old_width_;
00094 
00095     /** The original height. */
00096     int old_height_;
00097 
00098     /** The selected expansion direction. */
00099     EXPAND_DIRECTION& expand_direction_;
00100 
00101     /**
00102      * The toggle buttons show the state of expand_direction_.
00103      *
00104      * Allows both so select a direction and visually show the effect of the
00105      * selection.
00106      */
00107     ttoggle_button* direction_buttons_[9];
00108 
00109     void update_expand_direction(twindow& window);
00110 
00111     void set_direction_icon(int index, std::string icon);
00112 
00113     /** Inherited from tdialog */
00114     void pre_show(CVideo& video, twindow& window);
00115 
00116     /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
00117     virtual const std::string& window_id() const;
00118 };
00119 
00120 } // namespace gui2
00121 
00122 #endif
00123 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:02:42 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs