ScummVM API documentation
scroll_widget_gump.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_VIEWS_SCROLL_WIDGET_GUMP_H
23 #define NUVIE_VIEWS_SCROLL_WIDGET_GUMP_H
24 
25 #include "ultima/nuvie/misc/call_back.h"
26 #include "ultima/nuvie/gui/widgets/gui_widget.h"
27 #include "ultima/nuvie/gui/widgets/msg_scroll.h"
28 #include "ultima/nuvie/fonts/font.h"
29 #include "ultima/shared/std/containers.h"
30 #include "ultima/shared/std/string.h"
31 
32 namespace Ultima {
33 namespace Nuvie {
34 
35 using Std::list;
36 
37 
38 class Configuration;
39 class Actor;
40 class CallBack;
41 
42 typedef enum {
43  SCROLL_UP,
44  SCROLL_DOWN,
45  SCROLL_PAGE_UP,
46  SCROLL_PAGE_DOWN,
47  SCROLL_ESCAPE,
48  SCROLL_TO_BEGINNING,
49  SCROLL_TO_END
50 } ScrollEventType;
51 
52 static const int SCROLLWIDGETGUMP_W = 200;
53 static const int SCROLLWIDGETGUMP_H = 100;
54 
55 class ScrollWidgetGump: public MsgScroll {
56 
57  Font *font_normal;
58  Font *font_garg;
59 
60  uint8 font_color;
61  uint8 font_highlight;
62  uint16 position;
63 
64  Std::string trailing_whitespace;
65 
66  bool show_up_arrow;
67  bool show_down_arrow;
68 
69 public:
70 
71  ScrollWidgetGump(const Configuration *cfg, Screen *s);
72  ~ScrollWidgetGump() override;
73 
74  bool parse_token(MsgText *token) override;
75 
76  bool can_display_prompt() const override {
77  return false;
78  }
79 
80  void Display(bool full_redraw) override;
81 
82  void display_prompt() override {}
83  void display_string(const Std::string &s);
84  void display_string(const Std::string &s, Font *f, bool include_on_map_window) override {
85  return MsgScroll::display_string(s, f, include_on_map_window);
86  }
87 
88  void set_font(uint8 font_type) override;
89  bool is_garg_font() override;
90 
91  bool can_fit_token_on_msgline(MsgLine *msg_line, MsgText *token) override;
92 
93  GUI_status KeyDown(const Common::KeyState &key) override;
94  GUI_status MouseDown(int x, int y, Shared::MouseButton button) override;
95  GUI_status MouseUp(int x, int y, Shared::MouseButton button) override {
96  return GUI_YUM; // otherwise we do Msgscroll::MouseUp
97  }
98  GUI_status MouseWheel(sint32 x, sint32 y) override;
99 
100  void move_scroll_down() override {
101  scroll_movement_event(SCROLL_DOWN);
102  }
103  void move_scroll_up() override {
104  scroll_movement_event(SCROLL_UP);
105  }
106 
107 
108 private:
109  const Common::Rect arrow_up_rect;
110  const Common::Rect arrow_down_rect;
111 
112  GUI_status scroll_movement_event(ScrollEventType event);
113  void update_arrows();
114 };
115 
116 } // End of namespace Nuvie
117 } // End of namespace Ultima
118 
119 #endif
Definition: msg_scroll.h:93
Definition: configuration.h:61
Definition: scroll_widget_gump.h:55
Definition: list.h:39
Definition: rect.h:144
Definition: msg_scroll.h:75
Definition: screen.h:41
Definition: detection.h:27
Definition: string.h:30
Definition: msg_scroll.h:54
Definition: keyboard.h:294
Definition: font.h:42