fbproperties.h

Go to the documentation of this file.
00001 #ifndef __FBPROPERTIES_H__
fbproperties.h
00002 #define __FBPROPERTIES_H__
00003 /**************************************************************************
00004  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
00005  All Rights Reserved.
00006  
00007  The coded instructions, statements, computer programs, and/or related 
00008  material (collectively the "Data") in these files contain unpublished 
00009  information proprietary to Autodesk, Inc. and/or its licensors, which is 
00010  protected by Canada and United States of America federal copyright law 
00011  and by international treaties.
00012  
00013  The Data may not be disclosed or distributed to third parties, in whole 
00014  or in part, without the prior written consent of Autodesk, Inc. 
00015  ("Autodesk").
00016  
00017  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00018  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO 
00019  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR 
00020  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES 
00021  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
00022  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT 
00023  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR 
00024  FREE.
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS 
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR 
00028  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE 
00029  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS 
00030  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR 
00031  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF 
00032  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT 
00033  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE 
00034  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS 
00035  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
00036  
00037 **************************************************************************/
00038 
00045 #include <kaydaradef.h>
00046 
00047 #ifndef FBSDK_DLL
00048 
00051   #define FBSDK_DLL K_DLLIMPORT
00052 #endif
00053 
00054 #include <assert.h>
00055 #include <stdio.h>
00056 #include <stdlib.h>
00057 
00058 #include <fbsdk/fbplug.h>
00059 #include <fbsdk/fbarray.h>
00060 #include <fbsdk/fbstring.h>
00061 #include <fbsdk/fbtime.h>
00062 #include <fbsdk/fbevaluateinfo.h>
00063 
00064 K_FORWARD( KEventBase );
00065 K_FORWARD( KObject );
00066 K_FORWARD( KProperty );
00067 K_FORWARD( KEvaluationProperty );
00068 K_FORWARD( KDataType );
00069 K_FORWARD( IFBObject );
00070 K_FORWARD( IRegister );
00071 
00072 #ifdef FBSDKUseNamespace
00073     namespace FBSDKNamespace {
00074 #endif
00075 
00077 
00079 enum FBPropertyType
00080 {
00081     kFBPT_unknown,  
00082     kFBPT_int,      
00083     kFBPT_int64,    
00084     kFBPT_uint64,   
00085     kFBPT_bool,     
00086     kFBPT_float,    
00087     kFBPT_double,   
00088     kFBPT_charptr,  
00089     kFBPT_enum,     
00090     kFBPT_Time,     
00091     kFBPT_object,   
00092     kFBPT_event,    
00093     kFBPT_stringlist,
00094     kFBPT_Vector4D, 
00095     kFBPT_Vector3D, 
00096     kFBPT_ColorRGB, 
00097     kFBPT_ColorRGBA,
00098     kFBPT_Action,   
00099     kFBPT_Reference,
00100     kFBPT_TimeSpan, 
00101     kFBPT_kReference,
00102     kFBPT_Vector2D  
00103 };
00104 
00108 enum FBPropertyFlag
00109 {
00110     kFBPropertyFlagNotSet = 0,
00111     kFBPropertyFlagHideProperty = (1 << 0),
00112     kFBPropertyFlagForceStaticProperty = (1 << 1),
00113     kFBPropertyFlagDisableProperty = (1 << 2),
00114     kFBPropertyFlagAnimated = (1 << 3),
00115     kFBPropertyFlagNotSavable = (1 << 4),
00116     kFBPropertyFlagReadOnly = (1 << 5),
00117     kFBPropertyFlagNotUserDeletable = (1 << 6)
00118 };
00119 
00124 #define FB_DEFINE_COMPONENT( DllTag, Type )                                             \
00125     class FB##Type; typedef  FB##Type *HFB##Type;                                       \
00126     typedef class DllTag FBPropertyBase< HFB##Type,kFBPT_object > FBPropertyBase##Type; \
00127     typedef class DllTag FBPropertyBaseComponent< HFB##Type > FBProperty##Type
00128 
00133 #define FB_DEFINE_ENUM( DllTag, Type ) \
00134     typedef class DllTag FBPropertyBaseEnum< enum FB##Type > FBProperty##Type;
00135 
00140 #define FB_DEFINE_LIST( DllTag, Type )  \
00141     typedef class DllTag FBPropertyBaseList< HFB##Type > FBPropertyBaseList##Type;
00142 
00144 typedef void (*fbGetSetHandler)(void);
00146 typedef void (*fbExternalGetSetHandler)(HIObject pObject);
00147 
00148 FB_FORWARD( FBComponent );
00149 __FB_FORWARD( FBProperty );
00150 
00171 class FBSDK_DLL FBProperty : public FBPlug
00172 {
00173     FBClassDeclare( FBProperty, FBPlug );
00174 
00175 protected:
00177     FBString        mName;
00179     void*           mParent;
00180 
00181 public:
00183     FBProperty();    
00184 
00185 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00187     IObject_Declare(Implementation);        
00188 
00190     FBProperty* InitInternal( KProperty* pProperty );
00191 
00193     KProperty* GetInternal() const;
00194 
00196     void* GetValuePtr() const;
00197 
00199     FBProperty* CreateInternal( FBComponent* pParent, char* pName, fbExternalGetSetHandler pGet = NULL, fbExternalGetSetHandler pSet = NULL);
00200 
00202     void SetInternal( KProperty* pInternal );
00203 #endif
00204 
00206     void SetEnable( bool pValue );
00207 
00211     char* GetName();
00212 
00216     void SetName(char *pName);
00217 
00221     virtual FBPropertyType GetPropertyType( );
00222 
00226     char* GetPropertyTypeName();
00227     
00231     virtual KDataType* GetDataType();
00232 
00234 
00237     virtual void SetData( void* pData );
00239 
00241 
00246     virtual void GetData( void* pData, int pSize, FBEvaluateInfo *pEvalInfo = NULL ) const;
00248 
00252     int         AsInt();
00253 
00258     bool        SetInt(int pInt);
00259     
00263     virtual char* AsString();
00264 
00269     virtual bool SetString( char* pString );
00270 
00272 
00275     virtual bool IsList();
00276     virtual bool IsAnimatable();
00277     bool IsInternal() const;
00278     bool IsUserProperty();
00279     bool IsReferenceProperty();
00281 
00285     bool IsMinClamp();  
00286 
00290     bool IsMaxClamp();
00291 
00296     bool IsTemporaryProperty();
00297 
00302     bool AcceptTemporaryProperty(const char* pEnumList[] = NULL, fbExternalGetSetHandler pGet=NULL, fbExternalGetSetHandler pSet=NULL);
00303 
00307     bool IsObjectList();
00308 
00312     virtual bool IsReadOnly();
00313 
00318     virtual char* EnumList( int pIndex );
00319 
00324     FBStringList* GetEnumStringList(bool pCreateIt = false);
00325 
00328     void NotifyEnumStringListChanged();
00329 
00335     void            ModifyPropertyFlag(FBPropertyFlag pFlag, bool pValue);
00336 
00340     FBPropertyFlag  GetPropertyFlags();
00341 
00347     bool            GetPropertyFlag(FBPropertyFlag pFlag);
00348 
00355     void    SetMinMax( double pMin, double pMax, bool pForceMinClamp = false, bool pForceMaxClamp = false );
00356 
00361     void    SetMin( double pMin, bool pForceMinClamp = false );
00362 
00367     void    SetMax( double pMax, bool pForceMaxClamp = false );
00368     
00372     double  GetMin();
00373 
00377     double  GetMax();
00378 
00382     inline void* GetParent()    { return mParent; } 
00383 };
00384 
00385 __FB_FORWARD( FBPropertyAnimatable );
00386 FB_FORWARD( FBBox );
00387 FB_FORWARD( FBAnimationNode );
00388 FB_FORWARD( FBTake );
00389 
00391 // PropertyEvent
00393 __FB_FORWARD(FBPropertyEvent);
00394 
00396 class FBSDK_DLL FBPropertyEvent : public FBProperty
00397 {
00398   protected:
00399 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00400 
00401     HIRegister  mParentRegister;
00403     int         mType;              
00405     int         mSubType;
00406 #endif
00407   public:
00409     FBPropertyEvent();
00410 
00419     FBPropertyEvent *Init( FBComponent* pComponent, HIRegister pParent,char *pName, int pType, int pSubType=K_INT_MAX );    
00420 
00426     FBPropertyEvent *InitGlobal( char* pName, char* pGlobalEventName ); 
00427 
00429     virtual ~FBPropertyEvent();
00430 
00432 
00436     virtual void Add        ( HICallback pOwner, kICallbackHandler pHandler );
00437     virtual void Remove     ( HICallback pOwner, kICallbackHandler pHandler );
00439 
00441     virtual void InvalidateParent();
00442 
00446     virtual FBPropertyType GetPropertyType() override { return kFBPT_event; }
00447 
00448   private:
00449 
00450     HDataFBPropertyEvent mLocalPtr; 
00451 };
00452 
00454 class FBSDK_DLL FBPropertyEventUIIdle : public FBPropertyEvent
00455 {
00456   public:
00457     virtual void Add    ( HICallback pOwner, kICallbackHandler pHandler );
00458     virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00459 };
00460 
00462 class FBSDK_DLL FBPropertyEventConnectionNotify : public FBPropertyEvent
00463 {
00464   public:
00465     virtual void Add    ( HICallback pOwner, kICallbackHandler pHandler );
00466     virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00467 };
00468 
00470 class FBSDK_DLL FBPropertyEventConnectionDataNotify : public FBPropertyEvent
00471 {
00472   public:
00473     virtual void Add    ( HICallback pOwner, kICallbackHandler pHandler );
00474     virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00475 };
00476 
00478 class FBSDK_DLL FBPropertyEventConnectionStateNotify : public FBPropertyEvent
00479 {
00480   public:
00481     virtual void Add    ( HICallback pOwner, kICallbackHandler pHandler );
00482     virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00483 };
00484 
00488 template <class tType, FBPropertyType pPT> class FBPropertyBase : public FBProperty 
00489 { 
00490   protected: 
00491 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00492     void  (* Set)(void *, tType);   
00493     tType (* Get)(void *);          
00494 #endif
00495   public: 
00497     inline FBPropertyBase() { Set = NULL; Get = NULL; }  
00498 
00502     inline FBPropertyBase(const FBPropertyBase<tType,pPT> &pValue)  { operator=((tType)pValue ); }
00503 
00505     ~FBPropertyBase() 
00506     {     
00507     }
00508 
00516     inline FBPropertyBase *Init( void* pParent,char *pName,tType (* pGet)(void *)=NULL,void (* pSet)(void *,tType)=NULL  )
00517     {  
00518         mParent = pParent;  
00519         mName   = pName ;   
00520         Get     = pGet;     
00521         Set     = pSet;     
00522         return this;
00523     } 
00524 
00526 
00530     inline void operator=(tType pValue)                 { SetData( &pValue ); }
00532 
00537     inline operator tType() const                       { tType Value; GetData( &Value,sizeof(Value) ); return Value; } 
00538 
00542     virtual FBPropertyType GetPropertyType( ) override { return pPT; }
00543 
00547     inline void SetPropertyValue( tType pValue )
00548     {
00549         if(IsInternal() && GetValuePtr())
00550         {
00551             *(tType*)GetValuePtr() = pValue;
00552         }
00553     }
00554 
00558     inline tType GetPropertyValue( )
00559     {
00560         if(IsInternal() && GetValuePtr())
00561         {
00562             return *(tType*)GetValuePtr();
00563         } else
00564         {
00565             return (tType)0;
00566         }
00567     }
00568 
00573     inline virtual bool IsReadOnly()  { return IsInternal() ? (FBProperty::IsReadOnly()) : (Set == NULL); }
00574 
00578     inline virtual void GetData(void* pData, int pSize, FBEvaluateInfo *pEvalInfo = NULL) const
00579     {
00580         if(Get)
00581         { 
00582             *((tType*)pData) = (*Get)(mParent); 
00583         } 
00584         else if (IsInternal())
00585         {
00586             FBProperty::GetData( pData, pSize, pEvalInfo );
00587         } 
00588         else
00589         {
00590             assert(Get != NULL || IsInternal());
00591             *((tType*)pData) = (tType)0; 
00592         }
00593     }
00597     inline virtual void SetData(void* pData)
00598     { 
00599         if(Set) 
00600         { 
00601             (*Set)( mParent,*(tType*)pData ); 
00602         } 
00603         else if (IsInternal())
00604         {
00605             FBProperty::SetData( pData );
00606         } 
00607         else
00608         { 
00609             assert( Set != NULL || IsInternal() ); 
00610         } 
00611     } 
00612 };
00613 
00617 template <class tType> class FBPropertyBaseEnum : public FBPropertyBase<tType,kFBPT_enum>
00618 {
00619   public: 
00620 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00621 
00622     static const char *mStrings[];
00623 #endif
00625     inline FBPropertyBaseEnum(){}  
00626 
00628     inline ~FBPropertyBaseEnum()
00629     {
00630 
00631     }  
00632 
00636     inline FBPropertyBaseEnum(const FBPropertyBaseEnum<tType> &pValue)  { operator=((tType)pValue ); }
00637 
00639 
00643     inline void operator=(tType pValue)                 { SetData( &pValue ); }
00645 
00650     inline operator tType() const                       { tType Value; GetData( &Value,sizeof(Value) ); return Value; } 
00651 
00652     virtual char* EnumList( int pIndex ) override   
00653     {   
00654         if( IsInternal() )
00655         {
00656             return FBProperty::EnumList( pIndex );
00657         }
00658         else if(mStrings)
00659         {
00660             return (char *)mStrings[pIndex]; 
00661         }
00662         else
00663         {
00664             assert(mStrings || FBPropertyBaseEnum::IsInternal());
00665             return NULL;
00666         }
00667     }
00668 
00672     virtual char* AsString() override { return EnumList( FBPropertyBaseEnum::AsInt() );}
00673 
00677     virtual bool SetString( char *pString ) override
00678     {
00679         int         Count=0;
00680         const char *    tmpstr;
00681         while ((tmpstr=EnumList( Count ))!=NULL) {
00682             if (strcmp(tmpstr,pString)==0) {
00683                 FBPropertyBaseEnum::SetData( &Count );
00684                 return true;
00685             }
00686             Count++;
00687         }
00688         return false;
00689     }
00690 
00691 };
00692 
00693 
00697 class FBSDK_DLL FBPropertyBasicList : public FBProperty
00698 {
00699 public:
00701     FBPropertyBasicList();
00702     ~FBPropertyBasicList();
00707     FBPropertyBasicList( HIObject pParent, char *pName );
00712     FBProperty* Init( void* pParent, char *pName );
00713 
00715     void RemoveAll();
00716 
00721     virtual int GetCount()=0;
00722 
00727     virtual void RemoveAt( int pIndex )=0;
00728 
00732     virtual bool IsList();
00733 };
00734 
00738 template <class tType> class FBPropertyBaseList : public FBPropertyBasicList
00739 {
00740 public:
00742     FBPropertyBaseList( ):FBPropertyBasicList( ) {}
00743 
00745     ~FBPropertyBaseList( )
00746     {
00747 
00748     }
00753     FBPropertyBaseList( HIObject pParent, char *pName ):FBPropertyBasicList( pParent, pName ) {}
00754 
00755 public:  
00756     //***
00757     //--- These functions require overloads in derived classes. 
00758     //***
00759     
00765     virtual int Add( tType pItem )=0;
00766 
00772     virtual tType operator[]( int pIndex )=0;
00773 
00774 public: 
00775     //***
00776     //--- These functions can be optionally overloaded in derived classes.
00777     //***
00778 
00783     inline virtual int Find( tType pItem )      
00784     { 
00785         int Index;
00786         for(Index=0; Index<GetCount(); Index++ ) 
00787         {
00788             if( operator[](Index)==pItem ) 
00789             {
00790                 return Index; 
00791             }
00792         }
00793         return -1;
00794     }
00795 
00800     inline virtual int Remove( tType pItem )        
00801     {
00802         int Index = Find( pItem ); 
00803         if (Index!=-1)
00804         {
00805             RemoveAt( Index );
00806         }
00807         return Index;
00808     }
00809 
00814     inline virtual tType GetAt(int pIndex)  
00815     {
00816         return operator[](pIndex); 
00817     }
00818 };
00819 
00821 enum kDefaultEnum { 
00822     kDefaultItemNone    
00823 };
00824 
00825 
00826 typedef class FBSDK_DLL FBPropertyBaseEnum< enum kDefaultEnum > FBPropertyEnum;
00831 FB_FORWARD( FBPropertyStringList );
00832 
00834 class FBSDK_DLL FBPropertyStringList : public FBProperty
00835 {
00836   public:
00838     FBPropertyStringList();
00839 
00841     virtual ~FBPropertyStringList();
00842 
00848     FBPropertyStringList* Init( FBComponent* pComponent, char *pName );
00849 
00850   public:
00855     kReference  GetReferenceAt( int pIndex );
00860     void SetReferenceAt( int pIndex,kReference pRef );
00861     
00866     int Find( kReference pRef );
00867 
00872     int Find( char *S );
00873 
00878     virtual char *GetAt( int pIndex );
00879 
00885     char *operator[](int pIndex);
00886 
00888     void Sort( );
00889 
00893     int GetCount();
00894 
00899     int Remove( char *S );
00900 
00901   public:  // Needs to be overriden for special behaviors
00907     virtual int Add( char *S,kReference pRef = 0 );
00908 
00910     virtual void Clear();
00911 
00915     virtual void RemoveAt( int pIndex );
00916     
00921     virtual int IndexOf(char *S);
00922     
00928     virtual void InsertAt( int pIndex, char *S,kReference pRef = 0 );
00929 
00935     virtual bool SetAt( int pIndex,char *pString );
00936 
00940     virtual bool IsList() override;
00941 
00945     virtual char* AsString() override;
00946 
00950     virtual bool SetString( char *pString ) override;
00951 
00955     virtual FBPropertyType GetPropertyType() override { return kFBPT_stringlist; }
00956 };
00957 
00959 // FBPropertyManager
00961 __FB_FORWARD( FBPropertyManager );
00962 
00968 class FBSDK_DLL FBPropertyManager 
00969 {
00970 public:
00972     FBPropertyManager();
00973 
00975     ~FBPropertyManager();
00976 
00981     int Add( HFBProperty Property );
00982 
00988     HFBProperty operator[](int pIndex);
00989 
00993     int GetCount();
00994 
01001     HFBProperty Find( const char *pPropertyName, bool pMultilangLookup=true );
01002 
01007     int Remove( FBProperty* pProperty );
01008 
01013     void AddToCache( FBProperty* pProperty );
01014 
01019     void RemoveFromCache( KProperty* pProperty );
01020 
01026     FBProperty* FindInCache( KProperty* pProperty );
01027 
01028 private:
01032     void ClearCache();
01033 
01038     void SetParent( HIObject pParent );
01039 
01040 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01041     KObject*                        mObject;        
01042     FBArrayTemplate< FBProperty* >  mPropertyCache; 
01043     FBArrayTemplate< FBProperty* >  mPropertyLocal; 
01044 #endif
01045     friend class FBComponent;
01046     friend class FBVisualComponent;
01047 };
01048 
01052 template <class tType> class FBPropertyBaseComponent : public FBPropertyBase< tType, kFBPT_object > 
01053 {
01054   public:
01056         int *TypeInfo;  
01057   public:
01059     inline FBPropertyBaseComponent() {}
01060 
01064     inline FBPropertyBaseComponent(const FBPropertyBaseComponent<tType> &pValue)    { FBPropertyBase< tType,kFBPT_object >::operator=((tType)pValue ); }
01065 
01067     ~FBPropertyBaseComponent()
01068     {
01069     }
01070 
01072 
01075     inline void operator=(tType pValue)                             { FBPropertyBase< tType,kFBPT_object >::operator=(pValue); } 
01077 
01081     inline tType operator -> ()                                 { return FBPropertyBase< tType,kFBPT_object >::operator tType(); } 
01082 
01086     inline operator tType() const                                   { return FBPropertyBase< tType,kFBPT_object >::operator tType(); } 
01087 };
01088 
01093 #if defined(KARCH_DEV_INTEL)
01094     #define FBImplementPropertyComponent( DllTag, Type ) 
01095 #else
01096     #define FBImplementPropertyComponent( DllTag, Type ) \
01097         template class DllTag FBSDKNamespaceFunc(FBPropertyBase)< HFB##Type,kFBPT_object >; \
01098         template class DllTag FBSDKNamespaceFunc(FBPropertyBaseComponent)< HFB##Type >;
01099 #endif
01100 
01105 #if defined(KARCH_DEV_INTEL)
01106     #define FBImplementPropertyEnum( DllTag, Type ) // On SGI by having mString defined for each enum already instantiates the template.
01107 #else
01108     #define FBImplementPropertyEnum( DllTag, Type ) \
01109         template class DllTag FBSDKNamespaceFunc(FBPropertyBaseEnum)< enum FB##Type >
01110 #endif
01111 
01116 #if defined(KARCH_DEV_INTEL)
01117     #define FBImplementPropertyList( DllTag, Type )
01118 #else
01119     #define FBImplementPropertyList( DllTag, Type ) \
01120         template class DllTag FBSDKNamespaceFunc(FBPropertyBaseList) < HFB##Type >
01121 #endif
01122 
01123 
01125 typedef class FBSDK_DLL FBPropertyBase< char *,kFBPT_charptr > FBPropertyString;
01126 
01128 typedef class FBSDK_DLL FBPropertyBase< bool,kFBPT_bool > FBPropertyBool;
01129 
01131 class FBSDK_DLL FBPropertyAction : public FBPropertyBase< bool, kFBPT_Action > 
01132 {
01133   public:
01135     inline FBPropertyAction() {}
01136 
01138     ~FBPropertyAction()
01139     {
01140     }
01141 
01145     bool operator ()();
01146 };
01147 
01149 typedef class FBSDK_DLL FBPropertyBase< int,kFBPT_int > FBPropertyInt;
01150 
01152 typedef class FBSDK_DLL FBPropertyBase< long long,kFBPT_int64 > FBPropertyInt64;
01153 
01155 typedef class FBSDK_DLL FBPropertyBase< unsigned long long,kFBPT_uint64 > FBPropertyUInt64;
01156 
01158 typedef class FBSDK_DLL FBPropertyBase< double,kFBPT_double > FBPropertyDouble;
01159 
01161 typedef class FBSDK_DLL FBPropertyBase< float,kFBPT_float > FBPropertyFloat;
01162 
01164 typedef class FBSDK_DLL FBPropertyBase< FBTime,kFBPT_Time > FBPropertyTime;
01165 
01167 typedef class FBSDK_DLL FBPropertyBase< FBTimeSpan,kFBPT_TimeSpan > FBPropertyTimeSpan;
01168 
01170 typedef class FBSDK_DLL FBPropertyBase< kReference,kFBPT_kReference >   FBPropertykReference;
01171 
01173 typedef class FBSDK_DLL FBPropertyBase< HFBProperty,kFBPT_Reference >           FBPropertyReference;
01175 typedef class FBSDK_DLL FBPropertyBase< HFBComponent,kFBPT_object >         _FBPropertyBaseComponent;
01177 typedef class FBSDK_DLL FBPropertyBaseComponent< HFBComponent > FBPropertyComponent;
01179 typedef FBPropertyComponent *HFBPropertyComponent;
01181 typedef class FBSDK_DLL FBPropertyBase< HFBPlug,kFBPT_object >           _FBPropertyBasePlug;
01183 typedef class FBPropertyBaseComponent< HFBPlug >  FBPropertyPlug;
01185 typedef FBPropertyPlug *HFBPropertyPlug;
01186 
01194 #define FBPropertyInit( Param,Type,PropName,Get,Set ) \
01195     { \
01196         PropertyAdd(PropName.Init( (void*)Param,#PropName,(Type (*)(void *))Get,(void (*)(void *,Type))Set )); \
01197     }
01198 
01203 #define FBPropertyInitList( Param,PropName ) \
01204     { \
01205         PropertyAdd(PropName.Init( Param,#PropName )); \
01206     }
01207 
01212 #define FBPropertyInitStringList( Param,PropName ) \
01213     { \
01214         PropertyAdd(PropName.Init( Param, #PropName )); \
01215     }
01216 
01223 #define FBPropertyInitEvent( Param,Type,SubType,PropName ) \
01224     { \
01225         PropertyAdd(PropName.Init( this, IQ(Param,IRegister),#PropName,Type,SubType )); \
01226     }
01227 
01232 #define FBPropertyInitEventGlobal( GlobalEventName,PropName ) \
01233     { \
01234         PropertyAdd(PropName.InitGlobal( #PropName,GlobalEventName )); \
01235     }
01236 
01238 #define FBPropertyInitInternal( Parent, PropName, MBProperty ) \
01239     {\
01240         PropertyAdd(PropName.InitInternal( MBProperty ));\
01241     }
01242 
01244 #define FBPropertyInitInternalEnum( Param,Type,PropName,MBProperty,Get,Set  ) \
01245 {\
01246     PropName.InitInternal( MBProperty ); \
01247     PropertyAdd(PropName.Init( (void*)Param,#PropName,(Type (*)(void *))Get,(void (*)(void *,Type))Set )); \
01248 }
01249 
01257 #define FBPropertyPublish( Parent,Prop,PropName,Get,Set ) \
01258     { \
01259         PropertyAdd(Prop.CreateInternal( Parent,PropName,(fbExternalGetSetHandler)Get,(fbExternalGetSetHandler)Set )); \
01260     }
01261 
01262 typedef class FBSDK_DLL FBPropertyBase< FBColor,kFBPT_ColorRGB >    FBPropertyColor;
01267 typedef class FBSDK_DLL FBPropertyBase< FBColorAndAlpha,kFBPT_ColorRGBA >   FBPropertyColorAndAlpha;
01272 typedef class FBSDK_DLL FBPropertyBase< FBVector2d,kFBPT_Vector2D > FBPropertyVector2d;
01277 typedef class FBSDK_DLL FBPropertyBase< FBVector3d,kFBPT_Vector3D > FBPropertyVector3d;
01283 typedef class FBSDK_DLL FBPropertyBase< FBVector4d,kFBPT_Vector4D > FBPropertyVector4d;
01288 
01289 class FBSDK_DLL FBPropertyAnimatable : public FBProperty
01290 {
01291   public:
01294     FBPropertyAnimatable();
01295 
01298     virtual ~FBPropertyAnimatable();
01299 
01300   public:
01301 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01303     FBPropertyAnimatable* InitInternal( KEvaluationProperty* pProperty );
01304 #endif
01305 
01312     FBPropertyAnimatable* Init( HFBBox pOwner, char* pName, char* pType, double* pInit );
01313 
01317     void Destroy();
01318 
01322     virtual KDataType* GetDataType() override;
01323 
01327     char* GetDataTypeName();
01328 
01332     bool IsFocused();
01333 
01337     void SetFocus( bool pState );
01338 
01341     void Key();
01342 
01346     int GetDataSize() const;
01347 
01349 
01352     virtual bool IsAnimatable() override { return true; }
01353 
01358     bool IsAnimated();
01359 
01363     void SetAnimated( bool pState );
01364 
01369     FBAnimationNode* GetAnimationNode(FBTake* pTake=NULL);
01370 
01374     HFBBox GetBox();
01375 
01379     virtual void SetData( void* pData ) override;
01380 
01384     virtual void GetData( void* pData, int pSize, HFBEvaluateInfo pEvalInfo = NULL ) const override;
01385 };
01386 
01390 template <class tType, FBPropertyType pPT> class FBPropertyBaseAnimatable : public FBPropertyAnimatable
01391 {
01392   public:
01394     FBPropertyBaseAnimatable( );
01395     FBPropertyBaseAnimatable( const FBPropertyBaseAnimatable<tType,pPT> &pValue);
01396 
01398     ~FBPropertyBaseAnimatable( );
01399 
01401 
01404     void operator=(tType pValue);
01406 
01410     operator tType() const;
01411 
01415     virtual FBPropertyType GetPropertyType( ) override { return pPT; }
01416 };
01417 
01418 
01419 typedef class FBSDK_DLL FBPropertyBaseAnimatable< bool,kFBPT_Action > FBPropertyAnimatableAction;
01423 typedef class FBSDK_DLL FBPropertyBaseAnimatable< bool,kFBPT_bool > FBPropertyAnimatableBool;
01427 typedef class FBSDK_DLL FBPropertyBaseAnimatable< int,kFBPT_int > FBPropertyAnimatableInt;
01431 typedef class FBSDK_DLL FBPropertyBaseAnimatable< long long,kFBPT_int64 > FBPropertyAnimatableInt64;
01435 typedef class FBSDK_DLL FBPropertyBaseAnimatable< unsigned long long,kFBPT_uint64 > FBPropertyAnimatableUInt64;
01439 typedef class FBSDK_DLL FBPropertyBaseAnimatable< int,kFBPT_enum > FBPropertyAnimatableEnum;
01443 typedef class FBSDK_DLL FBPropertyBaseAnimatable< double,kFBPT_double >  FBPropertyAnimatableDouble;
01447 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBTime,kFBPT_Time >    FBPropertyAnimatableTime;
01451 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBVector2d,kFBPT_Vector2D > FBPropertyAnimatableVector2d;
01455 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBVector3d,kFBPT_Vector3D > FBPropertyAnimatableVector3d;
01459 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBVector4d,kFBPT_Vector4D > FBPropertyAnimatableVector4d;
01463 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBColor,kFBPT_ColorRGB >  FBPropertyAnimatableColor;
01467 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBColorAndAlpha,kFBPT_ColorRGBA > FBPropertyAnimatableColorAndAlpha;
01476 template <class tType> class FBPropertyBaseAnimatableEnum : public  FBPropertyBaseAnimatable<int,kFBPT_enum>
01477 {
01478   public: 
01479 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01480 
01481     static const char *mStrings[];
01482 #endif
01483 
01485     inline FBPropertyBaseAnimatableEnum(){}  
01486 
01488     inline ~FBPropertyBaseAnimatableEnum()
01489     {
01490     }  
01491 
01495     inline FBPropertyBaseAnimatableEnum(const FBPropertyBaseAnimatableEnum<tType> &pValue)  { operator=((tType)pValue ); }
01496 
01498 
01502     inline void operator=(tType pValue)                 { SetData( &pValue ); }
01504 
01509     inline operator tType() const                       { tType Value; GetData( &Value,sizeof(Value) ); return Value; } 
01510 
01511     virtual char* EnumList( int pIndex ) override
01512     {   
01513         if( IsInternal() )
01514         {
01515             return FBProperty::EnumList( pIndex );
01516         }
01517         else if(mStrings)
01518         {
01519             return (char *)mStrings[pIndex]; 
01520         }
01521         else
01522         {
01523             assert(mStrings || IsInternal());
01524             return NULL;
01525         }
01526     }
01527 
01531     virtual char* AsString() override { return EnumList( AsInt() );}
01532 
01536     virtual bool SetString( char *pString ) override
01537     {
01538         int         Count=0;
01539         const char *    tmpstr;
01540         while ((tmpstr=EnumList( Count ))!=NULL) {
01541             if (strcmp(tmpstr,pString)==0) {
01542                 SetData( &Count );
01543                 return true;
01544             }
01545             Count++;
01546         }
01547         return false;
01548     }
01549 
01550 
01551 };
01552 
01554 // Global
01556 #ifdef FBSDKUseNamespace
01557     }
01558 #endif
01559 
01560 #endif

Please send us your comments about this page.