Public Types | Public Member Functions

IViewportButton Class Reference

This reference page is linked to from the following overview topics: Incremental Improvements, Viewport Button.


Search for all occurrences

Detailed Description

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>

Inheritance diagram for IViewportButton:
Inheritance graph
[legend]

List of all members.

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.

Member Enumeration Documentation

enum Action

Constructor & Destructor Documentation

IViewportButton ( ) [inline]
{};
virtual ~IViewportButton ( ) [inline, virtual]
{};

Member Function Documentation

virtual bool GetEnabled ( ) const [pure virtual]

Access to the enabled flag.

Returns:
TRUE if enabled

Implemented in ViewportTextButton.

virtual void SetEnabled ( bool  v ) [pure virtual]

Set the Enabled flag.

If set to false, the button will not be drawn

Parameters:
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.

Returns:
A string containing the current label to be displayed.

Implemented in ViewportTextButton.

virtual void SetLabel ( MSTR label ) [pure virtual]

Set the text to be displayed in the viewport.

Parameters:
&label The string to set.

Implemented in ViewportTextButton.

virtual IPoint2 GetLocation ( ) const [pure virtual]

Get the current location for the button.

Returns:
The location of the button

Implemented in ViewportTextButton.

virtual void SetLocation ( IPoint2 loc ) [pure virtual]

Set the location of the button.

Parameters:
&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.

Parameters:
&c The color for button

Implemented in ViewportTextButton.

virtual Color GetColor ( ) const [pure virtual]

Get the current color for the button.

Returns:
The current color

Implemented in ViewportTextButton.

virtual bool ShowInActiveViewportOnly ( ) [pure virtual]

Defines whether the button is only shown in the current active viewport.

Returns:
TRUE if only drawn in the 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.

Parameters:
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
Returns:
TRUE if an action was performed.

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.

Parameters:
hwnd The Window handle issueing the update request
*vpt A pointer to current View
Returns:
TRUE if an update was implemented.

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.

Parameters:
t The current time
*vpt THe viewport to draw into
flags

Implemented in ViewportTextButton.

virtual void GetViewportRect ( TimeValue  t,
ViewExp vpt,
Rect rect 
) [pure virtual]

Get the viewport rect for the button.

Parameters:
t The current time
*vpt The active viewport
*rect The result of the viewport rect is stored here.

Implemented in ViewportTextButton.


IViewportButton IViewportButton IViewportButton IViewportButton IViewportButton IViewportButton IViewportButton IViewportButton IViewportButton IViewportButton
IViewportButton IViewportButton IViewportButton IViewportButton IViewportButton IViewportButton IViewportButton IViewportButton IViewportButton IViewportButton