iparamm.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /**********************************************************************
  2. *<
  3. FILE: IParamM.h
  4. DESCRIPTION: Parameter Maps
  5. CREATED BY: Rolf Berteig
  6. HISTORY: created 10/10/95
  7. *> Copyright (c) 1994, All Rights Reserved.
  8. **********************************************************************/
  9. #ifndef __IPARAMM__
  10. #define __IPARAMM__
  11. class IParamMap;
  12. class IRendParams;
  13. // If custom handling of controls needs to be done, ParameterMap
  14. // client can't implement one of these and set is as the ParameterMap's
  15. // user callback.
  16. class ParamMapUserDlgProc {
  17. public:
  18. virtual BOOL DlgProc(TimeValue t,IParamMap *map,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)=0;
  19. virtual void DeleteThis()=0;
  20. };
  21. // Return this from DlgProc to get the viewports redrawn.
  22. #define REDRAW_VIEWS 2
  23. class IParamMap {
  24. public:
  25. // Mark the UI as needing to be updated.
  26. virtual void Invalidate()=0;
  27. // Swaps the existing parameter block with a new one and updates UI.
  28. virtual void SetParamBlock(IParamArray *pb)=0;
  29. // The given proc will be called _after_ default processing is done.
  30. // The callback can then apply constraints to controls.
  31. // Note that if the proc is non-NULL when the ParamMap is deleted
  32. // its DeleteThis() method will be called.
  33. virtual void SetUserDlgProc(ParamMapUserDlgProc *proc=NULL)=0;
  34. // Changes a map entry to refer to a different item in the parameter block.
  35. virtual void SetPBlockIndex(int mapIndex, int blockIndex)=0;
  36. // Access the dialog window.
  37. virtual HWND GetHWnd()=0;
  38. // Access the parameter block
  39. virtual IParamArray *GetParamBlock()=0;
  40. };
  41. enum ControlType {
  42. TYPE_SPINNER,
  43. TYPE_RADIO,
  44. TYPE_SINGLECHEKBOX,
  45. TYPE_MULTICHEKBOX,
  46. TYPE_COLORSWATCH,
  47. };
  48. // Giving this value for scale specifies autoscale
  49. #define SPIN_AUTOSCALE -1.0f
  50. class ParamUIDesc {
  51. public:
  52. // Float or int controlled by a single spinner
  53. CoreExport ParamUIDesc(
  54. int index,EditSpinnerType spinType,int idEdit,int idSpin,
  55. float lowLim,float highLim,float scale,ParamDimension *dim=defaultDim);
  56. // int controlelled by n radio buttons
  57. // vals[i] represents the value if ctrlIDs[i] is checked.
  58. // if vals=NULL then ctrlIDs[i] represents a value of i.
  59. //
  60. // OR
  61. //
  62. // int controlled by multiple check boxes where each
  63. // check boxes controlls a single bit.
  64. // vals[i] specifies which bit ctrlIds[i] controls.
  65. // If vals=NULL ctrlIDs[i] controls the ith bit.
  66. CoreExport ParamUIDesc(
  67. int index,ControlType type,int *ctrlIDs,int count,int *vals=NULL);
  68. // int controlled by a single check box (BOOL)
  69. // or Point3 controlled by a color swatch.
  70. CoreExport ParamUIDesc(int index,ControlType type,int id);
  71. // Point3 controlled by 3 spinners
  72. CoreExport ParamUIDesc(int index,
  73. EditSpinnerType spinType,
  74. int idEdit1,int idSpin1,
  75. int idEdit2,int idSpin2,
  76. int idEdit3,int idSpin3,
  77. float lowLim,float highLim,float scale,
  78. ParamDimension *dim=defaultDim);
  79. int pbIndex;
  80. ParamType ptype;
  81. ControlType ctype;
  82. int id[6];
  83. int *ids;
  84. int *vals;
  85. int count;
  86. EditSpinnerType spinType;
  87. float lowLim;
  88. float highLim;
  89. float scale;
  90. ParamDimension *dim;
  91. };
  92. // Creates a parameter map to handle the display of parameters in the command panal.
  93. //
  94. // This will add a rollup page to the command panel.
  95. // DestroyCPParamMap().
  96. //
  97. CoreExport IParamMap *CreateCPParamMap(
  98. ParamUIDesc *desc,int count,
  99. IParamArray *pb,
  100. Interface *ip,
  101. HINSTANCE hInst,
  102. TCHAR *dlgTemplate,
  103. TCHAR *title,
  104. DWORD flags);
  105. CoreExport void DestroyCPParamMap(IParamMap *m);
  106. // Creates a parameter map that will handle a parameter block in a modeless
  107. // dialog where time does not change and the viewport is not redrawn.
  108. // Note that there is no need to destroy it. It executes the dialog and then
  109. // destorys itself. Returns TRUE if the user selected OK, FALSE otherwise.
  110. CoreExport BOOL CreateModalParamMap(
  111. ParamUIDesc *desc,int count,
  112. IParamArray *pb,
  113. TimeValue t,
  114. HINSTANCE hInst,
  115. TCHAR *dlgTemplate,
  116. HWND hParent,
  117. ParamMapUserDlgProc *proc=NULL);
  118. // Creates a parameter map to handle the display of render parameters or
  119. // atmospheric plug-in parameters.
  120. CoreExport IParamMap *CreateRParamMap(
  121. ParamUIDesc *desc,int count,
  122. IParamArray *pb,
  123. IRendParams *ip,
  124. HINSTANCE hInst,
  125. TCHAR *dlgTemplate,
  126. TCHAR *title,
  127. DWORD flags);
  128. CoreExport void DestroyRParamMap(IParamMap *m);
  129. #endif // __IPARAMM__