00001 #ifndef __FBASSETMNG_H__
00002 #define __FBASSETMNG_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
00043 #include <kaydaradef.h>
00044 #ifndef FBSDK_DLL
00045
00048 #define FBSDK_DLL K_DLLIMPORT
00049 #endif
00050
00051 #include <fbsdk/fbcomponent.h>
00052
00053 #ifdef FBSDKUseNamespace
00054 namespace FBSDKNamespace {
00055 #endif
00056
00057
00058 __FB_FORWARD( FBAssetItem );
00059 __FB_FORWARD( FBAssetFile );
00060 __FB_FORWARD( FBAssetFolder );
00061 __FB_FORWARD( FBAssetMng );
00062
00063
00065
00067
00069 class FBSDK_DLL FBAssetItem : public FBComponent
00070 {
00071 __FBClassDeclare( FBAssetItem, FBComponent );
00072 public:
00073
00078 FBAssetItem( char* pName, HIObject pObject = NULL );
00079
00083 virtual FBString GetName() const = 0;
00084
00088 virtual FBString GetLocalPath() const = 0;
00089
00093 virtual FBString GetServerPath() const = 0;
00094
00098 virtual HFBAssetFolder GetParent() const = 0;
00099
00105 virtual bool GetLatest( bool pReplaceCheckedOut = false, bool pSilent = false ) = 0;
00106
00113 virtual bool CheckIn( const FBString& pComment = "", bool pKeepCheckedOut = false, bool pSilent = false ) = 0;
00114
00122 virtual bool CheckOut( const FBString& pComment = "", bool pDontGetLocal = false, bool pSilent = false ) = 0;
00123
00129 virtual bool UndoCheckOut( bool pReplaceLocalFile = true, bool pSilent = false ) = 0;
00130
00133 virtual void ShowHistory() const = 0;
00134
00137 virtual void ShowProperties() const = 0;
00138
00139 FBString LastError;
00140 };
00141
00142
00144
00146
00153 #define FBRegisterAssetFile( UniqueNameStr, ClassName, Label, Desc, IconFilename ) \
00154 HIObject RegisterAssetFile##ClassName( HIObject ,char * pName,void * ) \
00155 { \
00156 ClassName *Class = new ClassName( Label ); \
00157 Class->Name = UniqueNameStr; \
00158 if (Class->FBCreate()) { \
00159 return Class->GetHIObject(); \
00160 } else { \
00161 delete Class; \
00162 return NULL; \
00163 } \
00164 } \
00165 FBLibraryModule( ClassName ) \
00166 { \
00167 FBRegisterObject( ClassName,"Asset/AssetItem/AssetFile",Label,Desc,RegisterAssetFile##ClassName, true, IconFilename ); \
00168 }
00169
00174 #define FBAssetFileDeclare( ClassName, Parent ) \
00175 FBClassDeclare( ClassName,Parent); \
00176 public: \
00177 ClassName(char * pName):Parent(pName) { FBClassInit; } \
00178 private:
00179
00183 #define FBAssetFileImplementation( ThisComponent ) \
00184 FBClassImplementation( ThisComponent )
00185
00187
00189
00191 class FBSDK_DLL FBAssetFile : public FBAssetItem
00192 {
00193 __FBClassDeclare( FBAssetFile, FBAssetItem );
00194 public:
00199 FBAssetFile( char* pName, HIObject pObject = NULL );
00200
00201 IObject_Declare(Implementation);
00202
00206 virtual bool FBCreate();
00207
00211 virtual bool IsCheckedOut() const = 0;
00212
00216 virtual bool IsCheckedOutByMe() const = 0;
00217
00221 virtual FBString GetCheckedOutBy() const = 0;
00222 };
00223
00224
00226
00228
00235 #define FBRegisterAssetFolder( UniqueNameStr, ClassName, Label, Desc, IconFilename ) \
00236 HIObject RegisterAssetFolder##ClassName( HIObject ,char * pName,void * ) \
00237 { \
00238 ClassName *Class = new ClassName( Label ); \
00239 Class->Name = UniqueNameStr; \
00240 if (Class->FBCreate()) { \
00241 return Class->GetHIObject(); \
00242 } else { \
00243 delete Class; \
00244 return NULL; \
00245 } \
00246 } \
00247 FBLibraryModule( ClassName ) \
00248 { \
00249 FBRegisterObject( ClassName,"Asset/AssetItem/AssetFolder",Label,Desc,RegisterAssetFolder##ClassName, true, IconFilename ); \
00250 }
00251
00256 #define FBAssetFolderDeclare( ClassName, Parent ) \
00257 FBClassDeclare( ClassName,Parent); \
00258 public: \
00259 ClassName(char * pName):Parent(pName) { FBClassInit; } \
00260 private:
00261
00265 #define FBAssetFolderImplementation( ThisComponent ) \
00266 FBClassImplementation( ThisComponent )
00267
00269
00271
00273 class FBSDK_DLL FBAssetFolder : public FBAssetItem
00274 {
00275 __FBClassDeclare( FBAssetFolder, FBAssetItem );
00276 public:
00281 FBAssetFolder( char* pName, HIObject pObject = NULL );
00282
00283 IObject_Declare(Implementation);
00284
00288 virtual bool FBCreate();
00289
00293 virtual int GetChildCount() const = 0;
00294
00298 virtual HFBAssetItem GetChild( int pIndex ) = 0;
00299
00303 virtual HFBAssetFile GetFile( const FBString& pName ) = 0;
00304
00308 virtual HFBAssetFolder GetFolder( const FBString& pName ) = 0;
00309
00317 virtual HFBAssetFile AddFile( const FBString& pLocalPath, const FBString& pComment = "", bool pCheckOut = false, bool pSilent = false ) = 0;
00318
00325 virtual HFBAssetFolder AddFolder( const FBString& pName, const FBString& pComment = "", bool pSilent = false ) = 0;
00326 };
00327
00328
00330
00332
00339 #define FBRegisterAssetMng( UniqueNameStr, ClassName, Label, Desc, IconFilename ) \
00340 HIObject RegisterAssetMng##ClassName( HIObject ,char * pName,void * ) \
00341 { \
00342 ClassName *Class = new ClassName( Label ); \
00343 Class->Name = UniqueNameStr; \
00344 Class->Description = Desc; \
00345 if (Class->FBCreate()) { \
00346 return Class->GetHIObject(); \
00347 } else { \
00348 delete Class; \
00349 return NULL; \
00350 } \
00351 } \
00352 FBLibraryModule( ClassName ) \
00353 { \
00354 FBRegisterObject( ClassName,"Asset/AssetMng",Label,Desc,RegisterAssetMng##ClassName, false, IconFilename ); \
00355 }
00356
00361 #define FBAssetMngDeclare( ClassName, Parent ) \
00362 FBClassDeclare( ClassName,Parent); \
00363 public: \
00364 ClassName(char * pName):Parent(pName) { FBClassInit; } \
00365 private:
00366
00370 #define FBAssetMngImplementation( ThisComponent ) \
00371 FBClassImplementation( ThisComponent )
00372
00374
00376
00380 enum FBAssetMngMenuOptions {
00381 kMenuOpenFromDatabase = 1<<0,
00382 kMenuAddToDatabase = 1<<1,
00383 kMenuUploadToDatabase = 1<<2,
00384 kMenuGetLatest = 1<<3,
00385 kMenuCheckIn = 1<<4,
00386 kMenuCheckOut = 1<<5,
00387 kMenuUndoCheckOut = 1<<6,
00388 kMenuShowHistory = 1<<7,
00389 kMenuShowProperties = 1<<8,
00390 kMenuShowExplorer = 1<<9,
00391 kMenuShowReferenceMng = 1<<10,
00392 kMenuShowSettings = 1<<11,
00393 kMenuEnable = 1<<12,
00394
00396 kMenuFileAll = kMenuOpenFromDatabase | kMenuAddToDatabase | kMenuUploadToDatabase,
00397
00399 kMenuSourceControlAll = kMenuGetLatest | kMenuCheckIn | kMenuCheckOut | kMenuUndoCheckOut |
00400 kMenuShowHistory | kMenuShowProperties | kMenuShowExplorer |
00401 kMenuShowReferenceMng | kMenuShowSettings | kMenuEnable,
00402
00404 kMenuSourceControlMin = kMenuGetLatest | kMenuCheckIn | kMenuCheckOut | kMenuUndoCheckOut |
00405 kMenuShowSettings | kMenuEnable,
00406
00408 kMenuAll = 0xFFFFFFFF
00409 };
00410
00411
00414 enum FBAssetMngFileOptions {
00415 kFileCheckOutOnLoad = 1<<0,
00416 kFileCheckOutOnLoad_Ask = 1<<1,
00417 kFileUploadOnSave = 1<<2,
00418 kFileUploadOnSave_Ask = 1<<3,
00419 kFileAddOnNewSave = 1<<4,
00420 kFileAddOnNewSave_Ask = 1<<5,
00421 kFileCheckInOnClose = 1<<6,
00422 kFileCheckInOnClose_Ask = 1<<7,
00423 kFileOptionsAll = 0xFFFFFFFF
00424 };
00425
00426
00427 FB_DEFINE_COMPONENT( FBSDK_DLL, AssetMng );
00428
00431 class FBSDK_DLL FBAssetMng : public FBComponent {
00432 __FBClassDeclare( FBAssetMng, FBComponent );
00433 public:
00438 FBAssetMng( char* pName, HIObject pObject = NULL );
00439
00440 IObject_Declare(Implementation);
00441
00445 virtual bool Initialize() = 0;
00446
00450 virtual HFBAssetFile BrowseForFile() = 0;
00451
00455 virtual HFBAssetFolder BrowseForFolder() = 0;
00456
00461 virtual HFBAssetFolder CreateServerPath( const FBString& pServerPath ) = 0;
00462
00467 virtual bool FileIsManaged( const FBString& pFilename ) = 0;
00468
00473 virtual bool WithinManagedPath( const FBString& pLocalPath ) = 0;
00474
00479 virtual FBString MapLocalPathToServerPath( const FBString& pLocalPath ) = 0;
00480
00485 virtual HFBAssetFile GetAssetFile( const FBString& pServerFilename ) = 0;
00486
00491 virtual HFBAssetFile GetAssetFileFromLocalPath( const FBString& pLocalFilename ) = 0;
00492
00497 virtual HFBAssetFolder GetAssetFolder( const FBString& pServerPath ) = 0;
00498
00503 virtual HFBAssetFolder GetAssetFolderFromLocalPath( const FBString& pLocalPath ) = 0;
00504
00507 virtual void ShowSettings() = 0;
00508
00512 virtual int GetFileOptions() = 0;
00513
00516 virtual bool CheckAvailability() const = 0;
00517
00518 FBPropertyString Name;
00519 FBPropertyString Description;
00520 FBPropertyInt MenuFlags;
00521 FBString LastError;
00522 };
00523
00524 #ifdef FBSDKUseNamespace
00525 }
00526 #endif
00527 #endif