22 #ifndef NUVIE_CORE_MSG_SCROLL_H 23 #define NUVIE_CORE_MSG_SCROLL_H 25 #include "ultima/nuvie/misc/call_back.h" 26 #include "ultima/nuvie/gui/widgets/gui_widget.h" 28 #define MSGSCROLL_U6_WIDTH 17 29 #define MSGSCROLL_U6_HEIGHT 10 31 #define MSGSCROLL_MD_WIDTH 16 32 #define MSGSCROLL_MD_HEIGHT 8 34 #define MSGSCROLL_SE_WIDTH 16 35 #define MSGSCROLL_SE_HEIGHT 8 37 #define MSGSCROLL_CURSOR_DELAY 6 // used to slow down the animated cursor 39 #define MSGSCROLL_SCROLLBACK_HEIGHT 100 41 #define MSGSCROLL_NO_MAP_DISPLAY false 66 uint16 getDisplayWidth();
67 bool operator<(
const MsgText &rhs)
const {
86 MsgText *get_text_at_pos(uint16 pos);
87 uint16 get_display_width();
96 uint8 font_highlight_color;
103 char *callback_user_data;
106 const char *permit_input;
107 bool yes_no_only, aye_nay_only, numbers_only;
110 bool just_finished_page_break;
111 bool just_displayed_prompt;
112 virtual void process_page_break();
116 bool permit_inputescape;
120 uint16 scrollback_height;
121 bool discard_whitespace;
122 bool using_target_cursor;
131 bool keyword_highlight;
141 uint16 cursor_x, cursor_y;
147 bool capitalise_next_letter;
153 config(
nullptr), game_type(0), font(
nullptr), scroll_height(0),
154 scroll_width(0), callback_target(
nullptr), callback_user_data(
nullptr),
155 input_mode(
false), permit_input(
nullptr), page_break(
false),
156 just_finished_page_break(
false), permit_inputescape(
false),
157 cursor_wait(0), screen_x(0), screen_y(0), bg_color(0),
158 keyword_highlight(
true), talking(
false), show_cursor(
false),
159 autobreak(
false), scroll_updated(
false), cursor_char(0),
160 cursor_x(0), cursor_y(0), line_count(0), display_pos(0),
161 capitalise_next_letter(
false), just_displayed_prompt(
false),
162 scrollback_height(MSGSCROLL_SCROLLBACK_HEIGHT), discard_whitespace(
false),
163 left_margin(0), font_color(0), font_highlight_color(0), input_char(0),
164 yes_no_only(
false), aye_nay_only(
false), numbers_only(
false),
165 using_target_cursor(
false) {
171 bool init(
const char *player_name);
174 virtual void move_scroll_down();
175 virtual void move_scroll_up();
176 void set_using_target_cursor(
bool val) {
177 using_target_cursor = val;
180 void process_holding_buffer();
182 MsgText *holding_buffer_get_token();
183 bool is_holding_buffer_empty()
const {
184 return holding_buffer.
empty();
186 virtual bool can_display_prompt()
const {
187 return !just_displayed_prompt;
190 virtual bool parse_token(
MsgText *token);
191 void add_token(
MsgText *token);
194 virtual void set_font(uint8 font_type);
195 virtual bool is_garg_font();
197 template<
class... TParam>
200 virtual void display_string(
const Common::String &s,
Font *f,
bool include_on_map_window);
201 void display_string(
const Common::String &s,
Font *f, uint8 color,
bool include_on_map_window);
202 void display_string(
const Common::String &s, uint16 length, uint8 lang_num);
203 void display_string(
const Common::String &s,
bool include_on_map_window =
true);
204 void display_string(
const Common::String &s, uint8 color,
bool include_on_map_window);
205 void display_fmt_string(
const char *format, ...);
206 void message(
const char *
string) {
207 display_string(
string);
211 bool set_prompt(
const char *new_prompt,
Font *f =
nullptr);
212 virtual void display_prompt();
213 virtual void display_converse_prompt();
215 void set_keyword_highlight(
bool state);
217 void set_input_mode(
bool state,
const char *allowed =
nullptr,
218 bool can_escape =
true,
bool use_target_cursor =
false,
219 bool set_numbers_only_to_true =
false);
220 virtual void set_talking(
bool state,
Actor *actor =
nullptr) {
224 bool is_talking()
const {
227 void set_show_cursor(
bool state) {
231 void set_autobreak(
bool state) {
234 void set_discard_whitespace(
bool discard) {
235 discard_whitespace = discard;
238 bool get_page_break()
const {
243 GUI_status MouseUp(
int x,
int y, Events::MouseButton button)
override;
244 GUI_status MouseWheel(sint32 x, sint32 y)
override;
245 virtual Common::String get_token_string_at_pos(uint16 x, uint16 y);
247 void Display(
bool full_redraw)
override;
249 void clearCursor(uint16 x, uint16 y);
250 virtual void drawCursor(uint16 x, uint16 y);
252 void set_page_break();
254 virtual bool input_buf_add_char(
char c);
255 virtual bool input_buf_remove_char();
258 virtual bool is_converse_finished() {
264 const char *peek_at_input();
265 void request_input(
CallBack *caller,
void *user_data);
266 void cancel_input_request() {
267 request_input(
nullptr,
nullptr);
273 void set_scroll_dimensions(uint16 w, uint16 h);
274 void delete_front_line();
275 virtual MsgLine *add_new_line();
276 void drawLine(
Screen *screen,
MsgLine *msg_line, uint16 line_y);
277 inline void clear_page_break();
279 virtual void set_permitted_input(
const char *allowed);
280 virtual void clear_permitted_input();
281 virtual bool can_fit_token_on_msgline(
MsgLine *msg_line,
MsgText *token);
282 void increase_input_char();
283 void decrease_input_char();
284 uint8 get_char_from_input_char();
285 virtual uint8 get_input_font_color()
const {
293 template<
class... TParam>
294 inline int MsgScroll::print(
const Common::String &format, TParam... param) {
295 return print_internal(&format, Common::forward<TParam>(param)...);
Definition: configuration.h:60
Definition: msg_scroll.h:72
Definition: detection.h:27
Definition: call_back.h:50
Definition: msg_scroll.h:51
Definition: keyboard.h:294
bool empty() const
Definition: list.h:258