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 69 uint16 getDisplayWidth();
70 bool operator<(
const MsgText &rhs)
const {
89 MsgText *get_text_at_pos(uint16 pos);
90 uint16 get_display_width();
99 uint8 font_highlight_color;
100 uint16 scroll_height;
106 char *callback_user_data;
109 const char *permit_input;
110 bool yes_no_only, aye_nay_only, numbers_only;
113 bool just_finished_page_break;
114 bool just_displayed_prompt;
115 virtual void process_page_break();
119 bool permit_inputescape;
123 uint16 scrollback_height;
124 bool discard_whitespace;
125 bool using_target_cursor;
134 bool keyword_highlight;
144 uint16 cursor_x, cursor_y;
150 bool capitalise_next_letter;
156 config(
nullptr), game_type(0), font(
nullptr), scroll_height(0),
157 scroll_width(0), callback_target(
nullptr), callback_user_data(
nullptr),
158 input_mode(
false), permit_input(
nullptr), page_break(
false),
159 just_finished_page_break(
false), permit_inputescape(
false),
160 cursor_wait(0), screen_x(0), screen_y(0), bg_color(0),
161 keyword_highlight(
true), talking(
false), show_cursor(
false),
162 autobreak(
false), scroll_updated(
false), cursor_char(0),
163 cursor_x(0), cursor_y(0), line_count(0), display_pos(0),
164 capitalise_next_letter(
false), just_displayed_prompt(
false),
165 scrollback_height(MSGSCROLL_SCROLLBACK_HEIGHT), discard_whitespace(
false),
166 left_margin(0), font_color(0), font_highlight_color(0), input_char(0),
167 yes_no_only(
false), aye_nay_only(
false), numbers_only(
false),
168 using_target_cursor(
false) {
174 bool init(
const char *player_name);
177 virtual void move_scroll_down();
178 virtual void move_scroll_up();
179 void set_using_target_cursor(
bool val) {
180 using_target_cursor = val;
183 void process_holding_buffer();
185 MsgText *holding_buffer_get_token();
186 bool is_holding_buffer_empty()
const {
187 return holding_buffer.
empty();
189 virtual bool can_display_prompt()
const {
190 return !just_displayed_prompt;
193 virtual bool parse_token(
MsgText *token);
194 void add_token(
MsgText *token);
197 virtual void set_font(uint8 font_type);
198 virtual bool is_garg_font();
200 template<
class... TParam>
201 int print(
const Std::string &format, TParam... param);
203 virtual void display_string(
const Std::string &s,
Font *f,
bool include_on_map_window);
204 void display_string(
const Std::string &s,
Font *f, uint8 color,
bool include_on_map_window);
205 void display_string(
const Std::string &s, uint16 length, uint8 lang_num);
206 void display_string(
const Std::string &s,
bool include_on_map_window =
true);
207 void display_string(
const Std::string &s, uint8 color,
bool include_on_map_window);
208 void display_fmt_string(
const char *format, ...);
209 void message(
const char *
string) {
210 display_string(
string);
214 bool set_prompt(
const char *new_prompt,
Font *f =
nullptr);
215 virtual void display_prompt();
216 virtual void display_converse_prompt();
218 void set_keyword_highlight(
bool state);
220 void set_input_mode(
bool state,
const char *allowed =
nullptr,
221 bool can_escape =
true,
bool use_target_cursor =
false,
222 bool set_numbers_only_to_true =
false);
223 virtual void set_talking(
bool state,
Actor *actor =
nullptr) {
227 bool is_talking()
const {
230 void set_show_cursor(
bool state) {
234 void set_autobreak(
bool state) {
237 void set_discard_whitespace(
bool discard) {
238 discard_whitespace = discard;
241 bool get_page_break()
const {
246 GUI_status MouseUp(
int x,
int y, Shared::MouseButton button)
override;
247 GUI_status MouseWheel(sint32 x, sint32 y)
override;
248 virtual Std::string get_token_string_at_pos(uint16 x, uint16 y);
250 void Display(
bool full_redraw)
override;
252 void clearCursor(uint16 x, uint16 y);
253 virtual void drawCursor(uint16 x, uint16 y);
255 void set_page_break();
257 virtual bool input_buf_add_char(
char c);
258 virtual bool input_buf_remove_char();
261 virtual bool is_converse_finished() {
267 const char *peek_at_input();
268 void request_input(
CallBack *caller,
void *user_data);
269 void cancel_input_request() {
270 request_input(
nullptr,
nullptr);
276 void set_scroll_dimensions(uint16 w, uint16 h);
277 void delete_front_line();
278 virtual MsgLine *add_new_line();
279 void drawLine(
Screen *screen,
MsgLine *msg_line, uint16 line_y);
280 inline void clear_page_break();
282 virtual void set_permitted_input(
const char *allowed);
283 virtual void clear_permitted_input();
284 virtual bool can_fit_token_on_msgline(
MsgLine *msg_line,
MsgText *token);
285 void increase_input_char();
286 void decrease_input_char();
287 uint8 get_char_from_input_char();
288 virtual uint8 get_input_font_color()
const {
293 int print_internal(
const Std::string *format, ...);
296 template<
class... TParam>
297 inline int MsgScroll::print(
const Std::string &format, TParam... param) {
298 return print_internal(&format, Common::forward<TParam>(param)...);
Definition: configuration.h:61
Definition: msg_scroll.h:75
Definition: detection.h:27
Definition: call_back.h:50
Definition: msg_scroll.h:54
Definition: containers.h:200
Definition: keyboard.h:294
bool empty() const
Definition: list.h:219