Rhino C++ API  9.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
CRhinoUserInterfaceObject Class Reference

#include <rhinoSdkUserInterfaceObject.h>

Inheritance diagram for CRhinoUserInterfaceObject:
CRhinoGripUserInterfaceObject CRhinoTextDotUserInterfaceObject CRhinoUserInterfaceControl CRhinoDirectionGripUserInterfaceObject CRhinoRotationGripUserInterfaceObject CRhinoUserInterfaceButton CRhinoUserInterfaceCheckBox CRhinoUserInterfaceGrid CRhinoUserInterfaceIcon CRhinoUserInterfaceLabel CRhinoUserInterfaceRadioButton CRhinoUserInterfaceSlider CRhinoUserInterfaceTextBox

Public Types

enum  FocusReason : int { FocusReason::Unknown = 0, FocusReason::Pointer = 1, FocusReason::Navigation = 2 }
 

Public Member Functions

 CRhinoUserInterfaceObject ()
 
virtual ~CRhinoUserInterfaceObject ()
 
virtual bool AcceptsKeyboardFocus () const
 
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
 
virtual void Draw (CRhinoDisplayPipeline &dp)
 
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
 
virtual bool IsMouseOver (const CRhinoMouseEventArgs &mouse)
 
bool MoveKeyboardFocusToSibling (bool forward, CRhinoDoc *doc)
 
virtual bool OnCharacter (unsigned int character, unsigned int flags)
 
virtual void OnKeyboardFocusChanged (bool hasFocus)
 
virtual bool OnKeyDown (unsigned int virtualKey, unsigned int flags)
 
virtual void OnMouseClick (const CRhinoMouseEventArgs &mouse)
 
virtual void OnMouseDoubleClick (const CRhinoMouseEventArgs &mouse)
 
virtual void OnMouseDown (const CRhinoMouseEventArgs &mouse)
 
virtual void OnMouseEnter (const CRhinoMouseEventArgs &mouse)
 
virtual void OnMouseLeave (const CRhinoMouseEventArgs &mouse)
 
virtual void OnMouseMove (const CRhinoMouseEventArgs &mouse)
 
virtual void OnMouseUp (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
 

Static Public Member Functions

static void ClearKeyboardFocus (CRhinoDoc *doc)
 
static FocusReason KeyboardFocusReason ()
 

Protected Member Functions

virtual void ContinueAnimate (CRhinoDoc *doc)
 
void ReleaseKeyboardFocus (CRhinoDoc *doc)
 
void SetKeyboardFocus (CRhinoDoc *doc, FocusReason reason=FocusReason::Unknown)
 
void SetMouseCapture (CRhinoDoc *doc)
 

Protected Attributes

class CRhUserInterfaceObjectPrivatem_private = nullptr
 

Friends

class CRhinoDisplayPipeline
 
class CRhinoDisplayWindowBase
 
class CRhinoDoc
 
class CRhinoObjRef
 
class CRhinoUserInterfaceGrid
 
class CRhUserInterfaceObjectPrivate
 
class CRhViewBase
 

Detailed Description

Description: Base class for in-viewport user interface objects. These are objects that are shown and can respond to mouse events for things like heads up displays or clickable and dragable items.

Member Enumeration Documentation

◆ FocusReason

Description: How keyboard focus arrived. A control can want to behave differently for each: a text box selects all of its text when Tab lands on it, the way a dialog field does, but leaves the text alone when it was clicked, because the click also says where in the text to put the caret.

Enumerator
Unknown 

asked for in code, with nothing more specific said

Pointer 

clicked on

Navigation 

Tab or Shift+Tab moved on to it from a sibling.

Constructor & Destructor Documentation

◆ CRhinoUserInterfaceObject()

CRhinoUserInterfaceObject::CRhinoUserInterfaceObject ( )

◆ ~CRhinoUserInterfaceObject()

virtual CRhinoUserInterfaceObject::~CRhinoUserInterfaceObject ( )
virtual

Member Function Documentation

◆ AcceptsKeyboardFocus()

virtual bool CRhinoUserInterfaceObject::AcceptsKeyboardFocus ( ) const
virtual

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 in CRhinoUserInterfaceTextBox, and CRhinoUserInterfaceRadioButton.

◆ Animate()

void CRhinoUserInterfaceObject::Animate ( CRhinoAnimatingDouble value,
double  target,
double  duration,
AnimationStyle  style,
CRhinoDoc doc 
)

Description: Use this method to register a new animation this method also should get called in Draw routine of the parent class for every animation in m_animations

◆ BindToActiveViewport()

void CRhinoUserInterfaceObject::BindToActiveViewport ( bool  on)

◆ BindToViewport()

void CRhinoUserInterfaceObject::BindToViewport ( unsigned int  viewport_sn)

◆ CameraDepth()

virtual double CRhinoUserInterfaceObject::CameraDepth ( const ON_Plane cameraPlane) const
virtual

Description: If this is a "world space" type user interface object (grip, text dot, direction arrow), this function returns the minimum distance to the camera to allow for depth sorting user interface objects before drawing them. The default return value is ON_UNSET_VALUE

Reimplemented in CRhinoGripUserInterfaceObject, and CRhinoTextDotUserInterfaceObject.

◆ ClearKeyboardFocus()

static void CRhinoUserInterfaceObject::ClearKeyboardFocus ( CRhinoDoc doc)
static

Description: Take keyboard focus away from whichever object has it, if any. This is what a click that lands somewhere other than on that object does, and it is how code ends an edit without waiting for the user to press Enter. Parameters: doc - [in] document to redraw, can be nullptr

◆ ContinueAnimate()

virtual void CRhinoUserInterfaceObject::ContinueAnimate ( CRhinoDoc doc)
protectedvirtual

Reimplemented in CRhinoUserInterfaceGrid.

◆ DisplayOrder()

int CRhinoUserInterfaceObject::DisplayOrder ( ) const

Description: Sort order for user interface object to be drawn. Values <= 0 will be drawn before overlay cinduits and values > 0 wil be drawn after overlay conduits.

◆ DocumentGroupId()

ON_UUID CRhinoUserInterfaceObject::DocumentGroupId ( ) const

◆ DocumentRuntimeSerialNumber()

unsigned int CRhinoUserInterfaceObject::DocumentRuntimeSerialNumber ( ) const

◆ Draw()

virtual void CRhinoUserInterfaceObject::Draw ( CRhinoDisplayPipeline dp)
virtual

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 in CRhinoUserInterfaceGrid, CRhinoUserInterfaceTextBox, CRhinoUserInterfaceSlider, CRhinoUserInterfaceRadioButton, CRhinoUserInterfaceCheckBox, CRhinoUserInterfaceIcon, CRhinoUserInterfaceButton, CRhinoUserInterfaceLabel, CRhinoRotationGripUserInterfaceObject, CRhinoDirectionGripUserInterfaceObject, CRhinoGripUserInterfaceObject, and CRhinoTextDotUserInterfaceObject.

◆ GetData() [1/5]

bool CRhinoUserInterfaceObject::GetData ( const wchar_t *  key,
bool &  value 
) const

◆ GetData() [2/5]

bool CRhinoUserInterfaceObject::GetData ( const wchar_t *  key,
double &  value 
) const

◆ GetData() [3/5]

bool CRhinoUserInterfaceObject::GetData ( const wchar_t *  key,
int &  value 
) const

◆ GetData() [4/5]

bool CRhinoUserInterfaceObject::GetData ( const wchar_t *  key,
ON_UUID value 
) const

◆ GetData() [5/5]

bool CRhinoUserInterfaceObject::GetData ( const wchar_t *  key,
ON_wString value 
) const

◆ HasKeyboardFocus()

bool CRhinoUserInterfaceObject::HasKeyboardFocus ( ) const

Description: Does this object have keyboard focus. Only one user interface object has keyboard focus at a time, and only that object is sent characters and keys. Everything typed in a viewport goes to the command line as usual when no object has focus, or when the object with focus does not use the key.

◆ HasMouseCapture()

bool CRhinoUserInterfaceObject::HasMouseCapture ( ) const

Description: Does this object have mouse capture. Mouse capture is typically set when the mouse is down and dragging ui objects around. Only one object has mouse capture at any given time

◆ IsBoundToActiveViewport()

bool CRhinoUserInterfaceObject::IsBoundToActiveViewport ( ) const

◆ IsBoundToViewport()

unsigned int CRhinoUserInterfaceObject::IsBoundToViewport ( ) const

◆ IsMouseOver()

virtual bool CRhinoUserInterfaceObject::IsMouseOver ( const CRhinoMouseEventArgs mouse)
virtual

◆ KeyboardFocusReason()

static FocusReason CRhinoUserInterfaceObject::KeyboardFocusReason ( )
static

Description: Why the object that has keyboard focus was given it. Read this from OnKeyboardFocusChanged; it means nothing once focus has moved on.

◆ MoveKeyboardFocusToSibling()

bool CRhinoUserInterfaceObject::MoveKeyboardFocusToSibling ( bool  forward,
CRhinoDoc doc 
)

Description: Give keyboard focus to the control that comes after this one, or before it, among the controls in the same container. Tab order is the order the controls were added in and it wraps around at the ends. Controls that are hidden or that do not accept keyboard focus are passed over. Parameters: forward - [in] true moves on to the next control, false back to the previous doc - [in] document to redraw, can be nullptr Returns: True when focus moved to another control. False when this control is not in a container, or when no other control in it will take focus.

◆ OnCharacter()

virtual bool CRhinoUserInterfaceObject::OnCharacter ( unsigned int  character,
unsigned int  flags 
)
virtual

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 in CRhinoUserInterfaceTextBox, and CRhinoUserInterfaceRadioButton.

◆ OnKeyboardFocusChanged()

virtual void CRhinoUserInterfaceObject::OnKeyboardFocusChanged ( bool  hasFocus)
virtual

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

Reimplemented in CRhinoUserInterfaceTextBox, and CRhinoUserInterfaceRadioButton.

◆ OnKeyDown()

virtual bool CRhinoUserInterfaceObject::OnKeyDown ( unsigned int  virtualKey,
unsigned int  flags 
)
virtual

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 in CRhinoUserInterfaceTextBox, and CRhinoUserInterfaceRadioButton.

◆ OnMouseClick()

virtual void CRhinoUserInterfaceObject::OnMouseClick ( const CRhinoMouseEventArgs mouse)
virtual

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

Reimplemented in CRhinoUserInterfaceRadioButton, and CRhinoUserInterfaceCheckBox.

◆ OnMouseDoubleClick()

virtual void CRhinoUserInterfaceObject::OnMouseDoubleClick ( const CRhinoMouseEventArgs mouse)
virtual

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

Reimplemented in CRhinoUserInterfaceGrid, and CRhinoUserInterfaceTextBox.

◆ OnMouseDown()

virtual void CRhinoUserInterfaceObject::OnMouseDown ( const CRhinoMouseEventArgs mouse)
virtual

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

Reimplemented in CRhinoUserInterfaceGrid, CRhinoUserInterfaceTextBox, CRhinoUserInterfaceSlider, CRhinoUserInterfaceRadioButton, CRhinoUserInterfaceCheckBox, CRhinoUserInterfaceButton, CRhinoDirectionGripUserInterfaceObject, and CRhinoGripUserInterfaceObject.

◆ OnMouseEnter()

virtual void CRhinoUserInterfaceObject::OnMouseEnter ( const CRhinoMouseEventArgs mouse)
virtual

◆ OnMouseLeave()

virtual void CRhinoUserInterfaceObject::OnMouseLeave ( const CRhinoMouseEventArgs mouse)
virtual

◆ OnMouseMove()

virtual void CRhinoUserInterfaceObject::OnMouseMove ( const CRhinoMouseEventArgs mouse)
virtual

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

Reimplemented in CRhinoUserInterfaceGrid, CRhinoUserInterfaceTextBox, CRhinoUserInterfaceSlider, CRhinoDirectionGripUserInterfaceObject, and CRhinoGripUserInterfaceObject.

◆ OnMouseUp()

virtual void CRhinoUserInterfaceObject::OnMouseUp ( const CRhinoMouseEventArgs mouse)
virtual

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

Reimplemented in CRhinoUserInterfaceGrid, CRhinoUserInterfaceTextBox, CRhinoUserInterfaceSlider, CRhinoUserInterfaceRadioButton, CRhinoUserInterfaceCheckBox, CRhinoUserInterfaceButton, CRhinoDirectionGripUserInterfaceObject, and CRhinoGripUserInterfaceObject.

◆ OnMouseWheel()

virtual void CRhinoUserInterfaceObject::OnMouseWheel ( const CRhinoMouseEventArgs mouse,
int  delta 
)
virtual

Description: Called when a mouse wheel event occurs over this user interface object. The control needs to explicitly enable mouse wheel support (default off) in order to receive these events

Reimplemented in CRhinoUserInterfaceGrid.

◆ OnRunCommand()

virtual CRhinoCommand::result CRhinoUserInterfaceObject::OnRunCommand ( const CRhinoCommandContext context,
const CRhinoMouseEventArgs mouse 
)
virtual

Description: Called after the above RunCommand function is called. This will be executing while inside a Rhino command.

◆ OnTrackpadScroll()

virtual void CRhinoUserInterfaceObject::OnTrackpadScroll ( const CRhinoMouseEventArgs mouse,
float  horizontal,
float  vertical 
)
virtual

Description: Called when a trackpad scroll event occurs and the mouse is over this user interface control. The control also needs to explicitly turn on track pad scroll support (default off) in order to receive these events.

Reimplemented in CRhinoUserInterfaceGrid.

◆ Parent() [1/2]

CRhinoUserInterfaceObject* CRhinoUserInterfaceObject::Parent ( )

◆ Parent() [2/2]

const CRhinoUserInterfaceObject* CRhinoUserInterfaceObject::Parent ( ) const

◆ ReceivesMouseWheelEvents()

bool CRhinoUserInterfaceObject::ReceivesMouseWheelEvents ( ) const

◆ ReceivesTrackpadScrollEvents()

bool CRhinoUserInterfaceObject::ReceivesTrackpadScrollEvents ( ) const

◆ RegisterForAllDocuments()

bool CRhinoUserInterfaceObject::RegisterForAllDocuments ( )

◆ ReleaseKeyboardFocus()

void CRhinoUserInterfaceObject::ReleaseKeyboardFocus ( CRhinoDoc doc)
protected

Description: Give up keyboard focus. Does nothing when this object does not have it.

◆ RunCommand()

void CRhinoUserInterfaceObject::RunCommand ( const CRhinoMouseEventArgs mouse)

Description: Call RunCommand to have the virtual OnRunCommand function executed in the scope of a command. If you are modifying the document in a mouse function, this is the best approach to do so.

◆ RuntimeSerialNumber()

unsigned int CRhinoUserInterfaceObject::RuntimeSerialNumber ( ) const

◆ SetCursor()

void CRhinoUserInterfaceObject::SetCursor ( HCURSOR  cursor)

Description: Set mouse cursor that will be displayed when the mouse is "over" this object

◆ SetData() [1/5]

void CRhinoUserInterfaceObject::SetData ( const wchar_t *  key,
bool  value 
)

◆ SetData() [2/5]

void CRhinoUserInterfaceObject::SetData ( const wchar_t *  key,
const wchar_t *  value 
)

◆ SetData() [3/5]

void CRhinoUserInterfaceObject::SetData ( const wchar_t *  key,
double  value 
)

◆ SetData() [4/5]

void CRhinoUserInterfaceObject::SetData ( const wchar_t *  key,
int  value 
)

◆ SetData() [5/5]

void CRhinoUserInterfaceObject::SetData ( const wchar_t *  key,
ON_UUID  value 
)

◆ SetDisplayOrder()

void CRhinoUserInterfaceObject::SetDisplayOrder ( int  order)

◆ SetKeyboardFocus()

void CRhinoUserInterfaceObject::SetKeyboardFocus ( CRhinoDoc doc,
FocusReason  reason = FocusReason::Unknown 
)
protected

Description: Take keyboard focus. The object that had it, if any, is told that it lost it. The reason is what KeyboardFocusReason hands back for as long as this object keeps focus.

◆ SetMouseCapture()

void CRhinoUserInterfaceObject::SetMouseCapture ( CRhinoDoc doc)
protected

◆ SetReceivesMouseWheelEvents()

void CRhinoUserInterfaceObject::SetReceivesMouseWheelEvents ( bool  enable)

◆ SetReceivesTrackpadScrollEvents()

void CRhinoUserInterfaceObject::SetReceivesTrackpadScrollEvents ( bool  enable)

◆ SetTooltip()

void CRhinoUserInterfaceObject::SetTooltip ( const wchar_t *  tooltip)

Description: Set or clear the tooltip string for this object

◆ SetVisible()

void CRhinoUserInterfaceObject::SetVisible ( bool  visible)

◆ UnregisterFromAllDocuments()

bool CRhinoUserInterfaceObject::UnregisterFromAllDocuments ( )

◆ Visible()

bool CRhinoUserInterfaceObject::Visible ( ) const

Friends And Related Function Documentation

◆ CRhinoDisplayPipeline

friend class CRhinoDisplayPipeline
friend

◆ CRhinoDisplayWindowBase

friend class CRhinoDisplayWindowBase
friend

◆ CRhinoDoc

friend class CRhinoDoc
friend

◆ CRhinoObjRef

friend class CRhinoObjRef
friend

◆ CRhinoUserInterfaceGrid

friend class CRhinoUserInterfaceGrid
friend

◆ CRhUserInterfaceObjectPrivate

friend class CRhUserInterfaceObjectPrivate
friend

◆ CRhViewBase

friend class CRhViewBase
friend

Member Data Documentation

◆ m_private

class CRhUserInterfaceObjectPrivate* CRhinoUserInterfaceObject::m_private = nullptr
protected