IViewportButtonManager Class Reference

#include <IViewportButton.h>

Class Description

A manager to control the usage of the viewport buttons.

A Manager that the developer uses to register viewport buttons. It also contains helper function to provide global hittesting and per button hittesting. The developer can use these from within the OnAction callback. The manager is not responsible for deleting the manager. The developer should Unregister and then delete the button
To use IViewportButtonManager simply use static_cast<IViewportButtonManager*>(GetCOREInterface(IVIEWPORTBUTTONMANAGER_INTERFACE ))

+ Inheritance diagram for IViewportButtonManager:

Public Member Functions

virtual void RegisterButton (IViewportButton *button)=0
 Register a new button. More...
 
virtual void UnRegisterButton (IViewportButton *button)=0
 Remove a previously registered button. More...
 
virtual bool IsButtonRegistered (IViewportButton *button) const =0
 A query to check if a button is registered. More...
 
virtual int GetNumRegisteredButtons () const =0
 The total number of buttons. More...
 
virtual IViewportButtonGetViewportButton (int index)=0
 Access an indivdual button. More...
 
virtual void EnableButtons (bool val)=0
 globally enable/disable the viewport buttons More...
 
virtual bool GetButtonsEnabled () const =0
 Globally acces whether the viewport buttons are enabled. More...
 
virtual bool OnAction (HWND hwnd, GraphicsWindow *gw, IPoint2 hitLoc, IViewportButton::Action action)=0
 Sends the OnAction command. More...
 
virtual bool OnUpdate (HWND hwnd, ViewExp *vpt)=0
 Send the OnUpdate command. More...
 
virtual bool HitTest (HWND hwnd, GraphicsWindow *gw, IPoint2 stringStartLoc, IPoint2 hitLoc, const MSTR &string)=0
 Provides a single hittest of the text. More...
 
virtual bool HitTest (HWND hwnd, GraphicsWindow *gw, IPoint2 hitLoc)=0
 Global hittesting on all registered buttons. More...
 
virtual void DrawButtons (ViewExp *vpt, Rect *rect=NULL)=0
 Render the buttons. More...
 
virtual void RefreshButtonDisplay ()=0
 Utility function for forcing a refresh of the button display. More...
 
- Public Member Functions inherited from FPInterfaceDesc
CoreExport FPInterfaceDesc ()
 
CoreExport FPInterfaceDesc (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *cd, ULONG flag,...)
 
CoreExport ~FPInterfaceDesc ()
 
virtual void Init ()
 
LifetimeType LifetimeControl ()
 
virtual BaseInterfaceGetInterface (Interface_ID id)
 
CoreExport void LoadDescriptor (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *pCD, ULONG flag,...)
 
CoreExport void AppendFunction (int id,...)
 Add a new function to this interface descriptor. More...
 
CoreExport void AppendProperty (int id,...)
 Add a new property to this interface descriptor. More...
 
CoreExport void AppendEnum (int id,...)
 Add a new enum to this interface descriptor. More...
 
CoreExport void SetClassDesc (ClassDesc *i_cd)
 
CoreExport va_list check_fn (va_list ap, int id)
 
CoreExport va_list scan_fn (va_list ap, int id, int index)
 
CoreExport va_list check_prop (va_list ap, int id)
 
CoreExport va_list scan_prop (va_list ap, int id, int index)
 
CoreExport va_list check_enum (va_list ap, EnumID id)
 
CoreExport va_list scan_enum (va_list ap, EnumID id, int index)
 
FPInterfaceDescGetDesc ()
 
Interface_ID GetID ()
 
CoreExport FPFunctionDefGetFnDef (FunctionID fid)
 
ActionTableGetActionTable ()
 
CoreExport void EnableActions (BOOL onOff)
 
virtual CoreExport HINSTANCE HInstance ()
 
virtual CoreExport const MCHARGetRsrcString (StringResID id)
 
- Public Member Functions inherited from FPInterface
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t=0, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPParams *params)
 
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t, FPValue &result, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPValue &result, FPParams *params=NULL)
 
virtual CoreExport FunctionID FindFn (const MCHAR *name)
 
virtual CoreExport BOOL IsEnabled (FunctionID actionID)
 
virtual CoreExport BOOL IsChecked (FunctionID actionID)
 
virtual CoreExport BOOL IsVisible (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsEnabled (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsChecked (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsVisible (FunctionID actionID)
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor. More...
 
virtual bool RegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual void UnRegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual BaseInterfaceAcquireInterface ()
 
virtual void ReleaseInterface ()
 
virtual void DeleteInterface ()
 
virtual BaseInterfaceCloneInterface (void *remapDir=NULL)
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 

Additional Inherited Members

- Public Types inherited from BaseInterface
enum  LifetimeType { noRelease, immediateRelease, wantsRelease, serverControlled }
 
- 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...
 
- Public Attributes inherited from FPInterfaceDesc
Interface_ID ID
 
MSTR internal_name
 
StringResID description
 
ClassDesccd
 
USHORT flags
 
Tab< FPFunctionDef * > functions
 
Tab< FPPropDef * > props
 
Tab< FPEnum * > enumerations
 
MSPluginClass * pc
 
Rolloutrollout
 
ActionTableaction_table
 
- Static Public Attributes inherited from FPInterface
static CoreExport FPInterfaceDesc nullInterface
 
- Protected Member Functions inherited from FPInterfaceDesc
CoreExport void load_descriptor (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *cd, USHORT flag, va_list ap)
 
- Protected Member Functions inherited from FPInterface
virtual FPStatus _dispatch_fn (FunctionID fid, TimeValue t, FPValue &result, FPParams *p)
 

Member Function Documentation

virtual void RegisterButton ( IViewportButton button)
pure virtual

Register a new button.

Register a new button with the manager. The system will check against buttons already registered

Parameters
buttonThe new button to register
virtual void UnRegisterButton ( IViewportButton button)
pure virtual

Remove a previously registered button.

Remove a button already registered with the system. The manager will not delete the button, simply removes it from the table

Parameters
buttonThe button to remove
virtual bool IsButtonRegistered ( IViewportButton button) const
pure virtual

A query to check if a button is registered.

Check to see if the button is registered. Developers can use this to check to see if a button is registered before trying to register it

Parameters
buttonThe button to test against
virtual int GetNumRegisteredButtons ( ) const
pure virtual

The total number of buttons.

The number of button registered with the manager

Returns
The total button count
virtual IViewportButton* GetViewportButton ( int  index)
pure virtual

Access an indivdual button.

Access to a specfiic button by index.

Parameters
indexThe index of the button to acess
Returns
The actual button, or NULL if index is invalid
virtual void EnableButtons ( bool  val)
pure virtual

globally enable/disable the viewport buttons

A global method for enabling the viewport button. If the buttons are disabled, nothing will be displayed or processed.

Parameters
valTRUE if the buttons are to be enabled
virtual bool GetButtonsEnabled ( ) const
pure virtual

Globally acces whether the viewport buttons are enabled.

A global method for querying viewport buttons enabled status. If the buttons are disabled, nothing will be displayed or processed.

Returns
TRUE if enabled
virtual bool OnAction ( HWND  hwnd,
GraphicsWindow gw,
IPoint2  hitLoc,
IViewportButton::Action  action 
)
pure virtual

Sends the OnAction command.

Send the OnAction command to all registered viewports

Parameters
hwndThe Window handle where the action we performed
gwA pointer to the GraphicsWindow
hitLocThe point where the action occured - this allow the button to perform a hittest.
actionThe type of action
Returns
TRUE if an action was performed.
virtual bool OnUpdate ( HWND  hwnd,
ViewExp vpt 
)
pure virtual

Send the OnUpdate command.

Sends the OnUpate command to all registered viewports

Parameters
hwndThe Window handle issueing the update request
vptA pointer to current View
Returns
TRUE if an update was implemented.
virtual bool HitTest ( HWND  hwnd,
GraphicsWindow gw,
IPoint2  stringStartLoc,
IPoint2  hitLoc,
const MSTR string 
)
pure virtual

Provides a single hittest of the text.

Utility function to perform hittesting on the supplied string and the location provided The derived IViewportButton can use this for localised hit testing, for example in the OnAction method

Parameters
hwndThe window handle
gwGraphicsWindow pointer from the active viewport
stringStartLocThe start location of the supplied string
hitLocThe mouse position
stringThe label to hittest against
Returns
TRUE if the mouse point intersects the string rectangle
virtual bool HitTest ( HWND  hwnd,
GraphicsWindow gw,
IPoint2  hitLoc 
)
pure virtual

Global hittesting on all registered buttons.

Utility function to allow hittesting on all buttons registered. It will simply return TRUE on the first successful hit test on the button label

Parameters
hwndThe window handle
gwThe GraphicsWindow for the active viewport
hitLocThe mouse position
Returns
TRUE if the mouse point intersects any button's label
virtual void DrawButtons ( ViewExp vpt,
Rect rect = NULL 
)
pure virtual

Render the buttons.

Global function to draw each button registered in the system.

Parameters
vptThe current active viewport
rectIf none NULL, the complete viewport Rect is stored here.
virtual void RefreshButtonDisplay ( )
pure virtual

Utility function for forcing a refresh of the button display.