-
Notifications
You must be signed in to change notification settings - Fork 17
/
CommandBar.h
91 lines (80 loc) · 2.85 KB
/
CommandBar.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef __CommandBar_h__
#define __CommandBar_h__
/*
* CommandBar.h
* Nuvie
*
* Created by Joseph Applegate on Wed Mar 2 2005.
* Copyright (c) 2005 The Nuvie Team. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <string>
#include "GUI_widget.h"
#include "CallBack.h"
class NuvieIO;
class Event;
class Game;
class GUI_Button;
class GUI_CallBack;
class Font;
class U6Shape;
#define COMMANDBAR_USE_BUTTON 1
#define COMMANDBAR_ACTION_BUTTON 3
/* U6 command buttons.
* [Attack][Cast][Talk][Look][Get][Drop][Move][Use][Rest][Combat]
* Left click: New action if none is pending.
* Right click: Set default action.
* Information: [A]M-DD-YYYY Wind: W[B]
*/
class CommandBar: public GUI_Widget, public CallBack
{
protected:
Game *game;
Event *event;
Font *font;
Tile *icon[13];
U6Shape *background; // used to display the WoU command bar backgrounds
sint8 selected_action; // underlined icon (-1 = none)
bool combat_mode; // state of combat icon
std::string wind; // wind direction
void fill_square(uint8 pal_index);
uint8 bg_color, font_color;
uint16 offset;
virtual void display_information();
virtual GUI_status hit(uint8 num);
public:
CommandBar();
CommandBar(Game *g);
~CommandBar();
virtual bool init_buttons();
virtual void Display(bool full_redraw);
virtual GUI_status MouseDown(int x, int y, int button);
void update() { update_display = true; }
void select_action(sint8 activate);
void set_combat_mode(bool mode);
// void set_wind(std::string dir) { wind = dir; update_display = true; }
void set_selected_action(sint8 action) { selected_action = action;
update_display = true; }
bool try_selected_action(sint8 command_num = -1);
sint8 get_selected_action() { return selected_action;}
uint16 callback(uint16 msg, CallBack *caller, void * data);
bool load(NuvieIO *objlist);
bool save(NuvieIO *objlist);
bool drag_accept_drop(int x, int y, int message, void *data); // needed for !orig_style
void drag_perform_drop(int x, int y, int message, void *data); // needed for !orig_style
};
#endif /* __CommandBar_h__ */