This reference page is linked to from the following overview topics: Incremental Improvements, Viewport Button.
Viewport button abstraction.
The new viewport menu system is implemented using this interface. It provides control over the text to display and location to be drawn in. ViewportButtonText implements this interface to draw text based button in the viewport.
#include <IViewportButton.h>
Public Types |
|
enum | Action { eLeftClick = 0x0, eRightClick, eMouseMove } |
Public Member Functions |
|
IViewportButton () | |
virtual | ~IViewportButton () |
virtual bool | GetEnabled () const =0 |
Access to the enabled flag. |
|
virtual void | SetEnabled (bool v)=0 |
Set the Enabled flag. |
|
virtual MSTR | GetLabel () const =0 |
Access to the button text to be displayed in
the viewport. |
|
virtual void | SetLabel (MSTR &label)=0 |
Set the text to be displayed in the
viewport. |
|
virtual IPoint2 | GetLocation () const =0 |
Get the current location for the button.
|
|
virtual void | SetLocation (IPoint2 &loc)=0 |
Set the location of the button. |
|
virtual void | SetColor (Color &c)=0 |
Set the color for the button to be used.
|
|
virtual Color | GetColor () const =0 |
Get the current color for the button.
|
|
virtual bool | ShowInActiveViewportOnly ()=0 |
Defines whether the button is only shown in
the current active viewport. |
|
virtual bool | OnAction (HWND hwnd, GraphicsWindow *gw, IPoint2 hitLoc, IViewportButton::Action action)=0 |
A callback to allow the button to perform an
action, such as pop up a menu, or run a function. |
|
virtual bool | OnUpdate (HWND hwnd, ViewExp *vpt)=0 |
An update callback that can be used to
update internal data structures. |
|
virtual void | Display (TimeValue t, ViewExp *vpt, int flags)=0 |
Callback to display the button. |
|
virtual void | GetViewportRect (TimeValue t, ViewExp *vpt, Rect *rect)=0 |
Get the viewport rect for the button.
|
enum Action |
{ eLeftClick = 0x0, eRightClick, eMouseMove, };
IViewportButton | ( | ) | [inline] |
{};
virtual ~IViewportButton | ( | ) | [inline, virtual] |
{};
virtual bool GetEnabled | ( | ) | const [pure virtual] |
virtual void SetEnabled | ( | bool | v | ) | [pure virtual] |
Set the Enabled flag.
If set to false, the button will not be drawn
v | TRUE to enable, FALSE to disable the button. |
Implemented in ViewportTextButton.
virtual MSTR GetLabel | ( | ) | const [pure virtual] |
Access to the button text to be displayed in the viewport.
Implemented in ViewportTextButton.
virtual void SetLabel | ( | MSTR & | label | ) | [pure virtual] |
Set the text to be displayed in the viewport.
&label | The string to set. |
Implemented in ViewportTextButton.
virtual IPoint2 GetLocation | ( | ) | const [pure virtual] |
Get the current location for the button.
Implemented in ViewportTextButton.
virtual void SetLocation | ( | IPoint2 & | loc | ) | [pure virtual] |
Set the location of the button.
&loc | The new location for the button |
Implemented in ViewportTextButton.
virtual void SetColor | ( | Color & | c | ) | [pure virtual] |
Set the color for the button to be used.
&c | The color for button |
Implemented in ViewportTextButton.
virtual Color GetColor | ( | ) | const [pure virtual] |
virtual bool ShowInActiveViewportOnly | ( | ) | [pure virtual] |
Defines whether the button is only shown in the current active viewport.
Implemented in ViewportTextButton.
virtual bool OnAction | ( | HWND | hwnd, |
GraphicsWindow * | gw, | ||
IPoint2 | hitLoc, | ||
IViewportButton::Action | action | ||
) | [pure virtual] |
A callback to allow the button to perform an action, such as pop up a menu, or run a function.
hwnd | The Window handle where the action we performed |
gw | A pointer to the GraphicsWindow |
hitLoc | The point where the action occured - this allows the button to perform a hittest. |
action | The type of action |
Implemented in ViewportTextButton.
virtual bool OnUpdate | ( | HWND | hwnd, |
ViewExp * | vpt | ||
) | [pure 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 |
Implemented in ViewportTextButton.
virtual void Display | ( | TimeValue | t, |
ViewExp * | vpt, | ||
int | flags | ||
) | [pure 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 |
Implemented in ViewportTextButton.
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. |
Implemented in ViewportTextButton.