Rhino C++ API  9.0
Public Member Functions | Friends | List of all members
CRhinoUserInterfaceTextBox Class Reference

#include <rhinoSdkUserInterfaceObject.h>

Inheritance diagram for CRhinoUserInterfaceTextBox:
CRhinoUserInterfaceControl CRhinoUserInterfaceObject

Public Member Functions

 CRhinoUserInterfaceTextBox ()
 
 CRhinoUserInterfaceTextBox (const wchar_t *text)
 
virtual ~CRhinoUserInterfaceTextBox ()
 
bool AcceptsKeyboardFocus () const override
 
ON_Color BackgroundColor () const
 
ON_Color BorderColor () const
 
int CaretPosition () const
 
void ClearSelection ()
 
ON_4fRect ComputedRect (const CRhinoDisplayPipeline *pipeline, bool logicalPixels) const override
 
ON_2fSize ComputeSize () const override
 
bool CopyToClipboard () const
 
bool CutToClipboard ()
 
void Draw (CRhinoDisplayPipeline &dp) override
 
bool IsMouseOver (const CRhinoMouseEventArgs &mouse) override
 
int MaximumLength () const
 
bool OnCharacter (unsigned int character, unsigned int flags) override
 
virtual void OnEditCanceled ()
 
void OnKeyboardFocusChanged (bool hasFocus) override
 
bool OnKeyDown (unsigned int virtualKey, unsigned int flags) override
 
void OnMouseDoubleClick (const CRhinoMouseEventArgs &mouse) override
 
void OnMouseDown (const CRhinoMouseEventArgs &mouse) override
 
void OnMouseEnter (const CRhinoMouseEventArgs &mouse) override
 
void OnMouseLeave (const CRhinoMouseEventArgs &mouse) override
 
void OnMouseMove (const CRhinoMouseEventArgs &mouse) override
 
void OnMouseUp (const CRhinoMouseEventArgs &mouse) override
 
virtual void OnTextChanged ()
 
virtual void OnTextCommitted ()
 
bool PasteFromClipboard ()
 
const ON_wStringPlaceholderText () const
 
bool ReadOnly () const
 
void SelectAll ()
 
ON_wString SelectedText () const
 
ON_Color SelectionColor () const
 
int SelectionLength () const
 
int SelectionStart () const
 
void SetBackgroundColor (const ON_Color &color)
 
void SetBorderColor (const ON_Color &color)
 
void SetCaretPosition (int position)
 
void SetMaximumLength (int maximumLength)
 
void SetPlaceholderText (const wchar_t *text)
 
void SetReadOnly (bool readOnly)
 
void SetSelection (int start, int length)
 
void SetSelectionColor (const ON_Color &color)
 
void TakeKeyboardFocus (CRhinoDoc *doc)
 
- Public Member Functions inherited from CRhinoUserInterfaceControl
 CRhinoUserInterfaceControl ()
 
virtual ~CRhinoUserInterfaceControl ()
 
void GetAlignment (ControlHorizontalAlignment &h, ControlVerticalAlignment &v) const
 
void GetTextAlignment (ControlHorizontalAlignment &h, ControlVerticalAlignment &v) const
 
const ON_wStringImageSVG () const
 
ON_2fPoint Location () const
 
void SetAlignment (ControlHorizontalAlignment h, ControlVerticalAlignment v)
 
void SetImageSVG (const wchar_t *svg)
 
void SetLocation (float x, float y)
 
void SetLocation (ON_2fPoint location)
 
void SetLocation (ON_2fPoint location, ControlHorizontalAlignment hAlign, ControlVerticalAlignment vAlign)
 
void SetSize (const ON_2fSize &size)
 
void SetSize (float width, float height)
 
void SetText (const wchar_t *text)
 
void SetTextAlignment (ControlHorizontalAlignment h, ControlVerticalAlignment v)
 
void SetTextColor (const ON_Color &color)
 
void SetTextHeight (float height)
 
void SetTrackingPoint (const ON_3dPoint &pt)
 
ON_2fSize Size () const
 
const ON_wStringText () const
 
ON_Color TextColor () const
 
float TextHeight () const
 
ON_3dPoint TrackingPoint () const
 
- Public Member Functions inherited from CRhinoUserInterfaceObject
 CRhinoUserInterfaceObject ()
 
virtual ~CRhinoUserInterfaceObject ()
 
void Animate (CRhinoAnimatingDouble &value, double target, double duration, AnimationStyle style, CRhinoDoc *doc)
 
void BindToActiveViewport (bool on)
 
void BindToViewport (unsigned int viewport_sn)
 
virtual double CameraDepth (const ON_Plane &cameraPlane) const
 
int DisplayOrder () const
 
ON_UUID DocumentGroupId () const
 
unsigned int DocumentRuntimeSerialNumber () const
 
bool GetData (const wchar_t *key, bool &value) const
 
bool GetData (const wchar_t *key, double &value) const
 
bool GetData (const wchar_t *key, int &value) const
 
bool GetData (const wchar_t *key, ON_UUID &value) const
 
bool GetData (const wchar_t *key, ON_wString &value) const
 
bool HasKeyboardFocus () const
 
bool HasMouseCapture () const
 
bool IsBoundToActiveViewport () const
 
unsigned int IsBoundToViewport () const
 
bool MoveKeyboardFocusToSibling (bool forward, CRhinoDoc *doc)
 
virtual void OnMouseClick (const CRhinoMouseEventArgs &mouse)
 
virtual void OnMouseWheel (const CRhinoMouseEventArgs &mouse, int delta)
 
virtual CRhinoCommand::result OnRunCommand (const CRhinoCommandContext &context, const CRhinoMouseEventArgs &mouse)
 
virtual void OnTrackpadScroll (const CRhinoMouseEventArgs &mouse, float horizontal, float vertical)
 
CRhinoUserInterfaceObjectParent ()
 
const CRhinoUserInterfaceObjectParent () const
 
bool ReceivesMouseWheelEvents () const
 
bool ReceivesTrackpadScrollEvents () const
 
bool RegisterForAllDocuments ()
 
void RunCommand (const CRhinoMouseEventArgs &mouse)
 
unsigned int RuntimeSerialNumber () const
 
void SetCursor (HCURSOR cursor)
 
void SetData (const wchar_t *key, bool value)
 
void SetData (const wchar_t *key, const wchar_t *value)
 
void SetData (const wchar_t *key, double value)
 
void SetData (const wchar_t *key, int value)
 
void SetData (const wchar_t *key, ON_UUID value)
 
void SetDisplayOrder (int order)
 
void SetReceivesMouseWheelEvents (bool enable)
 
void SetReceivesTrackpadScrollEvents (bool enable)
 
void SetTooltip (const wchar_t *tooltip)
 
void SetVisible (bool visible)
 
bool UnregisterFromAllDocuments ()
 
bool Visible () const
 

Friends

class CRhUserInterfaceTextBoxPrivate
 

Additional Inherited Members

- Public Types inherited from CRhinoUserInterfaceObject
enum  FocusReason : int { FocusReason::Unknown = 0, FocusReason::Pointer = 1, FocusReason::Navigation = 2 }
 
- Static Public Member Functions inherited from CRhinoUserInterfaceObject
static void ClearKeyboardFocus (CRhinoDoc *doc)
 
static FocusReason KeyboardFocusReason ()
 
- Protected Member Functions inherited from CRhinoUserInterfaceObject
virtual void ContinueAnimate (CRhinoDoc *doc)
 
void ReleaseKeyboardFocus (CRhinoDoc *doc)
 
void SetKeyboardFocus (CRhinoDoc *doc, FocusReason reason=FocusReason::Unknown)
 
void SetMouseCapture (CRhinoDoc *doc)
 
- Protected Attributes inherited from CRhinoUserInterfaceControl
class CRhUserInterfaceControlPrivate * m_ui_control_private = nullptr
 
- Protected Attributes inherited from CRhinoUserInterfaceObject
class CRhUserInterfaceObjectPrivatem_private = nullptr
 

Detailed Description

Description: A single line text box. Click it to give it keyboard focus, then type. The characters go into the box instead of to the command line for as long as it has focus; Enter commits what was typed, Escape puts back the text the box started with, and both give the focus back to the viewport.

Constructor & Destructor Documentation

◆ CRhinoUserInterfaceTextBox() [1/2]

CRhinoUserInterfaceTextBox::CRhinoUserInterfaceTextBox ( )

◆ CRhinoUserInterfaceTextBox() [2/2]

CRhinoUserInterfaceTextBox::CRhinoUserInterfaceTextBox ( const wchar_t *  text)

◆ ~CRhinoUserInterfaceTextBox()

virtual CRhinoUserInterfaceTextBox::~CRhinoUserInterfaceTextBox ( )
virtual

Member Function Documentation

◆ AcceptsKeyboardFocus()

bool CRhinoUserInterfaceTextBox::AcceptsKeyboardFocus ( ) const
overridevirtual

Description: Can this object take keyboard focus? This is what Tab looks at when it goes looking for the next control to move to. The base class returns false.

Reimplemented from CRhinoUserInterfaceObject.

◆ BackgroundColor()

ON_Color CRhinoUserInterfaceTextBox::BackgroundColor ( ) const

◆ BorderColor()

ON_Color CRhinoUserInterfaceTextBox::BorderColor ( ) const

◆ CaretPosition()

int CRhinoUserInterfaceTextBox::CaretPosition ( ) const

Description: Where the insertion point sits, as a count of characters from the start of the text. Setting it clamps to the length of the text, and drops whatever was selected: a caret on its own is a selection of nothing.

◆ ClearSelection()

void CRhinoUserInterfaceTextBox::ClearSelection ( )

◆ ComputedRect()

ON_4fRect CRhinoUserInterfaceTextBox::ComputedRect ( const CRhinoDisplayPipeline pipeline,
bool  logicalPixels 
) const
overridevirtual

Description: Compute the location and size of this control in the coordinates of the thing that is drawing it. Parameters: pipeline - the display pipeline to compute location and size inside of. The same control can end up in different places in different pipelines, because of how it is aligned or because it is tracking a 3d point. Take the pipeline rather than the view it belongs to: a detail on a layout is drawn by its own nested pipeline whose view is the page view, so a view cannot say which of the two is being drawn. logicalPixels - should the rectangle be return in device or logical pixels

Reimplemented from CRhinoUserInterfaceControl.

◆ ComputeSize()

ON_2fSize CRhinoUserInterfaceTextBox::ComputeSize ( ) const
overridevirtual

Description: Compute the size of this control in logical pixels.

Reimplemented from CRhinoUserInterfaceControl.

◆ CopyToClipboard()

bool CRhinoUserInterfaceTextBox::CopyToClipboard ( ) const

Description: Clipboard. Ctrl+C, Ctrl+X and Ctrl+V call these while the box has keyboard focus. Copy and cut work on the selected run and do nothing when nothing is selected. Paste replaces the selection, or puts what is on the clipboard in at the caret when there is none, with anything that would break the line flattened to a space. Cut takes nothing out of a read only box, and paste puts nothing into one. Returns: True if the clipboard or the text changed.

◆ CutToClipboard()

bool CRhinoUserInterfaceTextBox::CutToClipboard ( )

◆ Draw()

void CRhinoUserInterfaceTextBox::Draw ( CRhinoDisplayPipeline dp)
overridevirtual

Description: All user interface objects must implement a Draw function. This is where drawing using the input display pipeline is performed. The base class Draw function does nothing.

Reimplemented from CRhinoUserInterfaceObject.

◆ IsMouseOver()

bool CRhinoUserInterfaceTextBox::IsMouseOver ( const CRhinoMouseEventArgs mouse)
overridevirtual

Description: Return true if the input mouse is considered to be over this object

Reimplemented from CRhinoUserInterfaceObject.

◆ MaximumLength()

int CRhinoUserInterfaceTextBox::MaximumLength ( ) const

◆ OnCharacter()

bool CRhinoUserInterfaceTextBox::OnCharacter ( unsigned int  character,
unsigned int  flags 
)
overridevirtual

Description: Called when a character is typed while this object has keyboard focus. Parameters: character - [in] the character that was typed flags - [in] platform key state flags Returns: True when this object used the character. A character this object does not use carries on to the command line, the way typing in a viewport normally works. The base class returns false.

Reimplemented from CRhinoUserInterfaceObject.

◆ OnEditCanceled()

virtual void CRhinoUserInterfaceTextBox::OnEditCanceled ( )
virtual

Description: Called when Escape is pressed. The text has already been put back to what it was when the box took focus.

◆ OnKeyboardFocusChanged()

void CRhinoUserInterfaceTextBox::OnKeyboardFocusChanged ( bool  hasFocus)
overridevirtual

Description: Called when this object gains or loses keyboard focus. The base class implementation does nothing. KeyboardFocusReason says how focus arrived.

Reimplemented from CRhinoUserInterfaceObject.

◆ OnKeyDown()

bool CRhinoUserInterfaceTextBox::OnKeyDown ( unsigned int  virtualKey,
unsigned int  flags 
)
overridevirtual

Description: Called when a key goes down while this object has keyboard focus. This is where the keys that do not produce characters arrive: the arrows, Home, End, Backspace, Delete, Enter and Escape. Parameters: virtualKey - [in] virtual key code, VK_LEFT and friends flags - [in] platform key state flags Returns: True when this object used the key. The base class returns false.

Reimplemented from CRhinoUserInterfaceObject.

◆ OnMouseDoubleClick()

void CRhinoUserInterfaceTextBox::OnMouseDoubleClick ( const CRhinoMouseEventArgs mouse)
overridevirtual

Description: Called when a mouse double clicks on this UI element Parameters: mouse - mouse position, button and view

Reimplemented from CRhinoUserInterfaceObject.

◆ OnMouseDown()

void CRhinoUserInterfaceTextBox::OnMouseDown ( const CRhinoMouseEventArgs mouse)
overridevirtual

Description: Called when a mouse button goes down over this UI element Parameters: mouse - mouse position, button and view

Reimplemented from CRhinoUserInterfaceObject.

◆ OnMouseEnter()

void CRhinoUserInterfaceTextBox::OnMouseEnter ( const CRhinoMouseEventArgs mouse)
overridevirtual

Description: Called when first goes over this object (IsMouseOver returns true)

Reimplemented from CRhinoUserInterfaceObject.

◆ OnMouseLeave()

void CRhinoUserInterfaceTextBox::OnMouseLeave ( const CRhinoMouseEventArgs mouse)
overridevirtual

Description: Called when mouse leaves this object (IsMouseOver returns false)

Reimplemented from CRhinoUserInterfaceObject.

◆ OnMouseMove()

void CRhinoUserInterfaceTextBox::OnMouseMove ( const CRhinoMouseEventArgs mouse)
overridevirtual

Description: Called when a mouse moves over this UI element Parameters: mouse - mouse position, button and view

Reimplemented from CRhinoUserInterfaceObject.

◆ OnMouseUp()

void CRhinoUserInterfaceTextBox::OnMouseUp ( const CRhinoMouseEventArgs mouse)
overridevirtual

Description: Called when a mouse button goes up over this UI element Parameters: mouse - mouse position, button and view

Reimplemented from CRhinoUserInterfaceObject.

◆ OnTextChanged()

virtual void CRhinoUserInterfaceTextBox::OnTextChanged ( )
virtual

Description: Called every time the text changes, once per keystroke.

◆ OnTextCommitted()

virtual void CRhinoUserInterfaceTextBox::OnTextCommitted ( )
virtual

Description: Called when Enter is pressed, and when the box loses focus with the text changed from what it started with. This is where a caller does something about the new text.

◆ PasteFromClipboard()

bool CRhinoUserInterfaceTextBox::PasteFromClipboard ( )

◆ PlaceholderText()

const ON_wString& CRhinoUserInterfaceTextBox::PlaceholderText ( ) const

◆ ReadOnly()

bool CRhinoUserInterfaceTextBox::ReadOnly ( ) const

◆ SelectAll()

void CRhinoUserInterfaceTextBox::SelectAll ( )

◆ SelectedText()

ON_wString CRhinoUserInterfaceTextBox::SelectedText ( ) const

◆ SelectionColor()

ON_Color CRhinoUserInterfaceTextBox::SelectionColor ( ) const

◆ SelectionLength()

int CRhinoUserInterfaceTextBox::SelectionLength ( ) const

◆ SelectionStart()

int CRhinoUserInterfaceTextBox::SelectionStart ( ) const

Description: The run of text that is selected: where it starts and how many characters long it is. A length of zero means nothing is selected. Dragging across the text selects, as do shift and the arrow keys, Ctrl+A, and a double click on a word. Typing, or pasting, replaces what is selected.

SetSelection clamps to the text and leaves the caret at the end of the run. Both ends survive a text change no worse than the caret does: they are clamped when they are read.

◆ SetBackgroundColor()

void CRhinoUserInterfaceTextBox::SetBackgroundColor ( const ON_Color color)

Description: The box the text sits in: the color it is filled with, and the color of the outline around it. Both default to ON_UNSET_COLOR, which means use standard colors for the theme in use. The outline is drawn thicker and brighter while the box has keyboard focus, whatever color it is given.

◆ SetBorderColor()

void CRhinoUserInterfaceTextBox::SetBorderColor ( const ON_Color color)

◆ SetCaretPosition()

void CRhinoUserInterfaceTextBox::SetCaretPosition ( int  position)

◆ SetMaximumLength()

void CRhinoUserInterfaceTextBox::SetMaximumLength ( int  maximumLength)

Description: Most characters the text will hold. 0, the default, means no limit.

◆ SetPlaceholderText()

void CRhinoUserInterfaceTextBox::SetPlaceholderText ( const wchar_t *  text)

Description: Text drawn, dimmed, when the box is empty and does not have focus.

◆ SetReadOnly()

void CRhinoUserInterfaceTextBox::SetReadOnly ( bool  readOnly)

Description: A read only text box can take focus and be scrolled through, but typing does not change it. Off by default.

◆ SetSelection()

void CRhinoUserInterfaceTextBox::SetSelection ( int  start,
int  length 
)

◆ SetSelectionColor()

void CRhinoUserInterfaceTextBox::SetSelectionColor ( const ON_Color color)

Description: Color drawn behind the selected run of text. ON_UNSET_COLOR, the default, means use a standard highlight color for the theme in use.

◆ TakeKeyboardFocus()

void CRhinoUserInterfaceTextBox::TakeKeyboardFocus ( CRhinoDoc doc)

Description: Give this text box keyboard focus, as clicking it does. The document is used to redraw and can be nullptr.

Friends And Related Function Documentation

◆ CRhUserInterfaceTextBoxPrivate

friend class CRhUserInterfaceTextBoxPrivate
friend