Rhino C++ API
8.14
|
#include <RhinoSdkUiButton.h>
Public Types | |
enum | image_list { il_normal = 0, il_disabled, force_32bit_image_list = 0xFFFFFFFF } |
enum | mouse_down_button { mdb_left = 0, mdb_right, mdb_middle } |
Public Member Functions | |
CRhinoUiButton () | |
virtual | ~CRhinoUiButton () |
COLORREF | ButtonColor () const |
bool | ButtonIsHot () const |
void | DrawButtonBitmap (CDC &dc, CRect r) |
bool | DrawButtonFrame () const |
void | DrawButtonText (CDC &dc, CRect rText) |
virtual void | DrawItem (LPDRAWITEMSTRUCT) |
CImageList * | GetImageList (image_list il) const |
CSize | GetImageListImageSize (image_list il) const |
int | GetImageListIndex (image_list il) const |
const wchar_t * | GetToolTipText () const |
bool | IsBitmapButton () const |
bool | IsColorButton () const |
bool | IsMenuButton () const |
virtual bool | OnColorButtonClicked () |
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct) |
void | OnCustomMouseButtonDown () |
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point) |
Event handlers. More... | |
afx_msg void | OnLButtonUp (UINT nFlags, CPoint point) |
afx_msg void | OnMButtonDown (UINT nFlags, CPoint point) |
afx_msg void | OnMButtonUp (UINT nFlags, CPoint point) |
afx_msg void | OnMouseMove (UINT nFlags, CPoint point) |
afx_msg void | OnPaint () |
afx_msg void | OnRButtonDown (UINT nFlags, CPoint point) |
afx_msg void | OnRButtonUp (UINT nFlags, CPoint point) |
afx_msg void | OnTimer (UINT_PTR nIDEvent) |
void | SetButtonColor (COLORREF cr=ON_UNSET_COLOR) |
CImageList * | SetImageList (CImageList *pImageList, image_list il) |
int | SetImageListIndex (int iIndex, image_list il) |
bool | SetIsMenuButton (bool b) |
bool | SetSuppressButtonFrameWhenNotHot (bool b) |
void | SetSuppressTextWhenEnabled (bool b) |
void | SetToolTipText (const wchar_t *lpsTip) |
bool | SuppressButtonFrameWhenNotHot () const |
bool | SuppressTextWhenEnabled () const |
Public Attributes | |
class CRhUiButtonExtension * | m__button_sdk_extension |
Static Public Attributes | |
static const UINT | m_on_color_changed_msg_id |
static const UINT | m_on_menu_button_down |
static const UINT | m_on_mouse_button_down |
Protected Types | |
enum | { tool_tip_timer = 100, tool_tip_cleanup_timer = 101, tool_tip_cleanup_delay = 500, track_mode_no_track = 0, track_mode_no_button_down = 1, track_mode_lbutton_down = 2, track_mode_mbutton_down = 3, track_mode_rbutton_down = 4, force_32bit_button = 0xFFFFFFFF } |
Protected Member Functions | |
void | EndTracking () |
void | EndTrackToolTip () |
bool | MakeOwnerDraw () |
bool | MouseOkToDisplayToolTip () |
bool | MouseOverThisButton () |
virtual BOOL32 | OnChildNotify (UINT message, WPARAM wParam, LPARAM lParam, LRESULT *pLResult) |
bool | OnMouseButtonDown (mouse_down_button mdb, UINT nFlags, CPoint point) |
bool | OnMouseButtonUp (mouse_down_button mdb, UINT nFlags, CPoint point) |
virtual void | PreSubclassWindow () |
CWnd overrides. More... | |
virtual BOOL32 | PreTranslateMessage (MSG *pMsg) |
bool | StartTracking () |
bool | ToolTipIsVisible () const |
bool | TrackToolTip (bool bShow, LPRECT lpR) |
virtual LRESULT | WindowProc (UINT message, WPARAM wParam, LPARAM lParam) |
Protected Attributes | |
bool | m_bIsMenuButton |
bool | m_bSuppressButtonFrameWhenNotHot |
bool | m_bSuppressTextWhenEnabled |
COLORREF | m_crButton |
Color button properties. More... | |
CImageList * | m_image_list_disabled |
int | m_image_list_disabled_index |
CImageList * | m_image_list_normal |
Bitmap button properties. More... | |
int | m_image_list_normal_index |
CSize | m_image_size_disabled |
CSize | m_image_size_normal |
CRect | m_rToolTip |
int | m_track_mode |
Tooltip. More... | |
bool | m_traking_over_button |
ON_wString | m_wToolTip |
Static Protected Attributes | |
static CRhinoUiToolTip | m_tooltip |
/ / Copyright (c) 1993-2007 Robert McNeel & Associates. All rights reserved. / Rhinoceros is a registered trademark of Robert McNeel & Associates. / / THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. / ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF / MERCHANTABILITY ARE HEREBY DISCLAIMED. /
/ For complete Rhino SDK copyright information see http://www.rhino3d.com/developer. / //////////////////////////////////////////////////////////////
|
protected |
CRhinoUiButton::CRhinoUiButton | ( | ) |
|
virtual |
COLORREF CRhinoUiButton::ButtonColor | ( | ) | const |
Description: Call this method to determine the current button face color.
Returns: Returns the current button face color. If the color is ON_UNSET_COLOR then this is not a color button.
See Also: CRhinoUiButton::SetButtonColor() CRhinoUiButton::IsColorButton()
bool CRhinoUiButton::ButtonIsHot | ( | ) | const |
Description: Call this method to determine if the mouse is currently over this button.
Returns: Returns true if the mouse is currently over this button, otherwise; returns false.
void CRhinoUiButton::DrawButtonBitmap | ( | CDC & | dc, |
CRect | r | ||
) |
Description: Helper function for owner draw buttons. Transparently draw button bitmap to specified device context.
Parameters: dc [in] Device context to draw to. r [in] Bounding rectangle button image.
bool CRhinoUiButton::DrawButtonFrame | ( | ) | const |
Description: Helper function for owner draw buttons. Call this method to determine wether or not the button frame should be drawn.
Returns: Returns true if button frame should be drawn at this time.
void CRhinoUiButton::DrawButtonText | ( | CDC & | dc, |
CRect | rText | ||
) |
Description: Helper function for owner draw buttons. Transparently draw button text (if it has text) to specified device context.
Parameters: dc [in] Device context to draw to. rText [in] Bounding rectangle for text in device context coordinate system.
|
virtual |
|
protected |
Description: Call this method to end capture and clear all tracking flags.
See Also: CRhinoUiButton::StartTracking()
|
protected |
Description: Call this method to close the tool tip and reset all tracking tool tip properties.
See Also: CRhinoUiButton::SetToolTipText() CRhinoUiButton::EndTrackToolTip()
CImageList* CRhinoUiButton::GetImageList | ( | image_list | il | ) | const |
Description: This method retrieves the handle to an image list used when drawing button face.
Parameters: il [in] Specifies the type of image list. It can be one of these values: il_normal - Image list with enabled buttons il_disabled - Image list with disabled buttons.
Returns: Returns a pointer to the image list used for drawing button face.
See Also: CRhinoUiButton::SetImageList() CRhinoUiButton::IsBitmapButton()
CSize CRhinoUiButton::GetImageListImageSize | ( | image_list | il | ) | const |
Description: This method retrieves the bitmap size for a single bitmap in the image list.
Parameters: il [in] Specifies the type of image list. It can be one of these values: il_normal - Image list with enabled buttons il_disabled - Image list with disabled buttons.
Returns: Returns individual bitmap size.
See Also: CRhinoUiButton::SetImageList() CRhinoUiButton::GetImageList()
int CRhinoUiButton::GetImageListIndex | ( | image_list | il | ) | const |
Description: This method retrieves the index of an image for the button face for bitmap.
Parameters: il [in] Specifies the type of image list. It can be one of these values: il_normal - Image list with enabled buttons il_disabled - Image list with disabled buttons.
Returns: Returns the index of the image to be used when drawing the button face.
See Also: CRhinoUiButton::SetImageListIndex() CRhinoUiButton::SetImageList() CRhinoUiButton::GetImageList()
const wchar_t* CRhinoUiButton::GetToolTipText | ( | ) | const |
Description: Use the following method to get the tool tip text associated with this button.
Returns: Returns tool tip text associated with this button.
See Also: CRhinoUiButton::SetToolTipText()
bool CRhinoUiButton::IsBitmapButton | ( | ) | const |
Description: This method is used to determine if a button is a bitmap button. A button is a bitmap button if SetImageList() has been called assigning at least a normal image list and SetImageListIndex() has been called.
Returns: Returns true if a button a bitmap will be used when drawing the button face.
See Also: CRhinoUiButton::GetImageListIndex() CRhinoUiButton::SetImageList() CRhinoUiButton::GetImageList()
bool CRhinoUiButton::IsColorButton | ( | ) | const |
Description: Call this method to determine if this button is a color button.
Returns: Returns true if SetButtonColor has been called with a color other than ON_UNSET_COLOR otherwise returns false.
See Also: CRhinoUiButton::ButtonColor() CRhinoUiButton::SetButtonColor()
bool CRhinoUiButton::IsMenuButton | ( | ) | const |
Description: If this returns true and the button is owner draw then the button will act like a menu bar item.
Returns: Returns true if button should be drawn like a menu
See Also: CRhinoUiButton::SetIsMenuButton()
|
protected |
Description: This method is called when a button is created to decide whether or not to force the button to be owner draw. If a button color is set prior to creating the button or an image list assigned then the button will become owner draw.
Returns: Returns true if button should be forced to be owner draw.
See Also: CRhinoUiButton::IsColorButton() CRhinoUiButton::IsBitmapButton()
|
protected |
Description: Call this method to determine it the tool tip should be displayed.
Returns: Returns true if tool tip should be displayed, otherwise; returns false.
See Also: CRhinoUiButton::SetToolTipText() CRhinoUiButton::TrackToolTip() CRhinoUiButton::EndTrackToolTip()
|
protected |
Description: Call this method to determine if the mouse is currently over this button.
Returns: Returns true if the mouse is currently over this button, otherwise; returns false.
|
protectedvirtual |
|
virtual |
Description: This method is called when a color button is clicked. The default implementation displays the Rhino color dialog and invalidates the button if a new color is selected.
Returns: Returns true if color was changed or false if not.
See Also: CRhinoUiButton::SetColor() CRhinoUiButton::IsColorButton()
Reimplemented in CRhinoUiColorButton.
afx_msg int CRhinoUiButton::OnCreate | ( | LPCREATESTRUCT | lpCreateStruct | ) |
void CRhinoUiButton::OnCustomMouseButtonDown | ( | ) |
Description: This MUST be called if your CRhinoUiButton::m_on_mouse_button_down handler returns a value greater than zero to clean up the button state.
See Also: CRhinoUiButton::m_on_mouse_button_down
afx_msg void CRhinoUiButton::OnLButtonDown | ( | UINT | nFlags, |
CPoint | point | ||
) |
Event handlers.
afx_msg void CRhinoUiButton::OnLButtonUp | ( | UINT | nFlags, |
CPoint | point | ||
) |
afx_msg void CRhinoUiButton::OnMButtonDown | ( | UINT | nFlags, |
CPoint | point | ||
) |
afx_msg void CRhinoUiButton::OnMButtonUp | ( | UINT | nFlags, |
CPoint | point | ||
) |
|
protected |
Description: This method is called by mouse event handlers.
Parameters: mbd [in] Identifies button sending the message. nFlags [in] Indicates whether various virtual keys are down. See OnLButtonDown in MSDN for details. point [in] Specifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window.
Returns: Returns true if this method handled the message indicating the calling method should not call the base class. If false is returned then the calling method should call the base class.
See Also: CWnd::OnLButtonDown() CRhinoUiButton::OnMouseButtonUp()
|
protected |
Description: This method is called by mouse event handlers.
Parameters: mbd [in] Identifies button sending the message. nFlags [in] Indicates whether various virtual keys are down. See OnLButtonUp in MSDN for details. point [in] Specifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window.
Returns: Returns true if this method handled the message indicating the calling method should not call the base class. If false is returned then the calling method should call the base class.
See Also: CWnd::OnLButtonDown() CRhinoUiButton::OnMouseButtonDown()
afx_msg void CRhinoUiButton::OnMouseMove | ( | UINT | nFlags, |
CPoint | point | ||
) |
afx_msg void CRhinoUiButton::OnPaint | ( | ) |
afx_msg void CRhinoUiButton::OnRButtonDown | ( | UINT | nFlags, |
CPoint | point | ||
) |
afx_msg void CRhinoUiButton::OnRButtonUp | ( | UINT | nFlags, |
CPoint | point | ||
) |
afx_msg void CRhinoUiButton::OnTimer | ( | UINT_PTR | nIDEvent | ) |
|
protectedvirtual |
CWnd overrides.
|
protectedvirtual |
void CRhinoUiButton::SetButtonColor | ( | COLORREF | cr = ON_UNSET_COLOR | ) |
Description: Setting the button color to anything other than ON_UNSET_COLOR will cause the button to become a color button. This is only valid if this is an owner draw button.
Parameters: cr [in] Color to paint the button face
See Also: CRhinoUiButton::ButtonColor() CRhinoUiButton::IsColorButton()
CImageList* CRhinoUiButton::SetImageList | ( | CImageList * | pImageList, |
image_list | il | ||
) |
Description: This method assigns an image list to a button. You must call this method prior to creating the button or create the button as owner draw for this to be affective.
Parameters: pImageList [in] Specifies the pointer to the image list to assign. il [in] Specifies the type of image list. It can be one of these values: il_normal - Image list with enabled buttons il_disabled - Image list with disabled buttons. Returns: Returns a pointer to the previous image list.
See Also: CRhinoUiButton::GetImageList() CRhinoUiButton::IsBitmapButton()
int CRhinoUiButton::SetImageListIndex | ( | int | iIndex, |
image_list | il | ||
) |
Description: This method assigns the index of an image for the button face for bitmap.
Parameters: iIndex [in] Specifies the image index for the button face bitmap. il [in] Specifies the type of image list. It can be one of these values: il_normal - Image list with enabled buttons il_disabled - Image list with disabled buttons.
Returns: Returns the index of the image to be used when drawing the button face.
See Also: CRhinoUiButton::GetImageListIndex() CRhinoUiButton::SetImageList() CRhinoUiButton::GetImageList()
bool CRhinoUiButton::SetIsMenuButton | ( | bool | b | ) |
Description: If this returns true and the button is owner draw then the button will act like a menu bar item.
Parameters: b [in] If true then the button will be drawn like a menu item
Returns: Returns previous state.
See Also: CRhinoUiButton::IsMenuButton()
bool CRhinoUiButton::SetSuppressButtonFrameWhenNotHot | ( | bool | b | ) |
Description: Call this method to make owner draw button draw its frame only when hot or active.
Parameters: b [in] If true then button frame will only draw when the mouse is not over the button.
Returns: Returns previous value.
void CRhinoUiButton::SetSuppressTextWhenEnabled | ( | bool | b | ) |
Description: Call this method to make a color button display text when enabled. By default text is suppressed for enabled buttons.
Parameters: b [in] If true then text is displayed on color buttons when enabled.
See Also: CRhinoUiButton::SetColor() CRhinoUiButton::IsColorButton()
void CRhinoUiButton::SetToolTipText | ( | const wchar_t * | lpsTip | ) |
Description: Use the following method to set the tool tip text associated with this button.
Parameters: lpsTip [in] Tool tip text to associate with this button.
See Also: CRhinoUiButton::GetToolTipText()
|
protected |
Description: Call this method to capture the mouse and begin tracking. The default tracking mode is track_mode_no_button_down
Returns: If mouse is captured true is returned, otherwise false is returned.
See Also: CRhinoUiButton::track_mode_no_button_down CRhinoUiButton::EndTracking()
bool CRhinoUiButton::SuppressButtonFrameWhenNotHot | ( | ) | const |
Description: Check to see if owner draw button should draw its frame when not hot or active.
Returns: Returns true if button frame will only be drawn when mouse is over the button.
See Also: CRhinoUiButton::SetSuppressButtonFrameWhenNotHot()
bool CRhinoUiButton::SuppressTextWhenEnabled | ( | ) | const |
Description: Call this method to determine if text should be displayed on a color button when it is enabled. Color buttons will paint using the ::GetSystemColor( COLOR_BTNFACE) color and display text when disabled.
Returns: Returns true if button text should be displayed on enabled color button.
See Also: CRhinoUiButton::SetColor() CRhinoUiButton::IsColorButton()
|
protected |
Description: Call this method to determine if the button tool tip is currently visible.
Returns: If the tool tip has been created and is visible true is returned otherwise false is.
See Also: CRhinoUiButton::SetToolTipText() CRhinoUiButton::TrackToolTip() CRhinoUiButton::EndTrackToolTip()
|
protected |
Description: Call this method to display or hide the tool tip associated with this button.
Parameters: bShow [in] If true then the tool tip will be displayed if this button as tool tip text. lpR [in] Button window rectangle, the tool tip will be displayed below this if possible.
Returns: Returns true if tool tip was displayed or hidden successfully.
See Also: CRhinoUiButton::SetToolTipText() CRhinoUiButton::EndTrackToolTip()
|
protectedvirtual |
class CRhUiButtonExtension* CRhinoUiButton::m__button_sdk_extension |
For internal use only! Reserved for future use.
|
protected |
|
protected |
|
protected |
|
protected |
Color button properties.
|
protected |
|
protected |
|
protected |
Bitmap button properties.
|
protected |
|
protected |
|
protected |
|
static |
Use the following macro in your dialogs message map to receive notification when a color button is clicked and a new color value was specified: ON_REGISTERED_MESSAGE( CRhinoUiButton::m_on_color_changed_msg_id, OnRhinoUiColorButtonColorChanged) Method prototype: afx_msg LRESULT OnRhinoUiColorButtonColorChanged( WPARAM wParam, LPARAM lParam); The WPARAM and LPARAM are the same as BN_CLICKED notification.
|
static |
Description: Registered windows message sent by a IsMenuButton() when pressed
|
static |
Use the following macro in your dialogs message map to receive notification when a mouse button goes down over a button. ON_REGISTERED_MESSAGE( CRhinoUiButton::m_on_mouse_button_down, OnRhinoUiButtonMouseDown) Method prototype: afx_msg LRESULT OnRhinoUiButtonMouseDown( WPARAM wParam, LPARAM lParam); wParam The low-order word contains the button's control identifier. The high-order word specifies which mouse button went down. See "enum mouse_down_button" above. lParam Window handle for the button. Return a value greater than zero to handle the mouse event yourself. NOTE: You must call CRhinoUiButton::OnCustomMouseButtonDown() if you return a value greater than zero so the button state can be correctly set.
|
protected |
|
staticprotected |
|
protected |
Tooltip.
|
protected |
|
protected |