Class ICurveCtl
See Also: Class ReferenceTarget, Class ICurve, Class CurvePoint, Class ResourceMakerCallback, Class BitArray, Class Interval.
class ICurveCtl : public ReferenceTarget
Description:
This class is available in release 3.0 and later only.
This class is an interface to the curve custom control. An example of this control in the 3ds max user interface can be seen in the Color Map section of the Output rollup of a 2D Texture map. Sample code using these APIs is available in \MAXSDK\SAMPLES\UTILITIES\CCUTIL\CCUTIL.CPP.
Methods:
public:
Prototype:
virtual BOOL IsActive()=0;
Remarks:
This method indicates if the dialog box for the control is up or not. Returns TRUE if active; otherwise FALSE.
Prototype:
virtual void SetActive(BOOL sw)=0;
Remarks:
This method is used to bring up or close the dialog box.
Parameters:
BOOL sw
TRUE to open; FALSE to close.
Prototype:
virtual HWND GetHWND()=0;
Remarks:
Returns the window handle of the control.
Prototype:
virtual void SetNumCurves(int iNum, BOOL doUndo=FALSE)=0;
Remarks:
Sets the number of curves used in this control.
Parameters:
int iNum
The number of curves to use.
BOOL doUndo=FALSE
This parameter is available in release 4.0 and later only.
This will cause the function to register an Restore Object if set to TRUE.
Prototype:
virtual int GetNumCurves()=0;
Remarks:
Returns the numbers of curves used by the control.
Prototype:
virtual void SetXRange(float min, float max, BOOL rescaleKeys = TRUE)=0;
Remarks:
Sets the absolute position of the first and last CurvePoints.
Parameters:
float min
The minimum value.
float max
The maximum value.
BOOL rescaleKeys = TRUE
This parameter is available in release 4.0 and later only.
This parameter controls whether changing the X range will rescale the keys and key tangents or not. When this is TRUE, the default, the keys and tangents get resinced to the total X range. Setting this to FALSE allow developers to have move control over the exact placement of keys and tangents when the X range changes. This also allow developers to set ranges from within the points changed message handler without getting into a loop.
Prototype:
virtual void SetYRange(float min, float max)=0;
Remarks:
This determines the absolute upper and lower Y-constraint. This method only has an effect if the CC_CONSTRAIN_Y flag is set.
Parameters:
float min
The minimum value.
float max
The maximum value.
Prototype:
virtual Point2 GetXRange()=0;
Remarks:
This method is available in release 4.0 and later only.
Returns the X Range.
Prototype:
virtual Point2 GetYRange()=0;
Remarks:
This method is available in release 4.0 and later only.
Returns the Y Range.
Prototype:
virtual void RegisterResourceMaker(ReferenceMaker *rmak)=0;
Remarks:
This methods registers a callback object used to handle certain aspects of the control. The callback object will be used for updating of the display button image list and tool tip text for the curve control. It also gets called when the user executes a Reset or creates a new control.
This registers a reference maker which implements the method Animatable::GetInterface() for the id I_RESMAKER_INTERFACE by returning an object derived from class ResourceMakerCallback.
Parameters:
ReferenceMaker *rmak
Points to the reference maker which returns the callback object.
Prototype:
virtual BOOL GetZoomValues(float *h, float *v)=0;
Remarks:
Returns the current zoom values.
Parameters:
float *h
Points to storage for the horizontal zoom value.
float *v
Points to storage for the vertical zoom value.
Return Value:
TRUE if valid values were returned; otherwise FALSE.
Prototype:
virtual void SetZoomValues(float h, float v)=0;
Remarks:
Sets the zoom values. To determine the values to use developers should use the CCUtil plug-in, create a pop-up window as big as is appropriate for the final control, adjust the zoom and scroll values interactively, and then simply read out the values from the CCUtil user interface (GetZoom and GetScroll).
Parameters:
float h
The horizontal value to set.
float v
The vertical value to set.
Prototype:
virtual BOOL GetScrollValues(int *h, int *v)=0;
Remarks:
Returns the horizontal and vertical scroll values.
Parameters:
int *h
Points to storage for the horizontal scroll value.
int *v
Points to storage for the vertical scroll value.
Return Value:
TRUE if valid values were returned; otherwise FALSE.
Prototype:
virtual void SetScrollValues(int h, int v)=0;
Remarks:
Sets the scroll values. To determine the values to use developers should use the CCUtil plug-in, create a pop-up window as big as is appropriate for the final control, adjust the zoom and scroll values interactively, and then simply read out the values from the CCUtil user interface (GetZoom and GetScroll).
Parameters:
int h
The horizontal scroll value to set.
int v
The vertical scroll value to set.
Prototype:
virtual void ZoomExtents()=0;
Remarks:
This method is available in release 3.0 and later only.
Performs a zoom extents operation to the curve view.
Prototype:
virtual void SetTitle(TCHAR *str)=0;
Remarks:
Sets the title of the dialog box to the specified string. This is only used if the CC_ASPOPUP is used to create a pop-up dialog.
Parameters:
TCHAR *str
The title string to display.
Prototype:
virtual ICurve *GetControlCurve(int numCurve)=0;
Remarks:
Returns and interface to the specified curve. This interface allows you to set the color of the curve and retrieve the Y value of the curve given an X value.
Parameters:
int numCurve
The zero based index of the curve.
Prototype:
virtual void SetDisplayMode(BitArray &mode)=0;
Remarks:
Determines which curves are toggled on.
Parameters:
BitArray &mode
The BitArray to control curve visibility -- one bit for each curve. If the bit is set the curve is toggled on; otherwise it is toggled off.
Prototype:
virtual BitArray GetDisplayMode()=0;
Remarks:
Returns a BitArray which indicates which curves are toggled on or off.
Prototype:
virtual void EnableDraw(BOOL enable)=0;
Remarks:
This method is available in release 4.0 and later only.
This method allows you to turn on/off the display code. It is useful when you are doing lots of changes and don't want the window to continually redraw.
Parameters:
BOOL enable
TRUE to enable; FALSE to disable.
Prototype:
virtual void SetCCFlags(DWORD flags)=0;
Remarks:
Sets the curve control flags to those passed.
Parameters:
DWORD flags
See List of Custom Curve Control Flags.
Prototype:
virtual DWORD GetCCFlags()=0;
Remarks:
Returns the curve control flags. See List of Custom Curve Control Flags.
Prototype:
virtual void SetCustomParentWnd(HWND hParent)=0;
Remarks:
Sets the parent window for the control if the controll is not a popup window.
Parameters:
HWND hParent
The window handle of the parent.
Prototype:
virtual void SetMessageSink(HWND hWnd)=0;
Remarks:
Call this method and the following window messages will be sent to the window whose handle is passed. The contents of the lParam and wParam parameters passed to the window proc are shown.
WM_CC_SEL_CURVEPT
Sent when a point is selected or deselected.
lParam = ICurve * , LOWORD(wParam) = The number of points which are selected.
WM_CC_CHANGE_CURVEPT
Sent when a point is changed.
lParam = ICurve * , LOWORD(wParam) = The zero based index of the changed point.
WM_CC_CHANGE_CURVETANGENT
Sent when a point's in or out tangent is changed.
lParam = ICurve * , LOWORD(wParam) = The zero based index of the changed point,
HIWORD(wParam) contains a flag, that indicates if the changed tangent is the in, or out tangent. You can check these flags as HIWORD(wParam) & IN_CURVETANGENT_CHANGED and HIWORD(wParam) & OUT_CURVETANGENT_CHANGED, for the in and out tangent respectively.
WM_CC_DEL_CURVEPT
Sent when a point is deleted.
lParam = ICurve * , LOWORD(wParam) = The zero based index of the deleted point.
WM_CC_INSERT_CURVEPT
This option is available in release 4.0 and later only.
lParam = ICurve *, LOWORD(wParam) = The zero based index of the inserted point.
Parameters:
HWND hWnd
The handle of the window which will receive the messages.
Prototype:
virtual void SetCommandMode(int ID)=0;
Remarks:
Sets the command mode in use by the control.
Parameters:
int ID
One of the following values (which correspond directly to toolbar buttons in the UI. See the 2D texture map Output rollup for example):
CID_CC_MOVE_XY
CID_CC_MOVE_X
CID_CC_MOVE_Y
CID_CC_SCALE
CID_CC_INSERT_CORNER
CID_CC_INSERT_BEZIER
Prototype:
virtual int GetCommandMode()=0;
Remarks:
Returns a value which indicates the current command mode. One of the following values (which correspond directly to toolbar buttons in the UI. See the 2D texture map Output rollup for example):
CID_CC_MOVE_XY
CID_CC_MOVE_X
CID_CC_MOVE_Y
CID_CC_SCALE
CID_CC_INSERT_CORNER
CID_CC_INSERT_BEZIER
Prototype:
virtual void Redraw()=0;
Remarks:
This method redraws the custom curve control.
Prototype:
virtual Interval GetValidity(TimeValue t)=0;
Remarks:
Returns an Interval which reflects the validity of every point of every curve used by the curve control.
Parameters:
TimeValue t
The time about which the interval is computed.
Prototype:
virtual void Update(TimeValue t, Interval& valid)=0;
Remarks:
Updates the validity interval passed with the overall validity of the curves in the control. This simply does:
valid &= GetValidity(t);
Parameters:
TimeValue t
The time about which the interval is computed.
Interval& valid
The interval which is updated.
Prototype:
virtual void SetCurrentXValue(float val)=0;
Remarks:
This method is available in release 4.0 and later only.
This sets the position of the vertical line drawn over the graph showing the current X value. See flag CC_SHOW_CURRENTXVAL in List of Custom Curve Control Flags.
Parameters:
float val
The value to set.