igrip.h

Go to the documentation of this file.
00001 /*==============================================================================
00002 Copyright 2010 Autodesk, Inc.  All rights reserved.
00003 
00004 Use of this software is subject to the terms of the Autodesk license agreement provided
00005 at the time of installation or download, or which otherwise accompanies this software
00006 in either electronic or hard copy form.   
00007 
00008 //**************************************************************************/
00009 // DESCRIPTION: Classes To Create and Manipulate Grips
00010 // AUTHOR: Michael Zyracki created April 2009
00011 //***************************************************************************/
00012 
00013 #pragma once
00014 
00015 #include "ifnpub.h"
00016 
00018 
00028 class IBaseGrip :  public BaseInterface
00029 {
00030 
00031 public:
00032 
00034     virtual ~IBaseGrip(){};
00035 
00040     enum Type
00041     {
00043         eInvalid = -1,
00046         eInt = 0,
00049         eFloat,
00052         eTime,
00055         eUniverse,
00058         eCombo,
00060         eToggle,
00062         eAction,
00066         eCommand ,
00068         eStatus
00069     }; 
00071 
00072 
00079     enum Customization
00080     {
00083         eSameRow = 0x1,
00085         eTurnOffLabel = 0x2,
00087         eDisableAlt = 0x4
00088         
00089     }; 
00091 
00092 
00094     struct GripValue : public MaxHeapOperators
00095     {
00096         union
00097         {
00099             int mInt;
00101             float mFloat;
00103             int mCombo;
00105             bool mbool;
00106         };
00108         DWORD mFlag; 
00109     };
00110 
00112     struct ComboLabel : public MaxHeapOperators
00113     {
00115         MSTR mLabel;
00117         MSTR mIcon;
00118     };
00119 
00122 
00123 
00128     virtual bool SupportsOkayApplyCancel() =0;
00129 
00134     virtual void Okay(TimeValue t)=0;
00135 
00139     virtual void Cancel()=0;
00140 
00144     virtual void Apply(TimeValue t)=0;
00146 
00150     virtual void GetGripName(MSTR &string) =0;
00151 
00155     virtual int GetNumGripItems() =0;
00156 
00163     virtual IBaseGrip::Type GetType(int which) =0;
00164 
00170     virtual bool GetText(int which,MSTR &string) =0;
00171 
00179     virtual bool GetResolvedIconName(int which,MSTR &string) =0;
00180 
00187     virtual DWORD GetCustomization(int which) =0;
00188 
00196     virtual bool GetComboOptions(int which, Tab<ComboLabel*> &comboOptions)= 0;
00197 
00205     virtual bool GetCommandIcon(int which, MSTR &string)= 0;
00206     
00213     virtual bool GetValue(int which,TimeValue t,IBaseGrip::GripValue &value) =0;
00214     
00217 
00218 
00224     virtual bool SetValue(int which,TimeValue t,IBaseGrip::GripValue &value) =0; 
00225     
00232     virtual bool StartSetValue(int which,TimeValue t) =0;
00233     
00243     virtual bool EndSetValue(int which,TimeValue t,bool accepted) = 0;
00245 
00252     virtual bool ShowKeyBrackets(int which,TimeValue t) =0;
00253 
00257 
00258 
00262     virtual bool GetAutoScale(int which)=0;
00263 
00269     virtual bool GetScale(int which, IBaseGrip::GripValue &scaleValue) =0;
00270 
00278     virtual bool GetScaleInViewSpace(int which,float &depth) = 0 ;
00280 
00287     virtual bool GetRange(int which,IBaseGrip::GripValue &minRange, IBaseGrip::GripValue &maxRange)=0;
00288 
00294     virtual bool GetResetValue(int which,IBaseGrip::GripValue &resetValue)=0;
00295 
00301     virtual bool ResetValue(TimeValue t,int which)=0;
00302 
00303 };
00304 
00308 class GripChangedCallback: public MaxHeapOperators {
00309     public:
00311         virtual ~GripChangedCallback() {}
00314         virtual void GripChanged(IBaseGrip *grip)=0;
00315     };
00316 
00317 
00318 
00321 #define IGRIPMANAGER_INTERFACE   Interface_ID(0x59cb513c, 0x7a0a5232)
00322 
00324 #define GetIGripManager()   static_cast<IGripManager*>(GetCOREInterface(IGRIPMANAGER_INTERFACE))
00325 
00326 
00328 
00333 class IGripManager : public FPStaticInterface {
00334 
00335 public:
00337 
00338 
00342     virtual void SetGripActive(IBaseGrip *grip) =0;
00343     
00346     virtual void SetGripsInactive() = 0;
00347 
00351     virtual IBaseGrip *GetActiveGrip() =0;
00353 
00355 
00356 
00362     virtual bool ActivateGripItem(int whichItem, bool active) = 0;
00363 
00369     virtual bool IsGripItemActive(int whichItem) = 0;
00370 
00378     virtual bool HideGripItem(int whichItem, bool hide) = 0;
00379 
00385     virtual bool IsGripItemVisible(int whichItem) = 0;
00387 
00388 
00390 
00391 
00397     virtual bool ResetGripUI(int whichItem) =0;
00398 
00401     virtual void ResetAllUI() = 0;
00403 
00405 
00406 
00409     virtual void SetShow(bool val) =0;
00413     virtual bool GetShow()const =0;
00415     
00416 
00418 
00419 
00423     virtual void GetXYLocation(float &x, float &y)=0;
00424 
00429     virtual void SetLocation(int x, int y) =0;  
00430         virtual void SetCenterOnSelected(bool val) =0;
00437     virtual bool GetCenterOnSelected()const =0;
00442     virtual void SetCenterXYPos(float x,float y ) = 0;
00446     virtual float GetCenterYPos()const = 0;
00450     virtual float GetCenterXPos()const = 0;
00451 
00456     virtual void SetSelectedOffsetXY(int offsetPixelX, int offsetPixelY)=0;
00457 
00461     virtual int GetSelectedOffsetX()const=0;
00465     virtual int GetSelectedOffsetY()const=0;
00467 
00469 
00470 
00473     virtual void SetTransparency(float val) =0;
00477     virtual float GetTransparency()const=0;
00482     virtual void SetHoverTransparency(float val) =0;
00486     virtual float GetHoverTransparency()const=0;
00488 
00490 
00491 
00494     virtual void SetWidgetSpacing(float spacing)=0;
00495 
00499     virtual float GetWidgetSpacing()const=0;
00501 
00503 
00504 
00507     virtual void RegisterGripChangedCallback(GripChangedCallback *cB) =0;
00508 
00513     virtual void UnRegisterGripChangedCallback(GripChangedCallback *cB) =0;
00515 
00519     virtual void RecalcLayout() =0;
00520 };
00521 
00522 
00523