Public Member Functions | Data Fields | Static Public Attributes

IConsoleWindow Struct Reference

Inheritance diagram for IConsoleWindow:
Window ZeroedMemoryAllocator

Public Member Functions

void Scroll (int amount)
 Scroll the content of the console.
virtual void OnPaint ()
 The window must be repainted.
virtual void OnHundredthTick ()
 Called once every 100 (game) ticks.
virtual void OnMouseLoop ()
 Called for every mouse loop run, which is at least once per (game) tick.
virtual EventState OnKeyPress (WChar key, uint16 keycode)
 A key has been pressed.
virtual void InsertTextString (int wid, const char *str, bool marked, const char *caret, const char *insert_location, const char *replacement_end)
 Insert a text string at the cursor position into the edit box widget.
virtual const char * GetFocusedText () const
 Get the current input text if an edit box has the focus.
virtual const char * GetCaret () const
 Get the string at the caret if an edit box has the focus.
virtual const char * GetMarkedText (size_t *length) const
 Get the range of the currently marked input text.
virtual Point GetCaretPosition () const
 Get the current caret position if an edit box has the focus.
virtual Rect GetTextBoundingRect (const char *from, const char *to) const
 Get the bounding rectangle for a text range if an edit box has the focus.
virtual const char * GetTextCharacterAtPosition (const Point &pt) const
 Get the character that is rendered at a position by the focused edit box.
virtual void OnMouseWheel (int wheel)
 The mouse wheel has been turned.
virtual void OnFocusLost ()
 Called when window looses focus.

Data Fields

int line_height
 Height of one line of text in the console.
int line_offset

Static Public Attributes

static int scroll = 0

Detailed Description

Definition at line 169 of file console_gui.cpp.


Member Function Documentation

virtual const char* IConsoleWindow::GetCaret (  )  const [inline, virtual]

Get the string at the caret if an edit box has the focus.

Returns:
The text at the caret or NULL if no edit box is focused.

Reimplemented from Window.

Definition at line 329 of file console_gui.cpp.

References Textbuf::buf, and Textbuf::caretpos.

virtual Point IConsoleWindow::GetCaretPosition (  )  const [inline, virtual]

Get the current caret position if an edit box has the focus.

Returns:
Top-left location of the caret, relative to the window.

Reimplemented from Window.

Definition at line 342 of file console_gui.cpp.

References Textbuf::caretxoffs, Window::height, line_height, min(), Textbuf::pixels, and Window::width.

virtual const char* IConsoleWindow::GetFocusedText (  )  const [inline, virtual]

Get the current input text if an edit box has the focus.

Returns:
The currently focused input text or NULL if no input focused.

Reimplemented from Window.

Definition at line 324 of file console_gui.cpp.

References Textbuf::buf.

virtual const char* IConsoleWindow::GetMarkedText ( size_t *  length  )  const [inline, virtual]

Get the range of the currently marked input text.

Parameters:
[out] length Length of the marked text.
Returns:
Pointer to the start of the marked text or NULL if no text is marked.

Reimplemented from Window.

Definition at line 334 of file console_gui.cpp.

References Textbuf::buf, Textbuf::markend, and Textbuf::markpos.

virtual Rect IConsoleWindow::GetTextBoundingRect ( const char *  from,
const char *  to 
) const [inline, virtual]

Get the bounding rectangle for a text range if an edit box has the focus.

Parameters:
from Start of the string range.
to End of the string range.
Returns:
Rectangle encompassing the string range, relative to the window.

Reimplemented from Window.

Definition at line 350 of file console_gui.cpp.

References Textbuf::buf, FS_NORMAL, GetCharPosInString(), Window::height, line_height, min(), Textbuf::pixels, and Window::width.

virtual const char* IConsoleWindow::GetTextCharacterAtPosition ( const Point pt  )  const [inline, virtual]

Get the character that is rendered at a position by the focused edit box.

Parameters:
pt The position to test.
Returns:
Pointer to the character at the position or NULL if no character is at the position.

Reimplemented from Window.

Definition at line 361 of file console_gui.cpp.

References Textbuf::buf, GetCharAtPosition(), IsInsideMM(), min(), Textbuf::pixels, and Window::width.

virtual void IConsoleWindow::InsertTextString ( int  wid,
const char *  str,
bool  marked,
const char *  caret,
const char *  insert_location,
const char *  replacement_end 
) [inline, virtual]

Insert a text string at the cursor position into the edit box widget.

Parameters:
wid Edit box widget.
str Text string to insert.

Reimplemented from Window.

Definition at line 315 of file console_gui.cpp.

References Textbuf::InsertString(), and Window::SetDirty().

virtual EventState IConsoleWindow::OnKeyPress ( WChar  key,
uint16  keycode 
) [inline, virtual]

A key has been pressed.

Parameters:
key the Unicode value of the key.
keycode the untranslated key code including shift state.
Returns:
ES_HANDLED if the key press has been handled and no other window should receive the event.

Reimplemented from Window.

Definition at line 244 of file console_gui.cpp.

References Textbuf::buf, CC_COMMAND, Window::height, ICONSOLE_FULL, ICONSOLE_OPENED, IConsoleCmdExec(), IConsoleHistoryAdd(), IConsoleHistoryNavigate(), IConsolePrintF(), IConsoleResize(), IConsoleSwitch(), line_height, LRM, MarkWholeScreenDirty(), Scroll(), and Window::SetDirty().

virtual void IConsoleWindow::OnMouseWheel ( int  wheel  )  [inline, virtual]

The mouse wheel has been turned.

Parameters:
wheel the amount of movement of the mouse wheel.

Reimplemented from Window.

Definition at line 370 of file console_gui.cpp.

References Scroll().

virtual void IConsoleWindow::OnPaint (  )  [inline, virtual]

The window must be repainted.

Note:
This method should not change any state, it should only use drawing functions.

Reimplemented from Window.

Definition at line 202 of file console_gui.cpp.

References Textbuf::buf, Textbuf::caret, Textbuf::caretxoffs, CC_COMMAND, DrawString(), DrawStringMultiLine(), IConsoleLine::Get(), GfxFillRect(), Window::height, line_height, Textbuf::marklength, Textbuf::markxoffs, PC_BLACK, PC_DARK_RED, Textbuf::pixels, IConsoleLine::previous, SA_BOTTOM, SA_FORCE, SA_LEFT, SetDParamStr(), and Window::width.

void IConsoleWindow::Scroll ( int  amount  )  [inline]

Scroll the content of the console.

Parameters:
amount Number of lines to scroll back.

Definition at line 195 of file console_gui.cpp.

References Window::height, line_height, Window::SetDirty(), and IConsoleLine::size.

Referenced by OnKeyPress(), and OnMouseWheel().


The documentation for this struct was generated from the following file: