//***************************************************************************************** // Copyright (c) 2001 Sergey V. Natarov // All rights reserved. // If you want to use this source in your applications conact: // // $FileName : Bitmaps.Pkg // $ProjectName : CODEMAX EDITOR // $Author : Sergey V. Natarov // $Created : 03-19-2001 @ 14:30 // // Contents: // Special class for TreeView Bitmaps processing. Loads bitmaps from // external database into internal repository. Extracts bitmaps in // following order: 1. From internal repository, if not found // 2. From DataBase, and adds it into repository. // // Usage: // // Move (ClassBitmaps("dbList",MK_CLASS)) to sBitmap // // $Rev History // // //***************************************************************************************** Use For_All Define MK_OBJECT For 1 Define MK_PROCEDURE For 2 Define MK_FUNCTION For 3 Define MK_CLASS For 4 Define MK_PROPERTY For 5 Define MK_SETPROCEDURE For 7 Open VDFCLS Class cClassBitmaps Is an Set Procedure Construct_Object Forward Send Construct_Object Property Integer Auto_Load_Bitmaps Public False Object BitmapName Is a Set End_Object Object BitmapAssign Is an array End_Object End_Procedure // Should be redesigned for any dbFiles support... Procedure Load_Bitmaps Integer iFile Integer iField Integer bLoad Get Auto_Load_Bitmaps To bLoad If (bLoad) Begin For_All VDFCLS by Recnum Constrain VDFCLS.BITMAP Ne "" Do Send Register_Bitmap (Uppercase(Trim(VDFCLS.NAME))) (Uppercase(Trim(VDFCLS.BITMAP))) End_For_All End End_Procedure Procedure Register_Bitmap String sClass String sBitmap Integer iItm iBItm Get Msg_Add_Element (Uppercase(sClass)) To iItm Get Msg_Add_Element Of (BitmapName(Self)) (Uppercase(sBitmap)) To iBItm Set Value Of (BitmapAssign(Self)) Item iItm To iBItm End_Procedure Function Add_Search_Bitmap String sClass Returns String Integer iItm Get Find_Element (Uppercase(Trim(sClass))) To iItm If (iItm>-1) Begin Get Value Of (BitmapAssign(Self)) iItm To iItm Function_Return (Value(BitmapName(Self),iItm)) End Else Begin Clear VDFCLS Move sClass To VDFCLS.NAME Find Eq VDFCLS by Index.1 If (found) Begin Send Register_Bitmap (Trim(VDFCLS.NAME)) (Trim(VDFCLS.BITMAP)) Function_Return (Trim(VDFCLS.BITMAP)) End Else Function_Return "DEFAULT.BMP" End End_Function End_Class Object Bitmaps Is a cClassBitmaps // Uncomment to load all bitmaps on startup... // Set Auto_Load_Bitmaps to TRUE Send Load_Bitmaps 0 0 End_Object Function ClassBitmaps For Desktop String sClass Integer iType Returns String String sBmp Integer iItm // Returns bitmap name from internal bitmaps store... If ((iType Eq MK_CLASS) Or (iType Eq MK_OBJECT)) Begin Get Add_Search_Bitmap Of Bitmaps sClass To sBmp If sBmp Ne "" Function_Return sBmp Else Function_Return "NoBmp.bmp" End If iType Eq MK_FUNCTION Function_Return "Function16.bmp" If iType Eq MK_PROCEDURE Function_Return "Procedure16.bmp" If iType Eq MK_PROPERTY Function_Return "Property16.bmp" If iType Eq MK_SETPROCEDURE Function_Return "Procedure16.bmp" If iType Eq MK_COMMAND Function_Return "Command16.bmp" If iType Eq MK_STRUCT Function_Return "Struct16.bmp" Function_Return "DEFAULT.BMP" End_Function