ViewWindow Class Reference

ViewWindow Class Referenceabstract

#include <maxapi.h>

Class Description

See also
Class Interface.

Description:
This the base class for the creation of non-3D windows that appear in a 3ds Max viewport. These views are called "Extended Viewports". In order for a window to appear inside a viewport, you need to derive a class from this class. An instance of the derived class must be registered via the RegisterViewWindow() call in the Interface class. A given ViewWindow derivative should only be registered once.

When developers have registered their window types, the list of available extended views will appear in the view selection pop-up (either in the right-click viewport menu or the Viewport Configuration dialog) as a submenu of the "Extended" view label.

There are two items which should be made in the extended viewport dialog proc code:

Interface::MakeExtendedViewportActive() should be called whenever the user clicks in the non-3D window (so as to deactivate the current 3D window, and redirect commands like the Min/Max toggle to the non-3D viewport window).

Interface::PutUpViewMenu() should be called when the user right-clicks in a dead region of the non-3D window. This brings up the view selection menu so that the user can choose to replace the current window with a 3D or other non-3D window without having to go to the Views | Viewport Config dialog directly.

All methods of this class are virtual.
Sample Code:
class TestViewWindow : public ViewWindow
{
const MCHAR *GetName() { return _M("TestViewWindow"); }
HWND CreateViewWindow(HWND hParent, int x, int y, int w, int h);
void DestroyViewWindow(HWND hWnd);
};
HWND TestViewWindow::CreateViewWindow(HWND hParent, int x, int y, int w, int h)
{
return CreateWindow("button", "Test Button", WS_VISIBLE | WS_CHILD, x, y, w, h, hParent, NULL, (HINSTANCE)GetWindowLong(hParent, GWL_HINSTANCE), NULL);
}
void TestViewWindow::DestroyViewWindow(HWND hWnd)
{
DestroyWindow(hWnd);
}
static TestViewWindow tvw;
+ Inheritance diagram for ViewWindow:

Public Member Functions

virtual const MCHARGetName ()=0
 
virtual HWND CreateViewWindow (HWND hParent, int x, int y, int w, int h)=0
 
virtual void DestroyViewWindow (HWND hWnd)=0
 
virtual BOOL CanCreate ()
 
virtual int NumberCanCreate ()
 
virtual ViewWindowMetaData GetMetaData ()=0
 
virtual Class_ID ClassID () const =0
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 

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

Member Function Documentation

virtual const MCHAR* GetName ( )
pure virtual
Remarks
Returns the name of the window type. For example, "Asset Manager".

Implemented in ListenerViewWindow.

virtual HWND CreateViewWindow ( HWND  hParent,
int  x,
int  y,
int  w,
int  h 
)
pure virtual
Remarks
Creates and returns a handle to a new extended view window.
Parameters:
HWND hParent

The handle of the parent window.

int x

The x coordinate of the window's upper left corner.

int y

The y coordinate of the window's upper left corner.

int w

The window width.

int h

The window height.

Implemented in ListenerViewWindow.

virtual void DestroyViewWindow ( HWND  hWnd)
pure virtual
Remarks
Destroys the previously created window as specified by the handle.
Parameters:
HWND hWnd

The handle of the window to destroy.

Implemented in ListenerViewWindow.

virtual BOOL CanCreate ( )
inlinevirtual
Remarks
Returns TRUE if the ViewWindow can be created; otherwise FALSE. This method can be overridden to return FALSE if a ViewWindow can only have a single instance, and that instance is already present. If this method returns FALSE, then the menu item for this ViewWindow will be grayed out.
Default Implementation:
{ return TRUE; }

Reimplemented in ListenerViewWindow.

410 { return TRUE; }
virtual int NumberCanCreate ( )
inlinevirtual
Remarks
This method returns the number of instances of a given window that can be created. This allows, for example, the UI to know without physically creating a window that only a limited number of windows of that type can be created. A -1 implies that the count is not known.
Default Implementation:
{ return -1; }
422 { return -1; }
virtual ViewWindowMetaData GetMetaData ( )
pure virtual

Implemented in ListenerViewWindow.

virtual Class_ID ClassID ( ) const
pure virtual

Implemented in ListenerViewWindow.