1、 extern IID IID_CAAIAfrGeoCreationWkbFactory; class CAAIAfrGeoCreationWkbFactory : public CATIGenericFactory CATDeclareInterface; public : ;A factory interface is a CAA interface, that is, an abstract class that derives from CATIGenericFactory. As any interface, it has an IID declared as IID_ follow
2、ed by the interface name, and includes theCATDeclareInterface macro that declares that this abstract class is an interface. No additional 3method than those of CATIGenericFactory is necessary. Dont forget the public keyword required by the TIE compiler.(?)3.2.3 源文件(The source file )CAAIAfrGeoCreatio
3、nWkbFactory.cppCAAIAfrGeoCreationWkbFactory.h IID IID_CAAIAfrGeoCreationWkbFactory = 0xb32eed10, 0xd4c1, 0x11d3, 0xb7, 0xf5, 0x00, 0x08, 0xc7, 0x4f, 0xe8, 0xdd ; CATImplementInterface(CAAIAfrGeoCreationWkbFactory, CATIGenericFactory);The CATImplementInterface macro is used in conjunction with CATDec
4、lareInterface in the header file to make an interface from this abstract class and to declare that it OM-derives from CATIGenericfactory.3.2.4 TIE 文件(The TIE tsrc file)TIE_CAAIAfrGeoCreationWkbFactory.tsrc#include CAAIAfrGeoCreationWkbFactory.hThe Multi-Workspace Application Builder (mkmk) will gene
5、rate the TIE for this interface for you, that is, the TIE_CAAIAfrGeoCreationWkbFactory.h file in the ProtectedGenerated directory.3.3 建立 Workbench 的 Factory(Creating the Workbench Factory)3.3.1 注意事项The factory class that creates workbench instances must concatenate the name of the class to instantia
6、te, that is, the workbench description class CAAAfrGeoCreationWkb, with the string Factory. This gives CAAAfrGeoCreationWkbFactory.3.3.2 头文件CAAAfrGeoCreationWkbFactory.hCATWorkshopConfigurationFactory.h CATDeclareConfigurationFactory(CAAAfrGeoCreationWkb);The CATDeclareConfigurationFactory macro arg
7、ument is the name of the workbench description class.43.3.3 源文件CAAAfrGeoCreationWkbFactory.cppCAAAfrGeoCreationWkb.h #include TIE_CAAIAfrGeoCreationWkbFactory.h CATImplementConfigurationFactory(CAAAfrGeoCreationWkb, CAAIAfrGeoCreationWkbFactory);The CATImplementConfigurationFactory arguments are the
8、 name of the workbench description class and the name of the workbench factory interface respectively. TheCATDeclareConfigurationFactory and CATImplementConfigurationFactory macros create theworkbench factory implementation class as a data extension of the CATApplicationFrame component3.3.4 更新字典3.3.
9、4.1 The interface dictionary that is a file whose name is the framework name suffixed by dico, such as CAAApplicationFrame.dico, and that you should create or update in the framework CNext/code/dictionary directory. The interface dictionary contains the following declaration to state that the CATApp
10、licationFrame component implements the CAAIAfrGeoCreationWkbFactory interface, by means of the extension class created by the macros, whose code is located in the libCAAAfrGeoCreationWbench shared library or DLL:(不太明白)CATApplicationFrame CAAIAfrGeoCreationWkbFactory libCAAAfrGeoCreationWbench3.3.4.2
11、 The factory dictionary that is a file whose name is the framework name suffixed by fact, such as CAAApplicationFrame.fact, and that you should create or update in the framework CNext/code/dictionary directory. The factory dictionary contains the following declaration to state that the CAAIAfrGeoCre
12、ationWkbFactory interface is an interface to a factory whose implementation creates a CAAAfrGeoCreationWkb class instance:CAAAfrGeoCreationWkb CAAIAfrGeoCreationWkbFactory3.4 定义与实现 Workbench 类(Creating the Workbench Description Class)3.4.1 说明The CAAAfrGeoCreationWkb class implements the CATICAAAfrGe
13、ometryWksConfiguration interface exposed by the CAAGeometry workshop . It includes the following methods: ?CreateCommands to instantiate the command headers for the commands of the workbench CreateWorkbench to create the containers for the workbench, the menus, and the toolbars, andarrange the comma
14、nds in the menus and toolbarsGetCustomInterfaces which returns the names of the interfaces exposed by the workbench toenable its customization5?GetAddinInterface which returns the name of the interface exposed by the workbench to createadd-ins.3.4.2 头文件CAAAfrGeoCreationWkb.hCATBaseUnknown.h #include
15、 CATListPV.h class CATCmdWorkbench; class CAAAfrGeoCreationWkb : public CATBaseUnknown CATDeclareClass; public: CAAAfrGeoCreationWkb(); virtual CAAAfrGeoCreationWkb(); void CATClassId void private: CAAAfrGeoCreationWkb(const CAAAfrGeoCreationWkb &iObjectToCopy); CreateCommands(); GetAddinInterface()
16、; GetCustomInterfaces(CATListPV * oDefaultIIDList , CATListPV * oCustomIIDList) ;CATCmdWorkbench * CreateWorkbench();The CAAAfrGeoCreationWkb class C+-derives from CATBaseUnknown. The CATDeclareClass macro declares that the class CAAAfrGeoCreationWkb belongs to a component. The class has a construct
17、or, a destructor, the four methods of the CATIWorkbench interface, and a copy constructor. Note that the copy constructor is set as private. This prevents the compiler from creating the copy constructor as public without you know. This copy constructor is not implemented in the source file.3.4.3 源文件
18、CAAAfrGeoCreationWkb.cppCATCommandHeader.h / See Creating the Command Headers MacDeclareHeader(CAAAfrGeoCreationWkbHeader);CATCreateWorkshop.h CATImplementClass(CAAAfrGeoCreationWkb, Implementation, CATBaseUnknown, CATNull);TIE_CATICAAAfrGeometryWksConfiguration.h 6TIE_CATICAAAfrGeometryWksConfigura
19、tion(CAAAfrGeoCreationWkb); CAAAfrGeoCreationWkb:CAAAfrGeoCreationWkb() CAAAfrGeoCreationWkb:CAAAfrGeoCreationWkb() void CAAAfrGeoCreationWkb:CreateCommands() . / See Creating the Command Headers CATCmdWorkbench * CAAAfrGeoCreationWkb:CreateWorkbench() . / See Creating the Workbench and Arranging th
20、e Commands CATClassId CAAAfrGeoCreationWkb:GetAddinInterface() return CAAIAfrGeoCreationWkbAddin; void CAAAfrGeoCreationWkb:GetCustomInterfaces(CATListPV * oDefaultIIDList, CATListPV * oCustomIIDList) 3.4.3.1 TIE_CATICAAAfrGeometryWksConfiguration 宏 The CAAAfrGeoCreationWkb class states that it impl
21、ements the CATICAAAfrGeometryWksConfiguration interface 3.4.3.2 TIE_ CATImplementClass 宏 declaring that the CAAAfrGeoCreationWkb class is a component main class 2, thanks to theImplementation keyword, and that it OM-derives from CATBaseUnknown 2. The fourth parameter mustalways be set to CATNull for
22、 component main classes. 3.4.3.3 创建命令标签(Creating the Command Headers) (见命令标签) 3.4.3.3.1 命令标签 Each command available in your workbench must have a command header. A command header is an instance of a command header class, and different commands can share the same command header class to create their
23、command header. 3.4.3.3.2 创建命令标签类 CAAAfrGeoCreationWkbHeader command header class is careated in CAAAfrGeoCreationWkb.cpp: MacDeclareHeader(CAAAfrGeoCreationWkbHeader);7The MacDeclareHeader macro creates the header file and the source file for the CAAAfrGeoCreationWkbHeader class, and associates wit
24、h this class the resource files CAAAfrGeoCreationWkbHeader.CATNls and CAAAfrGeoCreationWkbHeader.CATRsc. 3.4.3.3.3 定义命令标签 Create the code to instantiate your command headers in the empty CreateCommands method. This method should contain one instantiation statement of the command header class per com
25、mand. Each statement has the following form, for example for the Cuboid command.void CAAAfrGeoCreationWkb:CreateCommands() . new CAAAfrGeoCreationWkbHeader(CAAAfrCuboidHdr, CAADegGeoCommandsCAADegCreateCuboidCmd, (void *) NULL); . 其中:1)CAAAfruboidHdr is the identifier you need to assign to the comma
26、nd header. It will be usedafterwards: (1)To associate the command starters you will define to put the command in a menu and in toolbars with the command header. (2)To build the variables that define the command header resources, such as the name seen by the end user in his/her own language in the me
27、nu, or the icon to display in a toolbar.2)CAADegGeoCommands is the name of the shared library or DLL containing the Cuboid commandscode, without the prefix lib, and without the suffix depending on the operating system.3)CAADegCreateCuboidCmd is the name of the Cuboid command class4)the last argument
28、 is the possible pointer to the object to pass to the command when executing it. It is often a character string that indicates the action to carry out when the same command can perform several actions depending on the active document and data, such as update or update all, or cutcopy. 3.4.3.4 Creati
29、ng the Workbench and Arranging the Commands 3.4.3.4.1 创建 workbench using the NewAccess macro:CATCmdWorkbench * CAAAfrGeoCreationWkb:CreateWorkbench() NewAccess(CATCmdWorkbench,pCAAAfrGeoCreationWkb,CAAAfrGeoCreationWkb); . / See Creating the Containers for the Toolbars and the Menu Bar return pCAAAfrGeoCreationWkb; pCAAAfrGeoCreationWkb is the variable used to handle the wo
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2