sources/interface.h

branch
protocol5
changeset 106
7b156b764d11
parent 103
b78c0ca832a9
parent 105
b4466472aecd
child 131
4996c8684b93
equal deleted inserted replaced
104:a76af67a3a4b 106:7b156b764d11
31 #pragma once 31 #pragma once
32 #include "main.h" 32 #include "main.h"
33 #include "network/ipaddress.h" 33 #include "network/ipaddress.h"
34 #include "coloredline.h" 34 #include "coloredline.h"
35 #include "network/rconsession.h" 35 #include "network/rconsession.h"
36 #include "coloredline.h"
37
38 BEGIN_ZFC_NAMESPACE
36 39
37 class Interface 40 class Interface
38 { 41 {
39 public: 42 public:
40 enum InputState 43 enum InputState
55 void set_player_names (const StringList& names); 58 void set_player_names (const StringList& names);
56 void need_refresh(); 59 void need_refresh();
57 void tab_complete (const String& part, String complete); 60 void tab_complete (const String& part, String complete);
58 RCONSession* get_session() { return &Session; } 61 RCONSession* get_session() { return &Session; }
59 void disconnected(); 62 void disconnected();
63 void handle_command(const String& input);
60 64
61 void vprint (const char* fmtstr, va_list args); 65 void vprint (const char* fmtstr, va_list args);
62 void __cdecl print (const char* fmtstr, ...); 66 void __cdecl print (const char* fmtstr, ...);
63 void __cdecl print_warning (const char* fmtstr, ...); 67 void __cdecl print_warning (const char* fmtstr, ...);
64 void __cdecl print_error (const char* fmtstr, ...); 68 void __cdecl print_error (const char* fmtstr, ...);
65 69
66 private: 70 private:
67 StringList InputHistory; 71 StringList InputHistory;
68 int InputCursor = 0; 72 int InputCursor;
69 int CursorPosition = 0; 73 int CursorPosition;
70 int InputPanning = 0; 74 int InputPanning;
71 bool NeedRefresh = false; 75 bool NeedRefresh;
72 bool NeedStatusBarRender = false; 76 bool NeedStatusBarRender;
73 bool NeedInputRender = false; 77 bool NeedInputRender;
74 bool NeedOutputRender = false; 78 bool NeedOutputRender;
75 bool NeedNicklistRender = false; 79 bool NeedNicklistRender;
76 struct { char ch; int x; } CursorCharacter; 80 struct { char ch; int x; } CursorCharacter;
77 Vector<ColoredLine> OutputLines; 81 Vector<ColoredLine> OutputLines;
78 int OutputScroll = 0; 82 int OutputScroll;
79 String Title; 83 String Title;
80 InputState CurrentInputState = INPUTSTATE_NORMAL; 84 InputState CurrentInputState;
81 Function<void (void)> DisconnectConfirmFunction = nullptr; 85 std::function<void (void)> DisconnectConfirmFunction;
82 IPAddress CurrentAddress; 86 IPAddress CurrentAddress;
83 String StatusBarText; 87 String StatusBarText;
84 StringList PlayerNames; 88 StringList PlayerNames;
85 String PasteBuffer; 89 String PasteBuffer;
86 RCONSession Session; 90 RCONSession Session;
87 91
88 void render_titlebar(); 92 void render_titlebar();
89 void safe_disconnect (Function<void()> afterwards); 93 void safe_disconnect (std::function<void()> afterwards);
90 int render_colorline (int y, int x0, int width, const ColoredLine& line, bool allowWrap); 94 int render_colorline (int y, int x0, int width, const ColoredLine& line, bool allowWrap);
91 int nicklist_width(); 95 int nicklist_width();
92 void render_output(); 96 void render_output();
93 void render_nicklist(); 97 void render_nicklist();
94 void render_input(); 98 void render_input();
95 void render_statusbar(); 99 void render_statusbar();
96 void position_cursor(); 100 void position_cursor();
97 int color_pair (Color fg, Color bg); 101 chtype color_pair (Color fg, Color bg);
98 const String& current_input(); 102 const String& current_input();
99 void detach_input(); 103 void detach_input();
100 String& mutable_current_input(); 104 String& mutable_current_input();
101 void move_input_cursor (int delta); 105 void move_input_cursor (int delta);
102 String prompt_string(); 106 String prompt_string();
103 void set_input_state (InputState newstate); 107 void set_input_state (InputState newstate);
104 void print_to_console (String a); 108 void print_to_console (String message);
105 void yank (int a, int b); 109 void yank (int a, int b);
106 int find_previous_word(); 110 int find_previous_word();
107 int find_next_word(); 111 int find_next_word();
108 }; 112 };
113
114 END_ZFC_NAMESPACE

mercurial