Public Member Functions

ICurveCtl Class Reference

Search for all occurrences

Detailed Description

See also:
Class ReferenceTarget, Class ICurve, Class CurvePoint, Class ResourceMakerCallback, Class BitArray, Class Interval.

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.

#include <icurvctl.h>

Inheritance diagram for ICurveCtl:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual BOOL  IsActive ()=0
virtual void  SetActive (BOOL sw)=0
virtual HWND  GetHWND ()=0
virtual void  SetNumCurves (int iNum, BOOL doUndo=FALSE)=0
  Sets the number of curves used in this control.
virtual void  DeleteAllCurves ()=0
  Deletes all curves associated with the curve control.
virtual int  GetNumCurves ()=0
virtual void  SetXRange (float min, float max, BOOL rescaleKeys=TRUE)=0
virtual void  SetYRange (float min, float max)=0
virtual Point2  GetXRange ()=0
virtual Point2  GetYRange ()=0
virtual void  RegisterResourceMaker (ReferenceMaker *rmak)=0
virtual BOOL  GetZoomValues (float *h, float *v)=0
virtual void  SetZoomValues (float h, float v)=0
virtual BOOL  GetScrollValues (int *h, int *v)=0
virtual void  SetScrollValues (int h, int v)=0
virtual void  ZoomExtents ()=0
virtual void  SetTitle (MCHAR *str)=0
virtual ICurve GetControlCurve (int numCurve)=0
virtual void  SetDisplayMode (BitArray &mode)=0
virtual BitArray  GetDisplayMode ()=0
virtual void  SetCCFlags (DWORD flags)=0
virtual DWORD  GetCCFlags ()=0
virtual void  SetCustomParentWnd (HWND hParent)=0
virtual void  SetMessageSink (HWND hWnd)=0
virtual void  SetCommandMode (int ID)=0
virtual int  GetCommandMode ()=0
virtual void  Redraw ()=0
virtual Interval  GetValidity (TimeValue t)=0
virtual void  Update (TimeValue t, Interval &valid)=0
virtual void  SetCurrentXValue (float val)=0
virtual void  EnableDraw (BOOL enable)=0
virtual void  DeleteCurve (int index)=0

Member Function Documentation

virtual BOOL IsActive ( ) [pure virtual]
Remarks:
This method indicates if the dialog box for the control is up or not. Returns TRUE if active; otherwise FALSE.
virtual void SetActive ( BOOL  sw ) [pure virtual]
Remarks:
This method is used to bring up or close the dialog box.
Parameters:
BOOL sw

TRUE to open; FALSE to close.
virtual HWND GetHWND ( ) [pure virtual]
Remarks:
Returns the window handle of the control.
virtual void SetNumCurves ( int  iNum,
BOOL  doUndo = FALSE 
) [pure virtual]

Sets the number of curves used in this control.

Note, that this method actually create the curves, which means, that the NewCurveCreatedCallback method will be called. However, this happens only if a ResourceMakerCallback is registered already. Thus it is important,that the ResourceMakerCallback is registered BEFORE this method is called.

Parameters:
iNum - The number of curves to use.
doUndo - This will cause the function to register an Restore Object if set to TRUE.
virtual void DeleteAllCurves ( ) [pure virtual]

Deletes all curves associated with the curve control.

virtual int GetNumCurves ( ) [pure virtual]
Remarks:
Returns the numbers of curves used by the control.
virtual void SetXRange ( float  min,
float  max,
BOOL  rescaleKeys = TRUE 
) [pure virtual]
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.
virtual void SetYRange ( float  min,
float  max 
) [pure virtual]
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.
virtual Point2 GetXRange ( ) [pure virtual]
Remarks:
Returns the X Range.
virtual Point2 GetYRange ( ) [pure virtual]
Remarks:
Returns the Y Range.
virtual void RegisterResourceMaker ( ReferenceMaker rmak ) [pure virtual]
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.
virtual BOOL GetZoomValues ( float *  h,
float *  v 
) [pure virtual]
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.
Returns:
TRUE if valid values were returned; otherwise FALSE.
virtual void SetZoomValues ( float  h,
float  v 
) [pure virtual]
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.
virtual BOOL GetScrollValues ( int *  h,
int *  v 
) [pure virtual]
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.
Returns:
TRUE if valid values were returned; otherwise FALSE.
virtual void SetScrollValues ( int  h,
int  v 
) [pure virtual]
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.
virtual void ZoomExtents ( ) [pure virtual]
Remarks:
Performs a zoom extents operation to the curve view.
virtual void SetTitle ( MCHAR *  str ) [pure virtual]
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:
MCHAR *str

The title string to display.
virtual ICurve* GetControlCurve ( int  numCurve ) [pure virtual]
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.
virtual void SetDisplayMode ( BitArray mode ) [pure virtual]
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.
virtual BitArray GetDisplayMode ( ) [pure virtual]
Remarks:
Returns a BitArray which indicates which curves are toggled on or off.
virtual void SetCCFlags ( DWORD  flags ) [pure virtual]
Remarks:
Sets the curve control flags to those passed.
Parameters:
DWORD flags

See Custom Curve Control Flags.
virtual DWORD GetCCFlags ( ) [pure virtual]
Remarks:
Returns the curve control flags. See Custom Curve Control Flags.
virtual void SetCustomParentWnd ( HWND  hParent ) [pure virtual]
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.
virtual void SetMessageSink ( HWND  hWnd ) [pure virtual]
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.
virtual void SetCommandMode ( int  ID ) [pure virtual]
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
virtual int GetCommandMode ( ) [pure virtual]
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
virtual void Redraw ( ) [pure virtual]
Remarks:
This method redraws the custom curve control.
virtual Interval GetValidity ( TimeValue  t ) [pure virtual]
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.
virtual void Update ( TimeValue  t,
Interval valid 
) [pure virtual]
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.
virtual void SetCurrentXValue ( float  val ) [pure virtual]
Remarks:
This sets the position of the vertical line drawn over the graph showing the current X value. See flag CC_SHOW_CURRENTXVAL in Custom Curve Control Flags.
Parameters:
float val

The value to set.
virtual void EnableDraw ( BOOL  enable ) [pure virtual]
Remarks:
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.
virtual void DeleteCurve ( int  index ) [pure virtual]

ICurveCtl ICurveCtl ICurveCtl ICurveCtl ICurveCtl ICurveCtl ICurveCtl ICurveCtl ICurveCtl ICurveCtl
ICurveCtl ICurveCtl ICurveCtl ICurveCtl ICurveCtl ICurveCtl ICurveCtl ICurveCtl ICurveCtl ICurveCtl