Rhino C++ API  9.1
Public Member Functions | Friends | List of all members
CRhinoUserInterfaceDropDown Class Reference

#include <rhinoSdkUserInterfaceObject.h>

Inheritance diagram for CRhinoUserInterfaceDropDown:
CRhinoUserInterfaceControl CRhinoUserInterfaceObject

Public Member Functions

 CRhinoUserInterfaceDropDown ()
 
virtual ~CRhinoUserInterfaceDropDown ()
 
bool AcceptsKeyboardFocus () const override
 
int AddItem (const wchar_t *text)
 
void CloseList ()
 
ON_4fRect ComputedRect (const CRhinoDisplayPipeline *pipeline, bool logicalPixels) const override
 
ON_2fSize ComputeSize () const override
 
void Draw (CRhinoDisplayPipeline &dp) override
 
bool InsertItem (int index, const wchar_t *text)
 
bool IsListOpen () const
 
bool IsMouseOver (const CRhinoMouseEventArgs &mouse) override
 
ON_wString Item (int index) const
 
int ItemCount () const
 
int MaximumVisibleItems () const
 
bool OnCharacter (unsigned int character, unsigned int flags) override
 
void OnKeyboardFocusChanged (bool hasFocus) override
 
bool OnKeyDown (unsigned int virtualKey, unsigned int flags) override
 
void OnMouseDown (const CRhinoMouseEventArgs &mouse) override
 
void OnMouseEnter (const CRhinoMouseEventArgs &mouse) override
 
void OnMouseLeave (const CRhinoMouseEventArgs &mouse) override
 
virtual void OnSelectionChanged ()
 
bool OpenList ()
 
const ON_wString & PlaceholderText () const
 
void RemoveAllItems ()
 
bool RemoveItem (int index)
 
int SelectedIndex () const
 
ON_wString SelectedItem () const
 
bool SetItem (int index, const wchar_t *text)
 
void SetMaximumVisibleItems (int count)
 
void SetPlaceholderText (const wchar_t *text)
 
void SetSelectedIndex (int index)
 
- Public Member Functions inherited from CRhinoUserInterfaceControl
 CRhinoUserInterfaceControl ()
 
virtual ~CRhinoUserInterfaceControl ()
 
ON_Color BackgroundColor () const
 
void GetAlignment (ControlHorizontalAlignment &h, ControlVerticalAlignment &v) const
 
void GetTextAlignment (ControlHorizontalAlignment &h, ControlVerticalAlignment &v) const
 
const ON_wString & ImageSVG () const
 
ON_2fPoint Location () const
 
void SetAlignment (ControlHorizontalAlignment h, ControlVerticalAlignment v)
 
void SetBackgroundColor (const ON_Color &color)
 
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_wString & Text () 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 OnMouseDoubleClick (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)
 
CRhinoUserInterfaceObject * Parent ()
 
const CRhinoUserInterfaceObject * Parent () 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 CRhUserInterfaceDropDownPrivate
 

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 CRhUserInterfaceObjectPrivate * m_private = nullptr
 

Detailed Description

Description: A drop-down list: a box that shows the item chosen, and the list of items that opens under it when the box is clicked. Choosing an item in the list, with the mouse or the keyboard, changes the selection and calls OnSelectionChanged, the virtual to override to do something about the change.

The open list is drawn over every other user interface object and over the edges of the grid the drop-down sits in. While it is open it has the mouse to itself: a click on an item chooses it, and a click anywhere else in the view closes the list and goes no further. The mouse wheel scrolls a list that is longer than MaximumVisibleItems.

The keyboard, once the drop-down has focus: Up and Down, Home and End move through the items - choosing as they go when the list is closed, the way a combo box in a dialog does, and only moving the highlight when it is open. Alt+Down, F4 or Space opens the list; Enter or Space chooses the highlighted item, Escape closes the list without changing anything and Tab moves on. A letter goes to the next item that starts with it.

The box shows the selected item, or the placeholder text when nothing is selected. CRhinoUserInterfaceControl::Text is not used.

Constructor & Destructor Documentation

◆ CRhinoUserInterfaceDropDown()

CRhinoUserInterfaceDropDown::CRhinoUserInterfaceDropDown ( )

◆ ~CRhinoUserInterfaceDropDown()

virtual CRhinoUserInterfaceDropDown::~CRhinoUserInterfaceDropDown ( )
virtual

Member Function Documentation

◆ AcceptsKeyboardFocus()

bool CRhinoUserInterfaceDropDown::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.

◆ AddItem()

int CRhinoUserInterfaceDropDown::AddItem ( const wchar_t *  text)

◆ CloseList()

void CRhinoUserInterfaceDropDown::CloseList ( )

◆ ComputedRect()

ON_4fRect CRhinoUserInterfaceDropDown::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 CRhinoUserInterfaceDropDown::ComputeSize ( ) const
overridevirtual

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

Reimplemented from CRhinoUserInterfaceControl.

◆ Draw()

void CRhinoUserInterfaceDropDown::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.

◆ InsertItem()

bool CRhinoUserInterfaceDropDown::InsertItem ( int  index,
const wchar_t *  text 
)

◆ IsListOpen()

bool CRhinoUserInterfaceDropDown::IsListOpen ( ) const

Description: Is the list open? OpenList opens it in the view the drop-down was last drawn in, or in the active view before it has been drawn, and returns false when the drop-down is hidden or has no items. Only one list is open at a time: opening one closes any other. CloseList closes it without changing the selection.

◆ IsMouseOver()

bool CRhinoUserInterfaceDropDown::IsMouseOver ( const CRhinoMouseEventArgs &  mouse)
overridevirtual

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

Reimplemented from CRhinoUserInterfaceObject.

◆ Item()

ON_wString CRhinoUserInterfaceDropDown::Item ( int  index) const

◆ ItemCount()

int CRhinoUserInterfaceDropDown::ItemCount ( ) const

Description: The items in the list, in the order they are shown. AddItem returns the index the item went in at. Inserting or removing items keeps the same item selected; removing the selected item leaves nothing selected. None of these call OnSelectionChanged.

◆ MaximumVisibleItems()

int CRhinoUserInterfaceDropDown::MaximumVisibleItems ( ) const

◆ OnCharacter()

bool CRhinoUserInterfaceDropDown::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.

◆ OnKeyboardFocusChanged()

void CRhinoUserInterfaceDropDown::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 CRhinoUserInterfaceDropDown::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.

◆ OnMouseDown()

void CRhinoUserInterfaceDropDown::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 CRhinoUserInterfaceDropDown::OnMouseEnter ( const CRhinoMouseEventArgs &  mouse)
overridevirtual

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

Reimplemented from CRhinoUserInterfaceObject.

◆ OnMouseLeave()

void CRhinoUserInterfaceDropDown::OnMouseLeave ( const CRhinoMouseEventArgs &  mouse)
overridevirtual

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

Reimplemented from CRhinoUserInterfaceObject.

◆ OnSelectionChanged()

virtual void CRhinoUserInterfaceDropDown::OnSelectionChanged ( )
virtual

Description: Called after the user chose a different item, from the list or with the keys. The base implementation does nothing.

◆ OpenList()

bool CRhinoUserInterfaceDropDown::OpenList ( )

◆ PlaceholderText()

const ON_wString& CRhinoUserInterfaceDropDown::PlaceholderText ( ) const

◆ RemoveAllItems()

void CRhinoUserInterfaceDropDown::RemoveAllItems ( )

◆ RemoveItem()

bool CRhinoUserInterfaceDropDown::RemoveItem ( int  index)

◆ SelectedIndex()

int CRhinoUserInterfaceDropDown::SelectedIndex ( ) const

Description: Index of the item chosen, -1 when nothing is. Setting it does not call OnSelectionChanged; that is only for a choice the user made. An index out of range selects nothing. SelectedItem is the text of the item chosen, empty when nothing is.

◆ SelectedItem()

ON_wString CRhinoUserInterfaceDropDown::SelectedItem ( ) const

◆ SetItem()

bool CRhinoUserInterfaceDropDown::SetItem ( int  index,
const wchar_t *  text 
)

◆ SetMaximumVisibleItems()

void CRhinoUserInterfaceDropDown::SetMaximumVisibleItems ( int  count)

Description: Most items the open list shows at once; a longer list scrolls. The default is

  1. The list also shrinks to what fits in the view.

◆ SetPlaceholderText()

void CRhinoUserInterfaceDropDown::SetPlaceholderText ( const wchar_t *  text)

Description: Text drawn, dimmed, in the box when nothing is selected

◆ SetSelectedIndex()

void CRhinoUserInterfaceDropDown::SetSelectedIndex ( int  index)

Friends And Related Function Documentation

◆ CRhUserInterfaceDropDownPrivate

friend class CRhUserInterfaceDropDownPrivate
friend