ScummVM API documentation
command_bar.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
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 3 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, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef NUVIE_CORE_COMMAND_BAR_H
23#define NUVIE_CORE_COMMAND_BAR_H
24
25#include "common/str.h"
26#include "ultima/nuvie/gui/widgets/gui_widget.h"
27#include "ultima/nuvie/misc/call_back.h"
28
29namespace Ultima {
30namespace Nuvie {
31
32class NuvieIO;
33class Events;
34class Game;
35class GUI_Button;
36class GUI_CallBack;
37class Font;
38class U6Shape;
39
40#define COMMANDBAR_USE_BUTTON 1
41#define COMMANDBAR_ACTION_BUTTON 3
42
43/* U6 command buttons.
44 * [Attack][Cast][Talk][Look][Get][Drop][Move][Use][Rest][Combat]
45 * Left click: New action if none is pending.
46 * Right click: Set default action.
47 * Information: [A]M-DD-YYYY Wind: W[B]
48 */
49class CommandBar: public GUI_Widget, public CallBack {
50protected:
51 Game *game;
52 Events *event;
53 Font *font;
54 const Tile *icon[13];
55 U6Shape *background; // used to display the WoU command bar backgrounds
56
57 U6Shape *lever_up; // The lever in the up state (MD only)
58 U6Shape *lever_down; // The lever in the down state (MD only)
59
60 sint8 selected_action; // underlined icon (-1 = none)
61 sint8 active_action_num; // the last action that was activated (for MD levers)
62 bool combat_mode; // state of combat icon
63 Common::String wind; // wind direction
64 void fill_square(uint8 pal_index);
65
66 uint8 bg_color, font_color;
67 uint16 offset;
68
69 virtual void display_information();
70 virtual GUI_status hit(uint8 num);
71
72public:
73 CommandBar();
74 CommandBar(Game *g);
75 ~CommandBar() override;
76 virtual bool init_buttons();
77
78 void Display(bool full_redraw) override;
79 GUI_status MouseDown(int x, int y, Events::MouseButton button) override;
80 void update() {
81 update_display = true;
82 }
83
84 void select_action(sint8 activate);
85 void set_combat_mode(bool mode);
86// void set_wind(Common::String dir) { wind = dir; update_display = true; }
87 void set_selected_action(sint8 action) {
88 selected_action = action;
89 update_display = true;
90 }
91 bool try_selected_action(sint8 command_num = -1);
92 sint8 get_selected_action() const {
93 return selected_action;
94 }
95
96 // Called when a mode is being changed from here
97 // *or* keyboard - so MD can update levers
98 void on_new_action(EventMode action);
99
100 GUI_status callback(uint16 msg, GUI_CallBack *caller, void *data) override {
101 return GUI_PASS;
102 }
103 uint16 callback(uint16 msg, CallBack *caller, void *data) override;
104 bool load(NuvieIO *objlist);
105 bool save(NuvieIO *objlist);
106 bool drag_accept_drop(int x, int y, int message, void *data) override; // needed for !orig_style
107 void drag_perform_drop(int x, int y, int message, void *data) override; // needed for !orig_style
108};
109
110} // End of namespace Nuvie
111} // End of namespace Ultima
112
113#endif
Definition: str.h:59
Definition: call_back.h:50
Definition: command_bar.h:49
Definition: events.h:183
Definition: font.h:42
Definition: gui_callback.h:31
Definition: gui_widget.h:38
Definition: game.h:72
Definition: nuvie_io.h:32
Definition: u6_shape.h:47
Definition: tile_manager.h:113