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" 27 #include "ultima/shared/std/containers.h" 29 #define MSGSCROLL_U6_WIDTH 17 30 #define MSGSCROLL_U6_HEIGHT 10 32 #define MSGSCROLL_MD_WIDTH 16 33 #define MSGSCROLL_MD_HEIGHT 8 35 #define MSGSCROLL_SE_WIDTH 16 36 #define MSGSCROLL_SE_HEIGHT 8 38 #define MSGSCROLL_CURSOR_DELAY 6 // used to slow down the animated cursor 40 #define MSGSCROLL_SCROLLBACK_HEIGHT 100 42 #define MSGSCROLL_NO_MAP_DISPLAY false 67 uint16 getDisplayWidth();
68 bool operator<(
const MsgText &rhs)
const {
87 MsgText *get_text_at_pos(uint16 pos);
88 uint16 get_display_width();
97 uint8 font_highlight_color;
104 char *callback_user_data;
107 const char *permit_input;
108 bool yes_no_only, aye_nay_only, numbers_only;
111 bool just_finished_page_break;
112 bool just_displayed_prompt;
113 virtual void process_page_break();
117 bool permit_inputescape;
121 uint16 scrollback_height;
122 bool discard_whitespace;
123 bool using_target_cursor;
132 bool keyword_highlight;
142 uint16 cursor_x, cursor_y;
148 bool capitalise_next_letter;
154 config(
nullptr), game_type(0), font(
nullptr), scroll_height(0),
155 scroll_width(0), callback_target(
nullptr), callback_user_data(
nullptr),
156 input_mode(
false), permit_input(
nullptr), page_break(
false),
157 just_finished_page_break(
false), permit_inputescape(
false),
158 cursor_wait(0), screen_x(0), screen_y(0), bg_color(0),
159 keyword_highlight(
true), talking(
false), show_cursor(
false),
160 autobreak(
false), scroll_updated(
false), cursor_char(0),
161 cursor_x(0), cursor_y(0), line_count(0), display_pos(0),
162 capitalise_next_letter(
false), just_displayed_prompt(
false),
163 scrollback_height(MSGSCROLL_SCROLLBACK_HEIGHT), discard_whitespace(
false),
164 left_margin(0), font_color(0), font_highlight_color(0), input_char(0),
165 yes_no_only(
false), aye_nay_only(
false), numbers_only(
false),
166 using_target_cursor(
false) {
172 bool init(
const char *player_name);
175 virtual void move_scroll_down();
176 virtual void move_scroll_up();
177 void set_using_target_cursor(
bool val) {
178 using_target_cursor = val;
181 void process_holding_buffer();
183 MsgText *holding_buffer_get_token();
184 bool is_holding_buffer_empty()
const {
185 return holding_buffer.
empty();
187 virtual bool can_display_prompt()
const {
188 return !just_displayed_prompt;
191 virtual bool parse_token(
MsgText *token);
192 void add_token(
MsgText *token);
195 virtual void set_font(uint8 font_type);
196 virtual bool is_garg_font();
198 template<
class... TParam>
201 virtual void display_string(
const Common::String &s,
Font *f,
bool include_on_map_window);
202 void display_string(
const Common::String &s,
Font *f, uint8 color,
bool include_on_map_window);
203 void display_string(
const Common::String &s, uint16 length, uint8 lang_num);
204 void display_string(
const Common::String &s,
bool include_on_map_window =
true);
205 void display_string(
const Common::String &s, uint8 color,
bool include_on_map_window);
206 void display_fmt_string(
const char *format, ...);
207 void message(
const char *
string) {
208 display_string(
string);
212 bool set_prompt(
const char *new_prompt,
Font *f =
nullptr);
213 virtual void display_prompt();
214 virtual void display_converse_prompt();
216 void set_keyword_highlight(
bool state);
218 void set_input_mode(
bool state,
const char *allowed =
nullptr,
219 bool can_escape =
true,
bool use_target_cursor =
false,
220 bool set_numbers_only_to_true =
false);
221 virtual void set_talking(
bool state,
Actor *actor =
nullptr) {
225 bool is_talking()
const {
228 void set_show_cursor(
bool state) {
232 void set_autobreak(
bool state) {
235 void set_discard_whitespace(
bool discard) {
236 discard_whitespace = discard;
239 bool get_page_break()
const {
244 GUI_status MouseUp(
int x,
int y, Events::MouseButton button)
override;
245 GUI_status MouseWheel(sint32 x, sint32 y)
override;
246 virtual Common::String get_token_string_at_pos(uint16 x, uint16 y);
248 void Display(
bool full_redraw)
override;
250 void clearCursor(uint16 x, uint16 y);
251 virtual void drawCursor(uint16 x, uint16 y);
253 void set_page_break();
255 virtual bool input_buf_add_char(
char c);
256 virtual bool input_buf_remove_char();
259 virtual bool is_converse_finished() {
265 const char *peek_at_input();
266 void request_input(
CallBack *caller,
void *user_data);
267 void cancel_input_request() {
268 request_input(
nullptr,
nullptr);
274 void set_scroll_dimensions(uint16 w, uint16 h);
275 void delete_front_line();
276 virtual MsgLine *add_new_line();
277 void drawLine(
Screen *screen,
MsgLine *msg_line, uint16 line_y);
278 inline void clear_page_break();
280 virtual void set_permitted_input(
const char *allowed);
281 virtual void clear_permitted_input();
282 virtual bool can_fit_token_on_msgline(
MsgLine *msg_line,
MsgText *token);
283 void increase_input_char();
284 void decrease_input_char();
285 uint8 get_char_from_input_char();
286 virtual uint8 get_input_font_color()
const {
294 template<
class... TParam>
295 inline int MsgScroll::print(
const Common::String &format, TParam... param) {
296 return print_internal(&format, Common::forward<TParam>(param)...);
Definition: configuration.h:61
Definition: msg_scroll.h:73
Definition: detection.h:27
Definition: call_back.h:50
Definition: msg_scroll.h:52
Definition: keyboard.h:294
bool empty() const
Definition: list.h:258