This reference page is linked to from the following overview topics: Viewport Button.
A simple text based button implementation of the IViewportButton.
A new viewport text button that is used to cerate the new viewport buttons in 3ds max 2010 It create a [XXXXX] button format, and support mouse over high lights. Developers can derive from this class to provide their own actions and update functions. TO use this class you must import CORE.LIB into your projects.
Please read the IViewportButton help section for an explanation of the methods.
#include <IViewportButton.h>
Public Member Functions |
|
CoreExport | ViewportTextButton () |
CoreExport | ~ViewportTextButton () |
CoreExport bool | GetEnabled () const |
Access to the enabled flag. |
|
CoreExport void | SetEnabled (bool v) |
Set the Enabled flag. |
|
CoreExport MSTR | GetLabel () const |
Access to the button text to be displayed in
the viewport. |
|
CoreExport void | SetLabel (MSTR &label) |
The developer simply sends in an unformated
string, this class will then format it correct to [ XXXXX ].
|
|
CoreExport IPoint2 | GetLocation () const |
Get the current location for the button.
|
|
CoreExport void | SetLocation (IPoint2 &loc) |
Set the location of the button. |
|
CoreExport void | SetColor (Color &c) |
The default color will be defined by
Viewport Text CUI entry. |
|
CoreExport Color | GetColor () const |
Get the current color for the button.
|
|
CoreExport bool | ShowInActiveViewportOnly () |
Defines whether the button is only shown in
the current active viewport. |
|
CoreExport bool | OnAction (HWND hwnd, GraphicsWindow *gw, IPoint2 hitLoc, IViewportButton::Action action) |
Implementation of OnAction. |
|
CoreExport bool | OnUpdate (HWND hwnd, ViewExp *vpt) |
An update callback that can be used to
update internal data structures. |
|
CoreExport void | Display (TimeValue t, ViewExp *vpt, int flags) |
Callback to display the button. |
|
CoreExport void | GetViewportRect (TimeValue t, ViewExp *vpt, Rect *rect) |
Get the viewport rect for the button.
|
|
Protected Attributes |
|
bool | mEnabled |
MSTR | mButtonText |
MSTR | mLabel |
IPoint2 | mLocation |
Color | mColor |
bool | mMouseOver |
bool | mOldMouseOver |
CoreExport ViewportTextButton | ( | ) |
CoreExport ~ViewportTextButton | ( | ) |
CoreExport bool GetEnabled | ( | ) | const [virtual] |
CoreExport void SetEnabled | ( | bool | v | ) | [virtual] |
Set the Enabled flag.
If set to false, the button will not be drawn
v | TRUE to enable, FALSE to disable the button. |
Implements IViewportButton.
CoreExport MSTR GetLabel | ( | ) | const [virtual] |
Access to the button text to be displayed in the viewport.
Implements IViewportButton.
CoreExport void SetLabel | ( | MSTR & | label | ) | [virtual] |
The developer simply sends in an unformated string, this class will then format it correct to [ XXXXX ].
Implements IViewportButton.
CoreExport IPoint2 GetLocation | ( | ) | const [virtual] |
Get the current location for the button.
Implements IViewportButton.
CoreExport void SetLocation | ( | IPoint2 & | loc | ) | [virtual] |
Set the location of the button.
&loc | The new location for the button |
Implements IViewportButton.
CoreExport void SetColor | ( | Color & | c | ) | [virtual] |
The default color will be defined by Viewport Text CUI entry.
There is a new entry called Viewport Text Highlight that defines the mouse over color
Implements IViewportButton.
CoreExport Color GetColor | ( | ) | const [virtual] |
CoreExport bool ShowInActiveViewportOnly | ( | ) | [virtual] |
Defines whether the button is only shown in the current active viewport.
Implements IViewportButton.
CoreExport bool OnAction | ( | HWND | hwnd, |
GraphicsWindow * | gw, | ||
IPoint2 | hitLoc, | ||
IViewportButton::Action | action | ||
) | [virtual] |
Implementation of OnAction.
Developers must perform hittesting in there derived function and update the mMouseOver flag, followed by calling the base implementation. This is to allow the mouse over highlighting to work.
Implements IViewportButton.
CoreExport bool OnUpdate | ( | HWND | hwnd, |
ViewExp * | vpt | ||
) | [virtual] |
An update callback that can be used to update internal data structures.
The ViewportTextButton uses this to determine the Label to be used and location based on the current viewport being drawn.
hwnd | The Window handle issueing the update request |
*vpt | A pointer to current View |
Implements IViewportButton.
CoreExport void Display | ( | TimeValue | t, |
ViewExp * | vpt, | ||
int | flags | ||
) | [virtual] |
Callback to display the button.
The ViewportTextButton uses this to draw text into the viewport using GraphicsWindow API. All drawing should go through this API - no GDI.
t | The current time |
*vpt | THe viewport to draw into |
flags |
Implements IViewportButton.
Get the viewport rect for the button.
t | The current time |
*vpt | The active viewport |
*rect | The result of the viewport rect is stored here. |
Implements IViewportButton.
bool
mEnabled [protected] |
MSTR
mButtonText [protected] |
bool
mMouseOver [protected] |
bool
mOldMouseOver [protected] |