Public Member Functions

ViewWindow Class Reference

Search for all occurrences

Detailed 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
{

    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;

#include <maxapi.h>

Inheritance diagram for ViewWindow:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual MCHAR *  GetName ()=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 ()

Member Function Documentation

virtual 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 ( ) [inline, virtual]
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.

{ return TRUE; }
virtual int NumberCanCreate ( ) [inline, virtual]
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; }
{ return -1; }

ViewWindow ViewWindow ViewWindow ViewWindow ViewWindow ViewWindow ViewWindow ViewWindow ViewWindow ViewWindow
ViewWindow ViewWindow ViewWindow ViewWindow ViewWindow ViewWindow ViewWindow ViewWindow ViewWindow ViewWindow