Public Member Functions

CUIFrameMsgHandler Class Reference

Search for all occurrences

Detailed Description

See also:
Class ICUIFrame, Class CUIFrameMgr, Class CUIPosData, Class ICustomControl.

Description:
This class provides a way for messages received by a CUIFrame to be processed in a context-specific fashion.

Since the CUI Frame is just a window, it needs a window proc. There is one built into the CUI system, but it may need additional information that is specific to how the frame is being used. For example, in 3ds Max the command panel can't be resized horizontally and the default window proc can't manage this.

For such situations, the application must install a CUIFrameMsgHandler object. You establish that this is the handler for the frame using the method ICUIFrame::InstallMsgHandler(CUIFrameMsgHandler *msgHandler).

These message handlers have one significant class method: ProcessMessage(). If ProcessMessage() returns TRUE, then the CUI system assumes that the message is completely handled. If it returns FALSE, then the standard CUI processing takes place. (Note that the message handler may still return FALSE, even if it does some processing...).

There is a special message (CUI_POSDATA_MSG) that is sent by the CUI system to the message handler to get information on window size constraints, etc. An example of processing this message is shown below. In this case editPosData is a static instance of CUIPosData. That object has GetWidth() and GetHeight() methods which return the proper width and height size for various orientations. See Class CUIPosData for details.

 case CUI_POSDATA_MSG: {
  CUIPosData **cpd = (CUIPosData **)lParam;
  cpd[0] = &editPosData;
  }
  return TRUE; 

#include <custcont.h>

Inheritance diagram for CUIFrameMsgHandler:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual  ~CUIFrameMsgHandler ()
virtual int  ProcessMessage (UINT message, WPARAM wParam, LPARAM lParam)

Constructor & Destructor Documentation

virtual ~CUIFrameMsgHandler ( ) [inline, virtual]
Remarks:
Destructor.
{;}

Member Function Documentation

virtual int ProcessMessage ( UINT  message,
WPARAM  wParam,
LPARAM  lParam 
) [inline, virtual]
Remarks:
This method is called to handle any processing not done by the default CUI window proc.

This method should return TRUE if the message is handled and FALSE if not. If FALSE is returned (or no handler is defined), then the CUIFrame simply passes WM_COMMAND messages on to its parent. Window position messages are passed from the CUIFrame to the HWND of the 'content' (either a toolbar or menu). Other messages are passed on to the default window proc.

Note: Developers should not return TRUE for the entire ProcessMessage routine, since if this is done, the right-click menu functionality will not work (e.g. docking, floating, move-to-shelf, customize, etc.).

Also Note: Developers should not use IDs that may conflict with the ones used by the default processing provide by 3ds Max. The IDs which should be avoided are in the 40000, 47000, and 61000 range. For instance the following IDs are all invalid since they are in those ranges: 40005, 47900, 61102. The reason this is a problem is that if you return FALSE after processing a particular ID, then 3ds Max will go ahead and process that ID also. And if the ID matches one already in 3ds Max, an unintended function may get called.
Parameters:
message Specifies the message.
wParam Specifies additional message information. The contents of this parameter depend on the value of the message parameter.
lParam Specifies additional message information. The contents of this parameter depend on the value of the message parameter.
Default Implementation:
{ return FALSE; }
{ return FALSE; }

CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler
CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler CUIFrameMsgHandler