ScummVM
GUI::ConsoleDialog Class Reference

#include <console.h>

+ Inheritance diagram for GUI::ConsoleDialog:
+ Collaboration diagram for GUI::ConsoleDialog:

Public Types

typedef bool(* InputCallbackProc) (ConsoleDialog *console, const char *input, void *refCon)
 
typedef bool(* CompletionCallbackProc) (ConsoleDialog *console, const char *input, Common::String &completion, void *refCon)
 

Public Member Functions

 ConsoleDialog (float widthPercent, float heightPercent)
 
void open () override
 
void close () override
 
void drawDialog (DrawLayer layerToDraw) override
 Draw the dialog in its entirety (background and widgets) More...
 
void handleTickle () override
 
void reflowLayout () override
 
void handleMouseWheel (int x, int y, int direction) override
 
void handleKeyDown (Common::KeyState state) override
 
void handleCommand (CommandSender *sender, uint32 cmd, uint32 data) override
 
int printFormat (int dummy, const char *format,...) GCC_PRINTF(3
 
int int vprintFormat (int dummy, const char *format, va_list argptr)
 
void printChar (int c)
 
void setInputCallback (InputCallbackProc proc, void *refCon)
 
void setCompletionCallback (CompletionCallbackProc proc, void *refCon)
 
int getCharsPerLine ()
 
- Public Member Functions inherited from GUI::Dialog
 Dialog (int x, int y, int w, int h)
 
 Dialog (const Common::String &name)
 
virtual int runModal ()
 
bool isVisible () const override
 
void releaseFocus () override
 
void setFocusWidget (Widget *widget)
 
WidgetgetFocusWidget ()
 
void setTickleWidget (Widget *widget)
 
void unSetTickleWidget ()
 
WidgetgetTickleWidget ()
 
void reflowLayout () override
 
virtual void lostFocus ()
 
virtual void receivedFocus (int x=-1, int y=-1)
 
- Public Member Functions inherited from GUI::GuiObject
 GuiObject (int x, int y, int w, int h)
 
 GuiObject (const Common::String &name)
 
 ~GuiObject () override
 
virtual void setTextDrawableArea (const Common::Rect &r)
 
virtual int16 getRelX () const
 
virtual int16 getRelY () const
 
virtual int16 getAbsX () const
 
virtual int16 getAbsY () const
 
virtual int16 getChildX () const
 
virtual int16 getChildY () const
 
virtual uint16 getWidth () const
 
virtual uint16 getHeight () const
 
virtual bool isPointIn (int x, int y)
 
virtual Common::Rect getClipRect () const
 Returns the clipping rect to be used when drawing the children widgets of this object. More...
 

Protected Types

enum  { kBufferSize = 32768, kCharsPerLine = 128, kHistorySize = 20 }
 
enum  SlideMode { kNoSlideMode, kUpSlideMode, kDownSlideMode }
 

Protected Member Functions

void slideUpAndClose ()
 
char & buffer (int idx)
 
void init ()
 
int pos2line (int pos)
 
void drawLine (int line)
 
void drawCaret (bool erase)
 
void printCharIntern (int c)
 
void insertIntoPrompt (const char *str)
 
void print (const char *str)
 
void updateScrollBuffer ()
 
void scrollToCurrent ()
 
Common::String getUserInput ()
 
void defaultKeyDownHandler (Common::KeyState &state)
 
void specialKeys (Common::KeyCode keycode)
 
void nextLine ()
 
void killChar ()
 
void killLine ()
 
void killLastWord ()
 
void addToHistory (const Common::String &str)
 
void historyScroll (int direction)
 
- Protected Member Functions inherited from GUI::Dialog
void markWidgetsAsDirty ()
 Recursively mark all the widgets in this dialog as dirty so they are redrawn. More...
 
void drawWidgets ()
 Draw only the dialog's widgets. More...
 
virtual void handleMouseDown (int x, int y, int button, int clickCount)
 
virtual void handleMouseUp (int x, int y, int button, int clickCount)
 
virtual void handleKeyUp (Common::KeyState state)
 
virtual void handleMouseMoved (int x, int y, int button)
 
virtual void handleMouseLeft (int button)
 
virtual void handleOtherEvent (const Common::Event &evt)
 
void handleCommand (CommandSender *sender, uint32 cmd, uint32 data) override
 
WidgetfindWidget (int x, int y)
 
WidgetfindWidget (const char *name)
 
void removeWidget (Widget *widget) override
 
void setDefaultFocusedWidget ()
 
void setResult (int result)
 
int getResult () const
 
- Protected Member Functions inherited from GUI::CommandReceiver
virtual ~CommandReceiver ()
 

Protected Attributes

const Graphics::Font_font
 
char _buffer [kBufferSize]
 
int _linesInBuffer
 
int _pageWidth
 
int _linesPerPage
 
int _currentPos
 
int _scrollLine
 
int _firstLineInBuffer
 
int _promptStartPos
 
int _promptEndPos
 
bool _caretVisible
 
uint32 _caretTime
 
SlideMode _slideMode
 
uint32 _slideTime
 
ScrollBarWidget_scrollBar
 
InputCallbackProc _callbackProc
 
void * _callbackRefCon
 
CompletionCallbackProc _completionCallbackProc
 
void * _completionCallbackRefCon
 
Common::String _history [kHistorySize]
 
int _historySize
 
int _historyIndex
 
int _historyLine
 
float _widthPercent
 
float _heightPercent
 
int _leftPadding
 
int _rightPadding
 
int _topPadding
 
int _bottomPadding
 
- Protected Attributes inherited from GUI::Dialog
Widget_mouseWidget
 
Widget_focusedWidget
 
Widget_dragWidget
 
Widget_tickleWidget
 
bool _visible
 
ThemeEngine::DialogBackground _backgroundType
 
- Protected Attributes inherited from GUI::GuiObject
Common::Rect _textDrawableArea
 
int16 _x
 
int16 _y
 
uint16 _w
 
uint16 _h
 
const Common::String _name
 
Widget_firstWidget
 

Detailed Description

Definition at line 65 of file console.h.

Member Typedef Documentation

◆ CompletionCallbackProc

typedef bool(* GUI::ConsoleDialog::CompletionCallbackProc) (ConsoleDialog *console, const char *input, Common::String &completion, void *refCon)

Definition at line 68 of file console.h.

◆ InputCallbackProc

typedef bool(* GUI::ConsoleDialog::InputCallbackProc) (ConsoleDialog *console, const char *input, void *refCon)

Definition at line 67 of file console.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
kBufferSize 
kCharsPerLine 
kHistorySize 

Definition at line 71 of file console.h.

◆ SlideMode

Enumerator
kNoSlideMode 
kUpSlideMode 
kDownSlideMode 

Definition at line 96 of file console.h.

Constructor & Destructor Documentation

◆ ConsoleDialog()

GUI::ConsoleDialog::ConsoleDialog ( float  widthPercent,
float  heightPercent 
)

Definition at line 53 of file console.cpp.

Member Function Documentation

◆ addToHistory()

void GUI::ConsoleDialog::addToHistory ( const Common::String str)
protected

Definition at line 585 of file console.cpp.

◆ buffer()

char& GUI::ConsoleDialog::buffer ( int  idx)
inlineprotected

Definition at line 162 of file console.h.

◆ close()

void GUI::ConsoleDialog::close ( )
overridevirtual

Reimplemented from GUI::Dialog.

Definition at line 161 of file console.cpp.

◆ defaultKeyDownHandler()

void GUI::ConsoleDialog::defaultKeyDownHandler ( Common::KeyState state)
protected

Definition at line 467 of file console.cpp.

◆ drawCaret()

void GUI::ConsoleDialog::drawCaret ( bool  erase)
protected

Definition at line 715 of file console.cpp.

◆ drawDialog()

void GUI::ConsoleDialog::drawDialog ( DrawLayer  layerToDraw)
overridevirtual

Draw the dialog in its entirety (background and widgets)

Reimplemented from GUI::Dialog.

Definition at line 165 of file console.cpp.

◆ drawLine()

void GUI::ConsoleDialog::drawLine ( int  line)
protected

Definition at line 172 of file console.cpp.

◆ getCharsPerLine()

int GUI::ConsoleDialog::getCharsPerLine ( )
inline

Definition at line 157 of file console.h.

◆ getUserInput()

Common::String GUI::ConsoleDialog::getUserInput ( )
protected

Definition at line 240 of file console.cpp.

◆ handleCommand()

void GUI::ConsoleDialog::handleCommand ( CommandSender sender,
uint32  cmd,
uint32  data 
)
overridevirtual

Reimplemented from GUI::CommandReceiver.

Definition at line 489 of file console.cpp.

◆ handleKeyDown()

void GUI::ConsoleDialog::handleKeyDown ( Common::KeyState  state)
overridevirtual

Reimplemented from GUI::Dialog.

Definition at line 252 of file console.cpp.

◆ handleMouseWheel()

void GUI::ConsoleDialog::handleMouseWheel ( int  x,
int  y,
int  direction 
)
overridevirtual

Reimplemented from GUI::Dialog.

Definition at line 236 of file console.cpp.

◆ handleTickle()

void GUI::ConsoleDialog::handleTickle ( )
overridevirtual

Reimplemented from GUI::Dialog.

Definition at line 204 of file console.cpp.

◆ historyScroll()

void GUI::ConsoleDialog::historyScroll ( int  direction)
protected

Definition at line 593 of file console.cpp.

◆ init()

void GUI::ConsoleDialog::init ( void  )
protected

Definition at line 92 of file console.cpp.

◆ insertIntoPrompt()

void GUI::ConsoleDialog::insertIntoPrompt ( const char *  str)
protected

Definition at line 479 of file console.cpp.

◆ killChar()

void GUI::ConsoleDialog::killChar ( )
protected

Definition at line 549 of file console.cpp.

◆ killLastWord()

void GUI::ConsoleDialog::killLastWord ( )
protected

Definition at line 564 of file console.cpp.

◆ killLine()

void GUI::ConsoleDialog::killLine ( )
protected

Definition at line 558 of file console.cpp.

◆ nextLine()

void GUI::ConsoleDialog::nextLine ( )
protected

Definition at line 637 of file console.cpp.

◆ open()

void GUI::ConsoleDialog::open ( )
overridevirtual

Reimplemented from GUI::Dialog.

Definition at line 127 of file console.cpp.

◆ pos2line()

int GUI::ConsoleDialog::pos2line ( int  pos)
inlineprotected

Definition at line 168 of file console.h.

◆ print()

void GUI::ConsoleDialog::print ( const char *  str)
protected

Definition at line 705 of file console.cpp.

◆ printChar()

void GUI::ConsoleDialog::printChar ( int  c)

Definition at line 684 of file console.cpp.

◆ printCharIntern()

void GUI::ConsoleDialog::printCharIntern ( int  c)
protected

Definition at line 692 of file console.cpp.

◆ printFormat()

int GUI::ConsoleDialog::printFormat ( int  dummy,
const char *  format,
  ... 
)

Definition at line 667 of file console.cpp.

◆ reflowLayout()

void GUI::ConsoleDialog::reflowLayout ( )
overridevirtual

Reimplemented from GUI::GuiObject.

Definition at line 192 of file console.cpp.

◆ scrollToCurrent()

void GUI::ConsoleDialog::scrollToCurrent ( )
protected

Definition at line 733 of file console.cpp.

◆ setCompletionCallback()

void GUI::ConsoleDialog::setCompletionCallback ( CompletionCallbackProc  proc,
void *  refCon 
)
inline

Definition at line 152 of file console.h.

◆ setInputCallback()

void GUI::ConsoleDialog::setInputCallback ( InputCallbackProc  proc,
void *  refCon 
)
inline

Definition at line 148 of file console.h.

◆ slideUpAndClose()

void GUI::ConsoleDialog::slideUpAndClose ( )
protected

Definition at line 120 of file console.cpp.

◆ specialKeys()

void GUI::ConsoleDialog::specialKeys ( Common::KeyCode  keycode)
protected

Definition at line 505 of file console.cpp.

◆ updateScrollBuffer()

void GUI::ConsoleDialog::updateScrollBuffer ( )
protected

Definition at line 649 of file console.cpp.

◆ vprintFormat()

int GUI::ConsoleDialog::vprintFormat ( int  dummy,
const char *  format,
va_list  argptr 
)

Definition at line 676 of file console.cpp.

Member Data Documentation

◆ _bottomPadding

int GUI::ConsoleDialog::_bottomPadding
protected

Definition at line 126 of file console.h.

◆ _buffer

char GUI::ConsoleDialog::_buffer[kBufferSize]
protected

Definition at line 80 of file console.h.

◆ _callbackProc

InputCallbackProc GUI::ConsoleDialog::_callbackProc
protected

Definition at line 109 of file console.h.

◆ _callbackRefCon

void* GUI::ConsoleDialog::_callbackRefCon
protected

Definition at line 110 of file console.h.

◆ _caretTime

uint32 GUI::ConsoleDialog::_caretTime
protected

Definition at line 94 of file console.h.

◆ _caretVisible

bool GUI::ConsoleDialog::_caretVisible
protected

Definition at line 93 of file console.h.

◆ _completionCallbackProc

CompletionCallbackProc GUI::ConsoleDialog::_completionCallbackProc
protected

Definition at line 113 of file console.h.

◆ _completionCallbackRefCon

void* GUI::ConsoleDialog::_completionCallbackRefCon
protected

Definition at line 114 of file console.h.

◆ _currentPos

int GUI::ConsoleDialog::_currentPos
protected

Definition at line 86 of file console.h.

◆ _firstLineInBuffer

int GUI::ConsoleDialog::_firstLineInBuffer
protected

Definition at line 88 of file console.h.

◆ _font

const Graphics::Font* GUI::ConsoleDialog::_font
protected

Definition at line 78 of file console.h.

◆ _heightPercent

float GUI::ConsoleDialog::_heightPercent
protected

Definition at line 121 of file console.h.

◆ _history

Common::String GUI::ConsoleDialog::_history[kHistorySize]
protected

Definition at line 116 of file console.h.

◆ _historyIndex

int GUI::ConsoleDialog::_historyIndex
protected

Definition at line 118 of file console.h.

◆ _historyLine

int GUI::ConsoleDialog::_historyLine
protected

Definition at line 119 of file console.h.

◆ _historySize

int GUI::ConsoleDialog::_historySize
protected

Definition at line 117 of file console.h.

◆ _leftPadding

int GUI::ConsoleDialog::_leftPadding
protected

Definition at line 123 of file console.h.

◆ _linesInBuffer

int GUI::ConsoleDialog::_linesInBuffer
protected

Definition at line 81 of file console.h.

◆ _linesPerPage

int GUI::ConsoleDialog::_linesPerPage
protected

Definition at line 84 of file console.h.

◆ _pageWidth

int GUI::ConsoleDialog::_pageWidth
protected

Definition at line 83 of file console.h.

◆ _promptEndPos

int GUI::ConsoleDialog::_promptEndPos
protected

Definition at line 91 of file console.h.

◆ _promptStartPos

int GUI::ConsoleDialog::_promptStartPos
protected

Definition at line 90 of file console.h.

◆ _rightPadding

int GUI::ConsoleDialog::_rightPadding
protected

Definition at line 124 of file console.h.

◆ _scrollBar

ScrollBarWidget* GUI::ConsoleDialog::_scrollBar
protected

Definition at line 105 of file console.h.

◆ _scrollLine

int GUI::ConsoleDialog::_scrollLine
protected

Definition at line 87 of file console.h.

◆ _slideMode

SlideMode GUI::ConsoleDialog::_slideMode
protected

Definition at line 102 of file console.h.

◆ _slideTime

uint32 GUI::ConsoleDialog::_slideTime
protected

Definition at line 103 of file console.h.

◆ _topPadding

int GUI::ConsoleDialog::_topPadding
protected

Definition at line 125 of file console.h.

◆ _widthPercent

float GUI::ConsoleDialog::_widthPercent
protected

Definition at line 121 of file console.h.


The documentation for this class was generated from the following files: