home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / mmcomplb.hpp < prev    next >
C/C++ Source or Header  |  1997-01-07  |  16KB  |  353 lines

  1. #ifndef _MMCOMPLB_HPP
  2. #define _MMCOMPLB_HPP
  3.  
  4. // TODO: FIXME: DJB put this in, ITB will take out
  5. #pragma warning 849 9
  6.  
  7. #include "mmcommon.hpp"
  8.  
  9. class  MetaObject;
  10. class  MMReferenceNode;
  11. class  WStringList;
  12. class  DTFormEditBase;
  13. class  MTPropertySheetBase;
  14. class  DTWForm;
  15. struct MMLibraryData;
  16. struct MMPropertySheetThunk;
  17. struct MMFunctionData;
  18. class  DTRegistryKey;
  19. class  DTCodeBlockBase;
  20.  
  21. class  DTObject;
  22. class  DTWObject;
  23.  
  24. // MMLexusInterfaceBase:
  25. //      this class represents Lexus to CompDll
  26.  
  27. typedef WBool WCMDEF (*EnumDTFormCB)( DTObject *form, void *userdata );
  28.  
  29. class IFormEditor;
  30. class IControl;
  31. struct MMFormInfo {
  32.     WString         name;
  33.     IFormEditor     *iFormEditor;
  34.     const IControl  *iControl;
  35. };
  36. struct MMControlInfo {
  37.     WString     instanceName;
  38.     WString     className;
  39.     IControl    *iControl;
  40. };
  41.  
  42. class METADEF MMLexusInterfaceBase {
  43.     public:
  44.         enum Sheet {
  45.             TabControlEdit,
  46.             GridProperties,
  47.             PictureProperty,
  48.         };
  49.  
  50.         enum ClassType {
  51.             CT_OleServerObject,
  52.             CT_OleInterface,
  53.         };
  54.  
  55.         enum ViewWindow {
  56.             VW_Classes,
  57.             VW_Files,
  58.             VW_Objects,
  59.             VW_Resources,
  60.             VW_ObjectInspector,
  61.             VW_Targets,
  62.         };
  63.  
  64.         enum LoadOption {
  65.             LO_Load,    //  Load the form if required
  66.             LO_Check,   //  Don't load the form -- just check
  67.         };
  68.  
  69.     public:
  70.         virtual void                    OpenViewWindow( ViewWindow window ) = 0;
  71.         
  72.         virtual MTPropertySheetBase *   MakePropertySheet(
  73.                                             Sheet,
  74.                                             const MMPropertySheet * ) = 0;
  75.  
  76.         virtual DTFormEditBase *        FindForm(
  77.                                             const WString &,
  78.                                             WWindow *parent = NULL,
  79.                                             WTabControl *tc = NULL ) = 0;
  80.  
  81.         virtual DTFormEditBase *        CreateTabForm(
  82.                                             WString &formName,
  83.                                             WWindow *parent,
  84.                                             WTabControl *tabcontrol ) = 0;
  85.  
  86.         virtual DTFormEditBase *        CreatePropertySheetItem(
  87.                                             WString & formName,
  88.                                             WWindow * parent,
  89.                                             WTabControl * tabControl ) = 0;
  90.  
  91.         virtual WBool                   GetImage(
  92.                                             DTObject * obj,
  93.                                             const WString & name,
  94.                                             WBitmap & bmp,
  95.                                             WIcon & ico,
  96.                                             WCursor & cur ) = 0;
  97.  
  98.         virtual void                    GetImages( DTObject * obj,
  99.                                             const WString & type,
  100.                                             WStringList & icons ) = 0;
  101.  
  102.         virtual void                    EnumDTForms(
  103.                                             EnumDTFormCB rtn,
  104.                                             void * user ) = 0;
  105.  
  106.         virtual void                    GetFormList( WArray<MMFormInfo> &list ) = 0;
  107.         virtual void                    GetControlList( IFormEditor *form,
  108.                                             WArray<MMControlInfo> &list ) = 0;
  109.         virtual DTObject *              GetControlDTObject( IControl *control,
  110.                                                             LoadOption option = LO_Load ) = 0;
  111.  
  112.         virtual WFilePath               GetFormFilePath(
  113.                                             DTWForm * form ) = 0;
  114.  
  115.         virtual void                    ObjectSelected(
  116.                                             DTObject * obj ) = 0;
  117.  
  118.         virtual DTRegistryKey *         GetRegistryKey() = 0;
  119.  
  120.         virtual WBool                   ValidateIdentifier( const WString & str,
  121.                                                             WString & message ) = 0;
  122.  
  123.         virtual WBool                   NotifyView( long event ) = 0;
  124.  
  125.         virtual WStringArray            GetClassList( ClassType, DTObject * ) = 0;
  126.  
  127.         /*  Start the tab editor.  Invokes FormEdit::StartTabDlg on
  128.             the current formedit.
  129.         */
  130.         virtual void            StartTabDlg() = 0;
  131.  
  132.         /*  Start the menu editor.  Invokes FormPaint::StartMenuDlg on
  133.             the current formedit's form painter.  The menuClass string
  134.             is the name of the menu component's class that should be
  135.             instantiated if there isn't a menu already on the form.
  136.         */
  137.         virtual void            StartMenuDlg( const WString & menuClass ) = 0;
  138.  
  139.         /*  If you have a hot key control, and you don't want Optima++ to
  140.             pay attention to the keys you press, turn stifling off. Just
  141.             turn it back on when you're done.
  142.         */
  143.         virtual void StifleGlobalAccelerators( WBool onOff ) = 0;
  144. };
  145.  
  146. struct WDMLibraryData {
  147.     WUInt               numFunctions[ MMFT_NumFunctionTypes ];
  148.     MMFunctionData *    functions[ MMFT_NumFunctionTypes ];
  149. };
  150.  
  151.  
  152. class METAEXPORTCLASSDEF MMComponentLib : public MMCommon {
  153.     public:
  154.         MMComponentLib( WDMLibraryData * data );
  155.         virtual                     ~MMComponentLib();
  156.  
  157.         virtual WBool               Initialize();
  158.         virtual WBool               Finalize();
  159.         virtual int                 NumMetaObjects();
  160.         virtual MetaObject *        GetMetaObject( unsigned i );
  161.  
  162.         virtual WForm *             MakeObjectInspector(
  163.                                         WWindow * parent,
  164.                                         const WRect & r,
  165.                                         const WChar * title,
  166.                                         WStyle stl, WStyle ex_style ) const;
  167.         virtual WForm *             GetObjectInspector() const;
  168.         virtual void                CloseObjectInspector();
  169.  
  170.         virtual void                MoveToEventPage() const;
  171.         virtual void                MoveToPropertyPage() const;
  172.         virtual void                ObjectInspectorSelect(
  173.                                         WUInt numObjects,
  174.                                         DTObject ** ) const;
  175.         virtual void                ObjectInspectorKey( WCharacterPressEventData * data );
  176.         virtual void                RefreshProperties() const;
  177.  
  178.         virtual WULong                  GetCompDLLVersion() const;
  179.         virtual WULong                  GetLibraryVersion() const;
  180.         virtual WConstantString         GetRefTag() const;
  181.         virtual WConstantString         GetDescription() const;
  182.         virtual WBool                   GetIsOle() const;
  183.  
  184.         virtual MMLanguage              GetLanguage() const;
  185.  
  186.         virtual WUInt                   GetNumIncludes() const;
  187.         virtual WConstantString         GetInclude( WUInt idx ) const;
  188.  
  189.         virtual const MMReferenceNode * GetReferenceRoot();
  190.  
  191.         virtual WBool               operator==( const MMComponentLib & o ) const;
  192.  
  193.         virtual const WModule &     GetModule() const;
  194.         virtual WBool               SetModule( const WModule & );
  195.  
  196.         virtual void                    GenHeaderNames( WStringList & ) const;
  197.  
  198.         virtual void                    SetLexusInterface( MMLexusInterfaceBase * );
  199.         virtual MMLexusInterfaceBase *  GetLexusInterface() const;
  200.         virtual MTPropertySheetBase *   MakePropertySheet( MMLexusInterfaceBase::Sheet,
  201.                                                            const MMPropertySheet * ) const;
  202.         virtual DTFormEditBase *        FindForm( const WString &,
  203.                                                   WWindow *parent = NULL,
  204.                                                   WTabControl *tc = NULL ) const;
  205.         virtual DTFormEditBase *        CreateTabForm( WString &formName,
  206.                                                    WWindow *parent,
  207.                                                    WTabControl *tabcontrol ) const;
  208.         virtual DTFormEditBase *        CreatePropertySheetItem(
  209.                                                 WString &formName,
  210.                                                 WWindow *parent,
  211.                                                 WTabControl *tabcontrol ) const;
  212.         virtual WBool                   GetImage(
  213.                                             DTObject * obj,
  214.                                             const WString & name,
  215.                                             WBitmap & bmp,
  216.                                             WIcon & ico,
  217.                                             WCursor & cur ) const;
  218.  
  219.         virtual WUInt                   GetNumEnumerators() const;
  220.         virtual const MMEnumerator *    GetEnumerator( MMIndex idx ) const;
  221.         virtual WUInt                   GetNumTypes() const;
  222.         virtual const MMType *          GetType( MMIndex idx ) const;
  223.         virtual WUInt                   GetNumEvents() const;
  224.         virtual const MMEvent *         GetEvent( MMIndex idx ) const;
  225.         virtual WUInt                   GetNumEventOverrides() const;
  226.         virtual const MMEventOverride * GetEventOverride( MMIndex idx ) const;
  227.         virtual WUInt                   GetNumParameters() const;
  228.         virtual const MMParameter *     GetParameter( MMIndex idx ) const;
  229.         virtual WUInt                   GetNumParameterSets() const;
  230.         virtual const MMParameterSet *  GetParameterSet( MMIndex idx ) const;
  231.         virtual WUInt                   GetNumStyles() const;
  232.         virtual const MMStyle *         GetStyle( MMIndex idx ) const;
  233.         virtual WUInt                   GetNumProperties() const;
  234.         virtual const MMProperty *      GetProperty( MMIndex idx ) const;
  235.         virtual WUInt                   GetNumMethods() const;
  236.         virtual const MMMethod *        GetMethod( MMIndex idx ) const;
  237.         virtual WUInt                   GetNumPropertyGroups() const;
  238.         virtual const MMPropertyGroup * GetPropertyGroup( MMIndex idx ) const;
  239.         virtual WUInt                   GetNumPropertyControls() const;
  240.         virtual const MMPropertyControl *GetPropertyControl( MMIndex idx ) const;
  241.         virtual WUInt                   GetNumPropertySheets() const;
  242.         virtual const MMPropertySheet * GetPropertySheet( MMIndex idx ) const;
  243.         virtual WUInt                   GetNumComponents() const;
  244.         virtual const MMComponent *     GetComponent( MMIndex idx ) const;
  245.         virtual WUInt                   GetNumReferenceNodes() const;
  246.         virtual const MMReferenceNode * GetReferenceNode( MMIndex idx ) const;
  247.         virtual const MMString *        GetStringTable( MMIndex ) const;
  248.         virtual MMIndex                 GetIndex( MMIndex ) const;
  249.         virtual WBool                   GetString( MMString, WConstantString & str ) const;
  250.  
  251.         virtual WUInt                   GetNumFunctions( MMFunctionType ) const;
  252.         virtual void *                  GetFunction( MMFunctionType, WUInt ) const;
  253.         virtual WString                 GetFunctionName( MMFunctionType, WUInt ) const;
  254.         virtual void *                  FindFunction( MMFunctionType, const WString & ) const;
  255.  
  256.         virtual MMSetPropFn             GetSetPropFn( MMSetFnIndex idx ) const;
  257.         virtual MMGetPropFn             GetGetPropFn( MMGetFnIndex idx ) const;
  258.         virtual MMMakePropSheet         GetMakePropSheetFn( MMPropSheetFnIndex idx ) const;
  259.         virtual MMMakePropControl       GetMakePropControlFn( MMPropCtrlFnIndex idx ) const;
  260.         virtual MMMakeDTObject          GetMakeDTObjectFn( MMDTInstFnIndex idx ) const;
  261.         virtual MMMakeDTType            GetMakeDTTypeFn( MMDTTypeFnIndex idx ) const;
  262.         virtual MMPropDefault           GetPropDefFn( MMPropDefFnIndex idx ) const;
  263.         virtual MMPropMakeEditor        GetPropMakeEditorFn( MMPropMakeEditorFnIndex idx ) const;
  264.         virtual WRange                  GetDataRange();
  265.  
  266.         virtual WUInt                   GetRefCount() const;
  267.         virtual void                    IncrementRefCount();
  268.         virtual void                    DecrementRefCount();
  269.  
  270.         virtual MMComponentLib *        GetFirstLibrary() const;
  271.         virtual MMComponentLib *        GetDTWClassLibrary() const;
  272.         virtual MMComponentLib *        GetNextLibrary() const;
  273.         virtual MMComponentLib *        FindLibrary( const WString & name ) const;
  274.  
  275.         static  const MetaObject *              FindComponent( const WString & );
  276.         static  MMComponentLib *                FindLibrary( const MMCommon * );
  277.         inline  static MMComponentLib *         FindLibrary( WInt );
  278.  
  279.     protected:
  280.         static MMComponentLib *     _DTWClassFirst;
  281.         static MMComponentLib *     _First;
  282.         WDMLibraryData *            _dmData;
  283.         WModule                     _theModule;
  284.         static MMLexusInterfaceBase *_lexus;
  285.         WRange                      _libDataRange;
  286.         MMComponentLib *            _next;
  287.         WInt                        _referenceCount;
  288.  
  289.         MMEnumerator *              _enumerators;
  290.         MMType *                    _types;
  291.         MMEvent *                   _events;
  292.         MMEventOverride *           _eventOverrides;
  293.         MMStyle *                   _styles;
  294.         MMProperty *                _properties;
  295.         MMMethod *                  _methods;
  296.         MMParameter *               _parameters;
  297.         MMParameterSet *            _parameterSets;
  298.         MMPropertyGroup *           _propertyGroups;
  299.         MMPropertyControl *         _propertyControls;
  300.         MMPropertySheet *           _propertySheets;
  301.         MetaObject *                _components;
  302.         MMReferenceNode *           _referenceNodes;
  303.  
  304.         const MMPropertySheetThunk *_propSheetThunk;
  305.         const MMPropertySheet **    _propSheetReloc;
  306.         const MMString *            _stringTables;
  307.         const MMIndex *             _indices;
  308.         const WChar *               _strings;
  309.         WUInt                       _stringLen;
  310.         const WByte *               _bufferData;
  311.         WUInt                       _bufferLen;
  312.         const MMLibraryData *       _libData;
  313. };
  314.  
  315. #ifdef __BUILDING_DTWCM_DLL__
  316. inline static MMComponentLib * MMComponentLib::FindLibrary( WInt obj )
  317. /********************************************************************/
  318. {
  319.     MMComponentLib *    lib;
  320.  
  321.     if( obj == -1 ) {
  322.         return( _DTWClassFirst );
  323.     }
  324.  
  325.     for( lib = _First; lib != NULL; lib = lib->_next ) {
  326.         if( obj >= lib->_libDataRange.start && obj <= lib->_libDataRange.end ) {
  327.             return lib;
  328.         }
  329.     }
  330.  
  331.     return NULL;
  332. }
  333.  
  334. // sorry, has to go here for header file ordering issues
  335. inline MMComponentLib * MMCommon::GetLib() const
  336. /**********************************************/
  337. {
  338.     return MMComponentLib::FindLibrary( (WUInt)_data );
  339. }
  340. #endif
  341.  
  342. extern "C" {
  343.     typedef MMComponentLib * __export __stdcall (*MMGetComponentLibFn)();
  344.     #define MMGETCOMPONENTLIB "_MMGetComponentLib@0"
  345. };
  346.  
  347. #define MMRC_WD_CONFIG          "WDCFG"
  348.  
  349. // TODO: FIXME: DJB put this in, ITB will take out
  350. #pragma warning 849 1
  351.  
  352. #endif // _MMCOMPLB_HPP
  353.