1 /***************************************************************************
2  *   Copyright (C) 2009 by Andrey Afletdinov <fheroes2@gmail.com>          *
3  *                                                                         *
4  *   Part of the Free Heroes2 Engine:                                      *
5  *   http://sourceforge.net/projects/fheroes2                              *
6  *                                                                         *
7  *   This program is free software; you can redistribute it and/or modify  *
8  *   it under the terms of the GNU General Public License as published by  *
9  *   the Free Software Foundation; either version 2 of the License, or     *
10  *   (at your option) any later version.                                   *
11  *                                                                         *
12  *   This program is distributed in the hope that it will be useful,       *
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
15  *   GNU General Public License for more details.                          *
16  *                                                                         *
17  *   You should have received a copy of the GNU General Public License     *
18  *   along with this program; if not, write to the                         *
19  *   Free Software Foundation, Inc.,                                       *
20  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
21  ***************************************************************************/
22 
23 #ifndef H2INTERFACE_CPANEL_H
24 #define H2INTERFACE_CPANEL_H
25 
26 #include "game_mode.h"
27 #include "math_base.h"
28 
29 #include <memory>
30 
31 namespace fheroes2
32 {
33     class Sprite;
34 }
35 
36 namespace Interface
37 {
38     class Basic;
39 
40     class ControlPanel : protected fheroes2::Rect
41     {
42     public:
43         explicit ControlPanel( Basic & );
44 
45         void SetPos( int32_t, int32_t );
46         void Redraw( void ) const;
47         void ResetTheme( void );
48         fheroes2::GameMode QueueEventProcessing();
49 
50         const fheroes2::Rect & GetArea( void ) const;
51 
52     private:
53         Basic & interface;
54 
55         // We do not want to make a copy of images but to store just references to them.
56         struct Buttons
57         {
ButtonsButtons58             Buttons( const fheroes2::Sprite & radar_, const fheroes2::Sprite & icon_, const fheroes2::Sprite & button_, const fheroes2::Sprite & stats_,
59                      const fheroes2::Sprite & quit_ )
60                 : radar( radar_ )
61                 , icon( icon_ )
62                 , button( button_ )
63                 , stats( stats_ )
64                 , quit( quit_ )
65             {}
66 
67             const fheroes2::Sprite & radar;
68             const fheroes2::Sprite & icon;
69             const fheroes2::Sprite & button;
70             const fheroes2::Sprite & stats;
71             const fheroes2::Sprite & quit;
72         };
73 
74         std::unique_ptr<Buttons> _buttons;
75 
76         fheroes2::Rect rt_radr;
77         fheroes2::Rect rt_icon;
78         fheroes2::Rect rt_bttn;
79         fheroes2::Rect rt_stat;
80         fheroes2::Rect rt_quit;
81     };
82 }
83 
84 #endif
85