iparamm.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  *<
00003     FILE: IParamM.h
00004 
00005     DESCRIPTION:  Parameter Maps
00006 
00007     CREATED BY: Rolf Berteig
00008 
00009     HISTORY: created 10/10/95
00010 
00011  *> Copyright (c) 1994, All Rights Reserved.
00012  **********************************************************************/
00013 
00014 
00015 #pragma once
00016 #include "maxheap.h"
00017 #include <WTypes.h>
00018 #include "maxtypes.h"
00019 #include "coreexp.h"
00020 #include "custcont.h" // for EditSpinnerType
00021 #include "paramtype.h" // for ControlType
00022 
00023 // forward declarations
00024 class IParamMap;
00025 class IRendParams;
00026 class IParamArray;
00027 class ParamDimension;
00028 CoreExport extern ParamDimension* defaultDim;
00029 
00030 // If custom handling of controls needs to be done, ParameterMap
00031 // client can't implement one of these and set is as the ParameterMap's
00032 // user callback.
00039 class ParamMapUserDlgProc: public MaxHeapOperators {
00040     public:
00042         virtual ~ParamMapUserDlgProc() {}
00062         virtual INT_PTR DlgProc(TimeValue t,IParamMap *map,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)=0;
00066         virtual void DeleteThis()=0;
00081         virtual void Update(TimeValue t) { UNUSED_PARAM(t); }
00082     };
00083 
00084 // Return this from DlgProc to get the viewports redrawn.
00085 #define REDRAW_VIEWS    2
00086 
00087 
00088 
00100 class IParamMap: public MaxHeapOperators {
00101     public:
00103         virtual ~IParamMap() {}
00104 
00105         // Mark the UI as needing to be updated.
00110         virtual void Invalidate()=0;
00111         
00112         // Swaps the existing parameter block with a new one and updates UI.
00126         virtual void SetParamBlock(IParamArray* pb)=0;
00127 
00128         // The given proc will be called _after_ default processing is done.
00129         // The callback can then apply constraints to controls.
00130         // Note that if the proc is non-NULL when the ParamMap is deleted
00131         // its DeleteThis() method will be called.
00143         virtual void SetUserDlgProc(ParamMapUserDlgProc *proc=NULL)=0;
00144         virtual ParamMapUserDlgProc *GetUserDlgProc()=0;
00145 
00146         // Changes a map entry to refer to a different item in the parameter block.
00160         virtual void SetPBlockIndex(int mapIndex, int blockIndex)=0;
00161 
00162         // Access the dialog window.
00165         virtual HWND GetHWnd()=0;
00166 
00167         // Access the parameter block
00171         virtual IParamArray *GetParamBlock()=0;
00172 
00173         // Is the dialog proc active
00174         virtual BOOL DlgActive()=0;
00175     };
00176 
00177 
00178 
00179 
00180 // Giving this value for scale specifies autoscale
00181 #define SPIN_AUTOSCALE  -1.0f
00182 
00192 class ParamUIDesc: public MaxHeapOperators {
00193     public:
00194         // Float or int controlled by a single spinner
00227         CoreExport ParamUIDesc(
00228             int index,EditSpinnerType spinType,int idEdit,int idSpin,
00229             float lowLim,float highLim,float scale,ParamDimension* dim = defaultDim);
00230 
00231         // int controlelled by n radio buttons
00232         // vals[i] represents the value if ctrlIDs[i] is checked.
00233         // if vals=NULL then ctrlIDs[i] represents a value of i.
00234         //
00235         // OR
00236         // 
00237         // int controlled by multiple check boxes where each
00238         // check boxes controlls a single bit.
00239         // vals[i] specifies which bit ctrlIds[i] controls.
00240         // If vals=NULL ctrlIDs[i] controls the ith bit.        
00266         CoreExport ParamUIDesc(
00267             int index, ControlType type, int* ctrlIDs, int count, int* vals = NULL);
00268 
00269         // int controlled by a single check box (BOOL)
00270         // or Point3 controlled by a color swatch.
00288         CoreExport ParamUIDesc(int index,ControlType type,int id);
00289 
00290         // Point3 controlled by 3 spinners
00331         CoreExport ParamUIDesc(int index,
00332                 EditSpinnerType spinType,
00333                 int idEdit1,int idSpin1,
00334                 int idEdit2,int idSpin2,
00335                 int idEdit3,int idSpin3,
00336                 float lowLim, float highLim, float scale,
00337                 ParamDimension* dim = defaultDim);
00338         
00339         
00340         int pbIndex;
00341         ParamType   ptype;
00342         ControlType ctype;
00343         int id[6];
00344         int *ids;
00345         int *vals;
00346         int count;
00347 
00348         EditSpinnerType spinType;
00349         float lowLim;
00350         float highLim;
00351         float scale;
00352         ParamDimension *dim;
00353     };
00354 
00355 // Creates a parameter map that will handle a parameter block in a modeless
00356 // dialog where time does not change and the viewport is not redrawn.
00357 // Note that there is no need to destroy it. It executes the dialog and then
00358 // destorys itself. Returns TRUE if the user selected OK, FALSE otherwise.
00384 CoreExport BOOL CreateModalParamMap(
00385         ParamUIDesc *desc,int count,
00386         IParamArray *pb,
00387         TimeValue t,
00388         HINSTANCE hInst,
00389         MCHAR *dlgTemplate,
00390         HWND hParent,
00391         ParamMapUserDlgProc *proc=NULL);
00392 
00393 
00394 // Creates a parameter map to handle the display of parameters in the command panal.
00395 // 
00396 // This will add a rollup page to the command panel.
00397 // DestroyCPParamMap().
00398 //
00422 CoreExport IParamMap *CreateCPParamMap(
00423         ParamUIDesc *desc,int count,
00424         IParamArray *pb,
00425         Interface *ip,
00426         HINSTANCE hInst,
00427         MCHAR *dlgTemplate,
00428         MCHAR *title,
00429         DWORD flags);
00430 
00431 
00457 CoreExport IParamMap *ReplaceCPParamMap(
00458         HWND oldhw,
00459         ParamUIDesc *desc,int count,
00460         IParamArray *pb,
00461         Interface *ip,
00462         HINSTANCE hInst,
00463         MCHAR *dlgTemplate,
00464         MCHAR *title,
00465         DWORD flags);
00466 
00472 CoreExport void DestroyCPParamMap(IParamMap *m);
00473 
00474 
00475 // Creates a parameter map to handle the display of render parameters or
00476 // atmospheric plug-in parameters.
00500 CoreExport IParamMap *CreateRParamMap(
00501         ParamUIDesc *desc,int count,
00502         IParamArray *pb,
00503         IRendParams *ip,
00504         HINSTANCE hInst,
00505         MCHAR *dlgTemplate,
00506         MCHAR *title,
00507         DWORD flags);
00514 CoreExport void DestroyRParamMap(IParamMap *m);
00515 
00516 class IMtlParams;
00517 
00518 // Creates a parameter map to handle the display of texture map or
00519 // material parameters in the material editor.
00544 CoreExport IParamMap *CreateMParamMap(
00545         ParamUIDesc *desc,int count,
00546         IParamArray *pb,
00547         IMtlParams *ip,
00548         HINSTANCE hInst,
00549         MCHAR *dlgTemplate,
00550         MCHAR *title,
00551         DWORD flags);
00558 CoreExport void DestroyMParamMap(IParamMap *m);
00559 
00560 
00561 
00562 
00563 
00564