22 #ifndef CONSOLE_DIALOG_H 23 #define CONSOLE_DIALOG_H 25 #include "gui/dialog.h" 26 #include "common/str.h" 30 class ScrollBarWidget;
66 typedef bool (*InputCallbackProc)(
ConsoleDialog *console,
const char *input,
void *refCon);
72 kBufferSize = kCharsPerLine * 1024,
80 char _buffer[kBufferSize];
88 int _firstLineInBuffer;
95 uint32 _selectionTime;
103 SlideMode _slideMode;
110 InputCallbackProc _callbackProc;
111 void *_callbackRefCon;
114 CompletionCallbackProc _completionCallbackProc;
115 void *_completionCallbackRefCon;
125 float _widthPercent, _heightPercent;
132 void slideUpAndClose();
141 int _scrollDirection;
147 void open()
override;
148 void close()
override;
149 void drawDialog(DrawLayer layerToDraw)
override;
151 void handleTickle()
override;
152 void reflowLayout()
override;
153 void handleMouseWheel(
int x,
int y,
int direction)
override;
155 void handleCommand(
CommandSender *sender, uint32 cmd, uint32 data)
override;
157 void handleMouseDown(
int x,
int y,
int button,
int clickCount)
override;
158 void handleMouseMoved(
int x,
int y,
int button)
override;
159 void handleMouseUp(
int x,
int y,
int button,
int clickCount)
override;
161 int printFormat(
int dummy, MSVC_PRINTF
const char *format, ...)
GCC_PRINTF(3, 4);
162 int vprintFormat(
int dummy,
const char *format, va_list argptr);
164 void printChar(
int c);
166 void setInputCallback(InputCallbackProc proc,
void *refCon) {
167 _callbackProc = proc;
168 _callbackRefCon = refCon;
170 void setCompletionCallback(CompletionCallbackProc proc,
void *refCon) {
171 _completionCallbackProc = proc;
172 _completionCallbackRefCon = refCon;
175 int getCharsPerLine() {
184 inline char &buffer(
int idx) {
185 return _buffer[idx % kBufferSize];
190 int pos2line(
int pos) {
return (pos - (_scrollLine - _linesPerPage + 1) * kCharsPerLine) / kCharsPerLine; }
192 void drawLine(
int line);
193 void drawCaret(
bool erase);
194 void printCharIntern(
int c);
195 void insertIntoPrompt(
const char *str);
196 void print(
const char *str);
197 void updateScrollBuffer();
198 void scrollToCurrent();
204 void specialKeys(Common::KeyCode keycode);
212 void historyScroll(
int direction);
int FORCEINLINE GCC_PRINTF(2, 0) int vsprintf_s(T(&dst)[N]
Definition: keyboard.h:294
void drawDialog(DrawLayer layerToDraw) override