00001 #ifndef __FBPLUG_H__
00002 #define __FBPLUG_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00045 #include <kaydaradef.h>
00046
00047 #ifndef FBSDK_DLL
00048
00051 #define FBSDK_DLL K_DLLIMPORT
00052 #endif
00053
00054
00055 #include <object/i/icallback.h>
00056 #include <fbsdk/fbdefines.h>
00057 #include <fbsdk/fbscriptwrapper.h>
00058 #include <fbsdk/fbarray.h>
00059
00060 #ifdef FBSDKUseNamespace
00061 namespace FBSDKNamespace {
00062 #endif
00063
00064
00066
00068 FB_FORWARD( FBPlug );
00069
00071 enum FBConnectionAction
00072 {
00073
00074 kFBRequestConnectSrc = 0,
00075 kFBRequestConnectDst,
00076 kFBConnectSrc,
00077 kFBConnectDst,
00078 kFBConnectedSrc,
00079 kFBConnectedDst,
00080
00081 kFBRequestDisconnectSrc,
00082 kFBRequestDisconnectDst,
00083 kFBDisconnectSrc,
00084 kFBDisconnectDst,
00085 kFBDisconnectedSrc,
00086 kFBDisconnectedDst,
00087
00088 kFBBeginReplaceSrc,
00089 kFBEndReplaceSrc,
00090 kFBBeginReplaceDst,
00091 kFBEndReplaceDst,
00092 kFBReorderSrc,
00093 kFBReorderedSrc,
00094
00095 kFBBeginChange,
00096 kFBEndChange,
00097 kFBConnectedOwner,
00098 kFBDisconnectOwner,
00099
00100
00101 kFBCandidate,
00102 kFBCandidated,
00103 kFBCandidateGlobal,
00104
00105
00106 kFBDetached,
00107 kFBDestroy,
00108
00109 kFBSelect,
00110 kFBUnselect,
00111 kFBReselect,
00112
00113 kFBRequestRename,
00114 kFBRename,
00115 kFBRenamed,
00116
00117 kFBRequestPrefixRename,
00118 kFBPrefixRename,
00119 kFBPrefixRenamed,
00120
00121 kFBDescription,
00122
00123
00124 kFBKeyingKey,
00125 kFBKeyingDeleteKey,
00126 kFBKeyingCandidate,
00127
00128
00129 kFBConnect = kFBConnectSrc,
00130 kFBConnected = kFBConnectedSrc,
00131 kFBDisconnect = kFBDisconnectSrc,
00132 kFBDisconnected = kFBDisconnectedSrc
00133 };
00134
00135 FBSDK_DLL const char* FBGetConnectionActionString( FBConnectionAction pAction );
00136
00138 enum FBConnectionType
00139 {
00140 kFBConnectionTypeNone,
00141 kFBConnectionTypeSystem
00142 };
00143
00144 enum FBPlugModificationFlag
00145 {
00146 kFBPlugAllContent = 0,
00147 kFBSelfDataModified = 1 << 8,
00148 kFBContentDataModified = 1 << 9,
00149 kFBAllDataModified = kFBSelfDataModified | kFBContentDataModified,
00150
00151 kFBSelfKeyingModified = 1 << 10,
00152 kFBContentKeyingModified = 1 << 11,
00153 kFBAllKeyingModified = kFBSelfKeyingModified | kFBContentKeyingModified,
00154
00155 kFBSelfStateModified = 1 << 12,
00156 kFBContentStateModified = 1 << 13,
00157 kFBAllStateModified = kFBSelfStateModified | kFBContentStateModified,
00158
00159 kFBSelfConnectionSrcObjectModified = 1 << 14,
00160 kFBSelfConnectionSrcPropertyModified = 1 << 15,
00161 kFBSelfConnectionDstObjectModified = 1 << 16,
00162 kFBSelfConnectionDstPropertyModified = 1 << 17,
00163 kFBSelfConnectionModifiedMask = kFBSelfConnectionSrcObjectModified | kFBSelfConnectionSrcPropertyModified | kFBSelfConnectionDstObjectModified | kFBSelfConnectionDstPropertyModified,
00164 kFBContentConnectionModified = 1 << 18,
00165 kFBAllConnectionModified = kFBSelfConnectionModifiedMask | kFBContentConnectionModified,
00166
00167 kFBSelfCustomPropertyModified = 1 << 19,
00168 kFBContentCustomPropertyModified = 1 << 20,
00169 kFBAllCustomPropertyModified = kFBSelfCustomPropertyModified | kFBContentCustomPropertyModified,
00170
00171 kFBSelfAllModifiedMask = kFBSelfDataModified | kFBSelfKeyingModified | kFBSelfStateModified | kFBSelfCustomPropertyModified | kFBSelfConnectionModifiedMask,
00172 kFBContentAllModifiedMask = kFBContentDataModified | kFBContentKeyingModified | kFBContentStateModified | kFBContentCustomPropertyModified | kFBContentConnectionModified,
00173 kFBAllModifiedMask = kFBSelfAllModifiedMask | kFBContentAllModifiedMask
00174 };
00175
00176 enum FBPlugStatusFlag
00177 {
00178 kFBPlugStatusFlagNone = 0,
00179 kFBOwnedByUndo = 1<<21,
00180 kFBPlugStatusFlagMask = kFBOwnedByUndo
00181 };
00182
00184 typedef FBArrayTemplate<FBPlug*> FBPlugList;
00185
00186 FBSDK_DLL const char* FBGetConnectionTypeString( FBConnectionType pType );
00187
00198 class FBSDK_DLL FBPlug : public ICallback
00199 , public FBWrapperHolder
00200 {
00201 protected:
00202 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00203
00207 FBPlug( HIObject pObject );
00208 public:
00210 virtual ~FBPlug();
00211
00213 virtual HIObject GetHIObject() const;
00214
00216 virtual bool SetHIObject( HIObject pObject, bool pSDKComponent );
00217 #endif
00218
00220 bool IsSDKComponent();
00221
00227 bool ConnectSrc( FBPlug* pSrc, FBConnectionType pConnectionType=kFBConnectionTypeNone );
00228
00234 bool ConnectDst( FBPlug* pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone );
00235
00243 bool ConnectSrcAt( int pDst_SrcIndex, FBPlug* pSrc, FBConnectionType pConnectionType=kFBConnectionTypeNone );
00244
00252 bool ConnectDstAt( int pSrc_DstIndex, FBPlug* pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone );
00253
00258 bool DisconnectDst( FBPlug* pDst );
00259
00264 bool DisconnectSrc( FBPlug* pSrc );
00265
00267 void DisconnectAllSrc();
00268
00270 void DisconnectAllDst();
00271
00276 bool DisconnectDstAt( int pIndex );
00277
00282 bool DisconnectSrcAt( int pIndex );
00283
00289 bool ReplaceDstAt( int pIndex, FBPlug* pDst );
00290
00296 bool ReplaceSrcAt( int pIndex, FBPlug* pSrc );
00297
00303 bool SwapSrc( int pIndexA, int pIndexB );
00304
00311 bool MoveSrcAt( int pIndex, int pAtIndex );
00312
00319 bool MoveSrcAt( FBPlug* pSrc, FBPlug* pAtSrc );
00320
00324 int GetSrcCount();
00325
00330 FBPlug* GetSrc( int pIndex );
00331
00336 FBConnectionType GetSrcType( int pIndex );
00337
00341 int GetDstCount();
00342
00347 FBPlug* GetDst( int pIndex );
00348
00353 FBConnectionType GetDstType( int pIndex );
00354
00358 bool BeginChange();
00359
00361 void EndChange();
00362
00367 void SetSelfModified(FBPlugModificationFlag pFlag, bool pBool);
00368
00373 bool GetSelfModified(FBPlugModificationFlag pFlag);
00374
00379 void SetContentModified(FBPlugModificationFlag pFlag, bool pBool);
00380
00385 bool GetContentModified(FBPlugModificationFlag pFlag);
00386
00393 int GetPlugConnectionModifiedList(FBPlugList& pPlugList, FBPlugModificationFlag pConnectionModificatonFlag, bool pAddRemove);
00394
00399 bool RevertModification(FBPlugModificationFlag pFlag = kFBAllModifiedMask);
00400
00405 void SetStatusFlag(FBPlugStatusFlag pStatus, bool pValue);
00406
00411 bool GetStatusFlag(FBPlugStatusFlag pStatus) const;
00412
00416 FBPlug* GetOwner();
00417
00422 FBPlug* GetOwned( int pIndex );
00423
00427 int GetOwnedCount();
00428
00430 virtual const char* ClassName();
00432
00435 virtual bool Is( int pTypeId );
00436
00438
00441 virtual int GetTypeId();
00442
00444 static const char* ClassGroupName;
00445
00447 static int TypeInfo;
00448
00450 bool mAllocated;
00451
00460 virtual bool PlugDataNotify(FBConnectionAction pAction,FBPlug* pThis,void* pData=NULL,void* pDataOld=NULL,int pDataSize=0);
00461
00470 virtual bool PlugStateNotify(FBConnectionAction pAction,FBPlug* pThis,void* pData=NULL,void* pDataOld=NULL,int pDataSize=0);
00471
00481 virtual bool PlugNotify(FBConnectionAction pAction,FBPlug* pThis,int pIndex,FBPlug* pPlug = NULL,FBConnectionType pConnectionType=kFBConnectionTypeNone,FBPlug* pNewPlug=NULL );
00482
00483 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00484 IObject_Declare(K_IMPLEMENTATION);
00485 ICallback_Declare(K_IMPLEMENTATION);
00486
00490 static void PrintClassDefinitions();
00491
00492 #endif
00493
00494 protected:
00498 virtual void FBDelete();
00499
00500 static int mGlobalTypeInfo;
00501 static int GetInternalClassId();
00502 HIObject mObject;
00503 bool mSDKComponent;
00504 FBSDK_DLL friend int __FBRegisterTypeInfo(int pInternalClassId);
00505 };
00506
00507
00509
00511
00518 FBSDK_DLL bool FBConnect( FBPlug* pSrc, FBPlug* pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone );
00519
00526 FBSDK_DLL bool FBDisconnect( FBPlug* pSrc, FBPlug* pDst );
00527
00528
00537 class FBSDK_DLL HdlFBPlug
00538 {
00539 public:
00540
00541 HdlFBPlug();
00542 HdlFBPlug(const FBPlug * pFBPlug);
00543 HdlFBPlug(HdlFBPlug const &pFBPlug);
00544 ~HdlFBPlug();
00545
00546
00547 bool Ok() const;
00548
00550
00553 bool Is( int pTypeId );
00554
00555
00556
00557
00558
00559 HdlFBPlug& operator= (const FBPlug* pFBPlug);
00560 HdlFBPlug& operator= (const HdlFBPlug& pFBPlug);
00561
00562
00563 bool operator==(const HdlFBPlug& pFBPlug) const;
00564 bool operator!=(const HdlFBPlug& pFBPlug) const;
00565
00566 FBPlug* GetPlug() const;
00567 inline FBPlug* operator()() const { return GetPlug(); }
00568 inline FBPlug* operator->() const { return GetPlug(); }
00569
00570 inline operator FBPlug* () const
00571 {
00572 return (FBPlug *)GetPlug();
00573 }
00574
00575
00576 protected:
00577 void SetPlug(const FBPlug* pFBPlug);
00578
00579 private:
00580 void * mData;
00581 };
00582
00583 template <class T> class HdlFBPlugTemplate : public HdlFBPlug
00584 {
00585 public:
00586 HdlFBPlugTemplate()
00587 {
00588 }
00589
00590 HdlFBPlugTemplate(HdlFBPlug const &pPlug)
00591 : HdlFBPlug(pPlug)
00592 {
00593 }
00594
00595 HdlFBPlugTemplate(const FBPlug *pPlug)
00596 : HdlFBPlug((FBPlug *)pPlug)
00597 {
00598 }
00599
00600 HdlFBPlugTemplate<T>& operator=(const HdlFBPlugTemplate<T>& pPlug)
00601 {
00602 SetPlug(pPlug.GetPlug());
00603 return *this;
00604 }
00605
00606 bool operator==(const HdlFBPlugTemplate<T>& pFBPlug) const
00607 {
00608 return GetPlug() == pFBPlug.GetPlug();
00609 }
00610
00611 bool operator!=(const HdlFBPlugTemplate<T>& pFBPlug) const
00612 {
00613 return GetPlug() != pFBPlug.GetPlug();
00614 }
00615
00616 T* operator()() const
00617 {
00618 return (T *)GetPlug();
00619 }
00620
00621 T* operator->() const
00622 {
00623 return (T *)GetPlug();
00624 }
00625
00626 operator T*() const
00627 {
00628 return (T *)GetPlug();
00629 }
00630
00631
00632
00633 };
00634
00635 #ifdef FBSDKUseNamespace
00636 }
00637 #endif
00638
00639 #endif