3ds Max C++ API Reference
IViewportButton Class Referenceabstract

Viewport button abstraction. More...

#include <IViewportButton.h>

+ Inheritance diagram for IViewportButton:

Public Types

enum  Action { eLeftClick = 0x0 , eRightClick , eMouseMove }
 

Public Member Functions

 IViewportButton ()
 
virtual ~IViewportButton ()
 
virtual bool GetEnabled () const =0
 Access to the enabled flag. More...
 
virtual void SetEnabled (bool v)=0
 Set the Enabled flag. More...
 
virtual MSTR GetLabel () const =0
 Access to the button text to be displayed in the viewport. More...
 
virtual void SetLabel (MSTR &label)=0
 Set the text to be displayed in the viewport. More...
 
virtual IPoint2 GetLocation () const =0
 Get the current location for the button. More...
 
virtual void SetLocation (IPoint2 &loc)=0
 Set the location of the button. More...
 
virtual void SetColor (Color &c)=0
 Set the color for the button to be used. More...
 
virtual Color GetColor () const =0
 Get the current color for the button. More...
 
virtual bool ShowInActiveViewportOnly ()=0
 Defines whether the button is only shown in the current active viewport. More...
 
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. More...
 
virtual bool OnUpdate (HWND hwnd, ViewExp *vpt)=0
 An update callback that can be used to update internal data structures. More...
 
virtual void Display (TimeValue t, ViewExp *vpt, int flags)=0
 Callback to display the button. More...
 
virtual void GetViewportRect (TimeValue t, ViewExp *vpt, Rect *rect)=0
 Get the viewport rect for the button. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

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.

Member Enumeration Documentation

◆ Action

enum Action
Enumerator
eLeftClick 
eRightClick 
eMouseMove 
83  {
84  eLeftClick = 0x0,
86  eMouseMove,
87  };
@ eMouseMove
Definition: IViewportButton.h:86
@ eLeftClick
Definition: IViewportButton.h:84
@ eRightClick
Definition: IViewportButton.h:85

Constructor & Destructor Documentation

◆ IViewportButton()

IViewportButton ( )
inline
34 {};

◆ ~IViewportButton()

virtual ~IViewportButton ( )
inlinevirtual
35 {};

Member Function Documentation

◆ GetEnabled()

virtual bool GetEnabled ( ) const
pure virtual

Access to the enabled flag.

Returns
TRUE if enabled

Implemented in ViewportTextButton.

◆ SetEnabled()

virtual void SetEnabled ( bool  v)
pure virtual

Set the Enabled flag.

If set to false, the button will not be drawn

Parameters
vTRUE to enable, FALSE to disable the button.

Implemented in ViewportTextButton.

◆ GetLabel()

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.

◆ SetLabel()

virtual void SetLabel ( MSTR label)
pure virtual

Set the text to be displayed in the viewport.

Parameters
labelThe string to set.

Implemented in ViewportTextButton.

◆ GetLocation()

virtual IPoint2 GetLocation ( ) const
pure virtual

Get the current location for the button.

Returns
The location of the button

Implemented in ViewportTextButton.

◆ SetLocation()

virtual void SetLocation ( IPoint2 loc)
pure virtual

Set the location of the button.

Parameters
locThe new location for the button

Implemented in ViewportTextButton.

◆ SetColor()

virtual void SetColor ( Color c)
pure virtual

Set the color for the button to be used.

Parameters
cThe color for button

Implemented in ViewportTextButton.

◆ GetColor()

virtual Color GetColor ( ) const
pure virtual

Get the current color for the button.

Returns
The current color

Implemented in ViewportTextButton.

◆ ShowInActiveViewportOnly()

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.

◆ OnAction()

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
hwndThe Window handle where the action we performed
gwA pointer to the GraphicsWindow
hitLocThe point where the action occured - this allows the button to perform a hittest.
actionThe type of action
Returns
TRUE if an action was performed.

Implemented in ViewportTextButton.

◆ OnUpdate()

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
hwndThe Window handle issueing the update request
vptA pointer to current View
Returns
TRUE if an update was implemented.

Implemented in ViewportTextButton.

◆ Display()

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
tThe current time
vptTHe viewport to draw into
flags

Implemented in ViewportTextButton.

◆ GetViewportRect()

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

Get the viewport rect for the button.

Parameters
tThe current time
vptThe active viewport
rectThe result of the viewport rect is stored here.

Implemented in ViewportTextButton.