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