C# Class Commander.UI.Controls.Text.CommanderTextBox

Inheritance: System.Windows.Forms.RichTextBox, IClipboardActions
Show file Open project: SneWs/Commander

Public Methods

Method Description
AppendOutput ( string output, bool newLine = false, bool addPrompt = false, Color textColor = null, bool skipStyle = true ) : void

Appends the output to the text box applying color etc according to the call.

ClearOutput ( ) : void

Clears the output.

CommanderTextBox ( string prompt ) : System
CommanderTextBox ( string prompt, IShellStatus shellStatus ) : System

Initializes a new instance of the CommanderTextBox class.

Copy ( ) : void

Copies the current selection in the text box to the Clipboard.

GetCurrentLine ( ) : int

Returns the current line the carret is on

GetCurrentLineString ( int actualStartIndex ) : string

Returns the user written input string that's on the current line.

Paste ( ) : void

Replaces the current selection in the text box with the contents of the Clipboard.

Paste ( string text ) : void
ReplaceCurrentLineWith ( string newText ) : void
ScrollToBottom ( ) : void

Scrolls to bottom of text box.

UpdatePosition ( ) : void

Updates the position of the carred and makes sure that the text box is scrolled to the bottom.

Protected Methods

Method Description
GetCurrentLineStartPosition ( ) : int

Get's the starting char index for a line based on if a prompt is present or not.

GoToLineEnd ( ) : void

Moves the carret to the last line and the last written character + 1

GoToLineStart ( ) : void

Moves the carret to the last line and the first written character after the prompt - 1

IsCarretOnLastLine ( ) : bool
OnKeyDown ( KeyEventArgs e ) : void

Raises the E:System.Windows.Forms.Control.KeyDown event.

PlaceCarretOnLastLine ( ) : void

Places the carret on last line.

Private Methods

Method Description
HandleAutoComplete ( ) : bool

Handles the auto complete of file system entries. Logic: When a user presses TAB, it will automatically show the next item available in that folder in the prompt. For ex. cd T|TAB| could complete with Treasure if Treasure is a file or folder in the current working path

HandleControlKeyActions ( KeyEventArgs e, int caretPosition ) : void

Handles the control key actions.

HandleKeyNavigationLeft ( KeyEventArgs e, int caretPosition ) : void

Handles the key navigation going left.

Method Details

AppendOutput() public method

Appends the output to the text box applying color etc according to the call.
public AppendOutput ( string output, bool newLine = false, bool addPrompt = false, Color textColor = null, bool skipStyle = true ) : void
output string The output.
newLine bool if set to true [new line].
addPrompt bool
textColor Color Color of the text.
skipStyle bool if set to true [skip style].
return void

ClearOutput() public method

Clears the output.
public ClearOutput ( ) : void
return void

CommanderTextBox() public method

public CommanderTextBox ( string prompt ) : System
prompt string
return System

CommanderTextBox() public method

Initializes a new instance of the CommanderTextBox class.
public CommanderTextBox ( string prompt, IShellStatus shellStatus ) : System
prompt string The prompt.
shellStatus IShellStatus The shell status ref
return System

Copy() public method

Copies the current selection in the text box to the Clipboard.
public Copy ( ) : void
return void

GetCurrentLine() public method

Returns the current line the carret is on
public GetCurrentLine ( ) : int
return int

GetCurrentLineStartPosition() protected method

Get's the starting char index for a line based on if a prompt is present or not.
protected GetCurrentLineStartPosition ( ) : int
return int

GetCurrentLineString() public method

Returns the user written input string that's on the current line.
public GetCurrentLineString ( int actualStartIndex ) : string
actualStartIndex int Actual index of the start.
return string

GoToLineEnd() protected method

Moves the carret to the last line and the last written character + 1
protected GoToLineEnd ( ) : void
return void

GoToLineStart() protected method

Moves the carret to the last line and the first written character after the prompt - 1
protected GoToLineStart ( ) : void
return void

IsCarretOnLastLine() protected method

protected IsCarretOnLastLine ( ) : bool
return bool

OnKeyDown() protected method

Raises the E:System.Windows.Forms.Control.KeyDown event.
protected OnKeyDown ( KeyEventArgs e ) : void
e System.Windows.Forms.KeyEventArgs A that contains the event data.
return void

Paste() public method

Replaces the current selection in the text box with the contents of the Clipboard.
public Paste ( ) : void
return void

Paste() public method

public Paste ( string text ) : void
text string
return void

PlaceCarretOnLastLine() protected method

Places the carret on last line.
protected PlaceCarretOnLastLine ( ) : void
return void

ReplaceCurrentLineWith() public method

public ReplaceCurrentLineWith ( string newText ) : void
newText string
return void

ScrollToBottom() public method

Scrolls to bottom of text box.
public ScrollToBottom ( ) : void
return void

UpdatePosition() public method

Updates the position of the carred and makes sure that the text box is scrolled to the bottom.
public UpdatePosition ( ) : void
return void