1 /************************************************************************
2  *                                                                      *
3  *  FreeSynd - a remake of the classic Bullfrog game "Syndicate".       *
4  *                                                                      *
5  *   Copyright (C) 2005  Stuart Binge  <skbinge@gmail.com>              *
6  *   Copyright (C) 2005  Joost Peters  <joostp@users.sourceforge.net>   *
7  *   Copyright (C) 2006  Trent Waddington <qg@biodome.org>              *
8  *   Copyright (C) 2006  Tarjei Knapstad <tarjei.knapstad@gmail.com>    *
9  *   Copyright (C) 2010  Benoit Blancard <benblan@users.sourceforge.net>*
10  *                                                                      *
11  *    This program is free software;  you can redistribute it and / or  *
12  *  modify it  under the  terms of the  GNU General  Public License as  *
13  *  published by the Free Software Foundation; either version 2 of the  *
14  *  License, or (at your option) any later version.                     *
15  *                                                                      *
16  *    This program is  distributed in the hope that it will be useful,  *
17  *  but WITHOUT  ANY WARRANTY;  without even  the implied  warranty of  *
18  *  MERCHANTABILITY  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  *
19  *  General Public License for more details.                            *
20  *                                                                      *
21  *    You can view the GNU  General Public License, online, at the GNU  *
22  *  project's  web  site;  see <http://www.gnu.org/licenses/gpl.html>.  *
23  *  The full text of the license is also included in the file COPYING.  *
24  *                                                                      *
25  ************************************************************************/
26 
27 #ifndef CONFMENU_H
28 #define CONFMENU_H
29 
30 #include "menus/menu.h"
31 /*!
32  * Configuration Menu class.
33  */
34 class ConfMenu : public Menu {
35 public:
36     ConfMenu(MenuManager *m);
37     ~ConfMenu();
38 
39     virtual void handleRender(DirtyList &dirtyList);
40     void handleShow();
41     void handleLeave();
42 
43     void handleAction(const int actionId, void *ctx, const int modKeys);
44 
45 protected:
46 
47     bool handleUnknownKey(Key key, const int modKeys);
48 
49     void createPanels();
50     void showLogoPanel();
51     void showUserNamePanel();
52     void showCompanyNamePanel();
53     void showMainPanel();
54     void hideMainPanel();
55 
redrawLogo()56     void redrawLogo() { addDirtyRect(28, 22, 150, 110); }
redrawPanel()57     void redrawPanel() { addDirtyRect(278, 20, 340 , 135); }
58 
59 protected:
60     /*!
61      * This enum identifies the panel which is currently displayed.
62      */
63     enum EPanel {
64         PNL_MAIN = 0,
65         PNL_LOGO = 1,
66         PNL_USRNM = 2,
67         PNL_CMPNM = 3
68     };
69 
70     /*! This array holds the values for drawing a frame
71      *  around the ok and cancel button in the sub panels. */
72     uint8 butFrameData_[68 * 13];
73     /*! This array holds the values for drawing a frame
74      *  around the textfield in the user and company name panels. */
75     uint8 tfFrameData_[136 * 13];
76 
77     /*! keep track of the current panel.*/
78     EPanel currPanel_;
79     /*! Button to open the change logo panel.*/
80     int logoButId_;
81     /*! Button to open the change company name panel.*/
82     int compNameButId_;
83     /*! Button to open the change user name panel.*/
84     int userNameButId_;
85     /*! Button in the main window to accept change.*/
86     int acceptButId_;
87     /*! Button in the main window to cancel change.*/
88     int menuButId_;
89     int panelMsgId_;
90 
91     // Logo Panel
92     int leftColButId_;
93     int rightColButId_;
94     int leftLogoButId_;
95     int rightLogoButId_;
96     int logoStaticId_;
97     int colStaticId_;
98 
99     // Change names panel
100     TextField *pUserNameTF_;
101     TextField *pCompNameTF_;
102 
103     // Common buttons
104     int okButId_;
105     int cancelButId_;
106 
107     /*! Id of the menu text that stores the username that will be accepted.*/
108     int toAcceptUsrNameTxtId_;
109     /*! Id of the menu text that stores the company name that will be accepted.*/
110     int toAcceptCmpNameTxtId_;
111     int toAcceptLogo_;
112     int toAcceptColourId_;
113     int tempLogo_;
114     int tempColourId_;
115 };
116 
117 #endif
118