home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1998 September / dppcpro0998.iso / Rwc / Sybase / Install.exe / hpp.z / dtjobjct.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-23  |  14.3 KB  |  424 lines

  1. #ifndef _DTJOBJCT_HPP
  2. #define _DTJOBJCT_HPP
  3.  
  4. #include "dtobject.hpp"
  5. #include "dtformbs.hpp"
  6.         
  7. #define JAVA_FILE_EXTENSION             WTEXT(".java")
  8. #define JAVA_CLASS_EXTENSION            WTEXT(".class")
  9.  
  10. struct MMJCodeGenerationParms;
  11.  
  12. enum __ControlScope {
  13.     ePublic        = 0,
  14.     eDefault        = 1,
  15.     eProtected         = 2,
  16.     ePrivateProtected     = 3,
  17.     ePrivate         = 4,
  18. };
  19.  
  20. enum __FlowLayoutAlignment {
  21.     eLEFT                       = 0,
  22.     eCENTER                     = 1,
  23.     eRIGHT            = 2,
  24. };
  25.  
  26. enum __LayoutManager {
  27.     eNoLayoutManager        = 0,
  28.     eBorderLayout        = 1,
  29.     eCardLayout            = 2,
  30.     eFlowLayout            = 3,
  31.     eGridLayout            = 4,
  32.     eGridBagLayout        = 5,
  33.     eResizePercentLayout    = 6,
  34.     eDefaultLayout        = 7,
  35. };
  36.  
  37. enum __BorderLayoutDirection {
  38.     eCenter            = 0,
  39.     eNorth            = 1,
  40.     eSouth            = 2,
  41.     eWest            = 3,
  42.     eEast            = 4,
  43. };
  44.  
  45. enum __GridBagConstraintsAnchor {
  46.     eGBCCenter    = 10,
  47.     eGBCNorth     = 11,
  48.     eGBCNorthEast = 12,
  49.     eGBCEast      = 13,
  50.     eGBCSouthEast = 14,
  51.     eGBCSouth     = 15,
  52.     eGBCSouthWest = 16,
  53.     eGBCWest      = 17,
  54.     eGBCNorthWest = 18,
  55. };
  56.  
  57. enum __GridBagConstraintsFill {
  58.     eGBCNone      = 0,
  59.     eGBCBoth      = 1,
  60.     eGBCHorizontal= 2,
  61.     eGBCVertical  = 3,
  62. };
  63.  
  64. enum MMJFileFragment {
  65.     JAVA_CG_GENFORM,            // generate all code for a form
  66.     JAVA_CG_GENHTML,            // generate the html for an applet
  67.     JAVA_CG_GENACTIVEX_HOOKS,   // for applets only: generate the hooks
  68.                     // that communicate between the actual
  69.                 // applet and the applet form
  70.     JAVA_CG_GENSERIALIZED,      // generate all serialized info for a form
  71. };
  72.  
  73. enum MMJCodeGeneration {
  74.     JAVA_CG_IMPORTS,            // package imports
  75.     
  76.     JAVA_CG_CONSTRUCTOR,        // the class constructor
  77.     JAVA_CG_FINALIZER,          // finalizer (ie destructor) code
  78.     JAVA_CG_HANDLE_EVENT,       // event handler
  79.     JAVA_CG_LISTENERS,        // implementation for all listener interfaces
  80.     JAVA_CG_DECLARATION,        // member declarations/initializations
  81.  
  82.     JAVA_CG_STYLES,             // code for additional styles
  83.     JAVA_CG_CREATE,             // create code
  84.     JAVA_CG_CREATE_ACTIVEX,    // create ActiveX casting code
  85.     JAVA_CG_CREATE_EVENT,       // call the create event
  86.     JAVA_CG_DESTROY_EVENT,      // call the destroy event
  87.     JAVA_CG_DESTROY,            // destroy code
  88.     JAVA_CG_AUTO,               // any code like auto connection code that
  89.                                 // will be generated in the create just before
  90.                 // the form is made visible
  91.     
  92.     JAVA_CG_DB_TRANSCREATE,     // create the transactions
  93.     JAVA_CG_DB_QUERYCREATE,     // create the queries
  94.     JAVA_CG_DB_TRANSCONNECT,    // connect the transaction
  95.     JAVA_CG_DB_QUERYATTACH,     // attach query to transaction
  96.     JAVA_CG_DB_SETSQL,          // set the SQL for the query
  97.     JAVA_CG_DB_AUTOOPENQUERY,   // open the query
  98.     JAVA_CG_QUERY_DESTROY,    // destroy the query
  99.     JAVA_CG_TRANS_DISCONNECT,    // disconnect the transaction
  100.  
  101.     JAVA_CG_CHILDMETHODS,    // child-inspired methods, sent to form
  102.     JAVA_CG_PARENTMETHODS,    // child-inspired methods, sent from form
  103.                     // its children
  104.  
  105.     JAVA_CG_APPCHILDMETHODS,    // child-inspired applet methods, sent to form
  106.     JAVA_CG_APPPARENTMETHODS,    // child-inspired applet methods, sent from
  107.                     // form to its children
  108.  
  109.     JAVA_CG_APPCHILDHTML,    // child-inspired applet HTML code, sent to
  110.                     // form
  111.     JAVA_CG_APPPARENTHTML,    // child-inspired applet HTML code, sent from/
  112.                     // form to its children
  113.  
  114.     JAVA_CG_EVENTS,             // generate the events for a component
  115.     JAVA_CG_ADDLISTENER,        // generate the add listener calls for the component
  116.     JAVA_CG_PREADD,             // code generated prior to the add
  117.  
  118.     JAVA_CG_FDX_METHODS,    // implementation for FDX interface
  119.     JAVA_CG_FDX_DECLARATION,    // declarations for FDX class members
  120.     JAVA_CG_FDX_READ,        // component FDX class read
  121.     JAVA_CG_FDX_WRITE,        // component FDX class write
  122.  
  123.     JAVA_CG_APPCHILDSERIALIZED,    // child-inspired serialized info, sent to
  124.                     // the form
  125.     JAVA_CG_APPPARENTSERIALIZED,// child-inspired serialized info, sent from
  126.                     // form to its children
  127.     JAVA_CG_PRE_ADDNOTIFY,
  128.  
  129.     JAVA_CG_MENUBAR,        // generate the menus
  130. };
  131.  
  132. class WJavaObject;
  133.  
  134. class METAEXPORTCLASSDEF DTJObjectBase : public DTObjectBase
  135. /**********************************************************/
  136. {
  137.     public:
  138.         virtual       ~DTJObjectBase();
  139.  
  140.     virtual    WJavaObject*    GetWJavaObject() const;
  141.  
  142.     // Returns the WJavaObject used by the form painter at
  143.     // design time, if such an object exists.
  144.     // Returns NULL otherwise.
  145.     virtual WJavaObject *    GetJImplementation() const;
  146.  
  147.         virtual WBool GetIsHollow();                // groupbox
  148.  
  149.     virtual WBool GetImplements( const WString & ) const;
  150.  
  151.     virtual void GenFileFragment( MMFileFragment fg, WStringList &,
  152.                       MMFileGenerationParms * parms ) const;
  153.  
  154.     // not used any more
  155.         void GenCode( MMCodeGeneration mmCodeGen,
  156.               WStringList& srcList ) const;
  157.  
  158.     WBool DoJavaPainting() const;
  159.  
  160.     void SetNonImplementationJavaObj( WJavaObject * javaObj );
  161.  
  162.     virtual WBool CanCreateNonImplementationJavaObj() const;
  163.  
  164.     static PropertyInspectObject * MakePropEditor_dataSource(
  165.             const MMProperty * prop, PropertyInspector * prt,
  166.             WUInt numObject, DTObject ** objects );
  167.  
  168.     static PropertyInspectObject * MakePropEditor_dataColumns(
  169.             const MMProperty * prop, PropertyInspector * prt,
  170.             WUInt numObject, DTObject ** objects );
  171.  
  172.     public:
  173.  
  174.         // override this to demangle the Meta object name
  175.     virtual void GenClassName( WString & ) const;
  176.     //
  177.     // Style
  178.     //
  179.     //    The Windows style property of the associated Window.
  180.     //    This doesn't necessarily match GetWindow()->GetStyle()
  181.     //    because some styles are deferred until run-time (such
  182.     //    as WSVisible).
  183.  
  184.     virtual WStyle        GetStyle() const;
  185.     virtual WBool        SetStyle( WStyle stl, WBool clone=FALSE );
  186.  
  187.     //
  188.     // DefaultStyle
  189.     //
  190.     //    The style with which new instances are created.  Default
  191.     //    implementation returns GetWindow()->GetDefaultStyle().
  192.  
  193.     virtual WStyle        GetDefaultStyle() const;
  194.  
  195.     //
  196.     // ExtendedStyle
  197.     //
  198.     //    The ExtendedStyle property of the window nature.
  199.  
  200.     virtual WStyle        GetExtendedStyle() const;
  201.     virtual WBool        SetExtendedStyle( WStyle style, WBool clone=FALSE );
  202.  
  203.     //
  204.     // DefaultExtendedStyle
  205.     //
  206.     //    See DefaultStyle
  207.  
  208.     virtual WStyle        GetDefaultExtendedStyle() const;
  209.  
  210.  
  211.     //
  212.     // Visible
  213.     //
  214.     //    The object is currently visible.
  215.  
  216.     virtual WBool        GetVisible();
  217.     virtual WBool        SetVisible( WBool visible );
  218.  
  219.     //
  220.     // Create
  221.     //
  222.     //    Call Create on the windowed object.
  223.     //
  224.     virtual WBool        Create( WWindow * parent, const WRect & r,
  225.                         const WChar * text, WStyle style,
  226.                     WStyle exStyle, void * data = NULL,
  227.                     WBool isLoading = FALSE );
  228.         //
  229.         // Rectangle
  230.         //
  231.         //    The pixel-based position of the object; optionally, absolute
  232.         //    to the desktop.  
  233.  
  234.         virtual void            DTGetRectangle( WRect & r, 
  235.                                                 WBool abs = FALSE ) const;
  236.         virtual void            DTSetRectangle( const WRect & r,
  237.                                                 WBool abs = FALSE );
  238.         virtual WRect           DTGetDURectangle( WBool abs = FALSE ) const;
  239.  
  240.         //
  241.         // ClientRectangle
  242.         //
  243.         //    Get the client rectangle.  This is mainly used for DTForms.
  244.  
  245.         virtual void            DTGetClientRectangle( WRect & r ) const;
  246.  
  247.         //
  248.         // RCRectangle
  249.         //
  250.         //    The rectangle to use in the .rc file (still in pixel though).
  251.         //    This differs for WComboBox, which gives a .rc file rectangle
  252.         //    of the correct height instead of the design time height.
  253.  
  254.         virtual void            DTGetRCRectangle( WRect & r ) const;
  255.  
  256.         //
  257.         // PixelsToDLU / DLUToPixels
  258.         //
  259.         //    Map between pixels and dialog units (DLU).
  260.  
  261.         virtual WRect           DTMapPixelsToDLU( const WRect & pix ) const;
  262.         virtual WRect           DTMapDLUToPixels( const WRect & dlu ) const;
  263.  
  264.         //
  265.         // BringToTop
  266.         //
  267.         //    Bring the object to the top of the Z- order
  268.  
  269.         virtual void            DTBringToTop();
  270.  
  271.         //
  272.         // Repaint
  273.         //
  274.         //    Invalidate an object and cause it to be repainted
  275.  
  276.         virtual void            DTRepaint( WRect * rect=NULL );
  277.  
  278.  
  279.         //
  280.         // ObjectPrefix
  281.         //
  282.         //    Get the prefix used when accessing member functions of the
  283.         //    object -- eg. "cb_1->"
  284.  
  285.         virtual WString GetObjectPrefix() const;
  286.  
  287.     //
  288.     // IsValidContainer
  289.     //
  290.     //    Returns true if obj is allowed as a container for this
  291.     //    DTObject.  errMsg is filled in with details about
  292.     //    about why it isn't allowed.
  293.     virtual WBool        IsValidContainer(
  294.                     const DTObject *obj,
  295.                     WString &errMsg ) const;
  296.  
  297.     virtual void AmendPopup( WPopupMenu * popup, WBool before );
  298.  
  299.     WBool HandleCustomizeMenuClick( WObject *, WEventData * );
  300.  
  301.     virtual void GenerateCode( MMCodeGeneration mmCodeGen,
  302.                    ostream& src,
  303.                    MMCodeGenerationParms& pGenParms );
  304.  
  305.     virtual void EmitProperties( const WString& objPrefix,
  306.                      ostream& src ) const;
  307.  
  308.     virtual void EmitProperty( const WString& objPrefix, ostream& src,
  309.                    const MMProperty * prop ) const;
  310.  
  311.     virtual WString     DTGetName() const;
  312.  
  313.     virtual void GenName( WUInt id, WString & ) const;
  314.  
  315.     virtual void PropertyChanged( const WString & name );
  316.  
  317.     virtual void AddEventsToList( DTUserFunctionVect* pEventList,
  318.                       WBool recurseChildren );
  319.  
  320.     virtual void GenEventObjectName( WString & ) const;
  321.  
  322.     WBool PreventUpdates();
  323.     WBool AllowUpdates();
  324.  
  325.     //
  326.     // FDX
  327.     //
  328.  
  329.     virtual WBool GetDDXEnabled() const;
  330.     virtual void SetDDXEnabled( WBool );
  331.  
  332.     virtual void        EscapeCString( WString &, const WString & ) const;
  333.  
  334.     protected:
  335.         virtual void GenerateCreate( const WString& objPrefix,
  336.                                  ostream& src,
  337.                        MMJCodeGenerationParms* pGenParms ) const;
  338.         virtual void GeneratePreAdd( const WString& objPrefix,
  339.                                  ostream& src,
  340.                        MMJCodeGenerationParms* pGenParms ) const;
  341.     virtual void GenerateImports( ostream& src,
  342.                         MMJCodeGenerationParms* pGenParms ) const;
  343.  
  344.     virtual void GenerateEvents( ostream& src,
  345.                        MMJCodeGenerationParms* pGenParms ) const;
  346.  
  347.     virtual void GenerateAddListenerCode( const WString prefix,
  348.                                               ostream& src,
  349.                           MMJCodeGenerationParms* pGenParms ) const;
  350.  
  351.         virtual void GenerateCreateEvent( const WString& objPrefix,
  352.                                       ostream& src,
  353.                             MMJCodeGenerationParms* pGenParms ) const;
  354.  
  355.         virtual void GenerateDestroyEvent( const WString& objPrefix,
  356.                                       ostream& src,
  357.                             MMJCodeGenerationParms* pGenParms ) const;
  358.  
  359.         virtual WStyle CheckExtraStyles(WStyle style);
  360.  
  361.     WString GetLastPart( const WString &fulltype ) const;
  362.  
  363.     virtual WString GetControlScope() const;
  364.  
  365.     private:
  366.     WBool        handleObjectLoading( WObject *, WEventData * );
  367.  
  368.     protected:
  369.         DTJObjectBase( const MetaObject * pMetaObj = NULL );
  370.  
  371.     WBool        _doJavaPainting;
  372.     WMenuItem *    _customizeMenuItem;
  373.     WRect        _latestDTRect;
  374.     WJavaObject *    _customizer;
  375.     WJavaObject *    _customizerForm;
  376.     WJavaObject *    _nonImplementationJavaObj;
  377. };
  378.  
  379. class METAEXPORTCLASSDEF DTJObject : public DTJObjectBase
  380. /*******************************************************/
  381. {
  382.     public:
  383.         virtual       ~DTJObject();
  384.  
  385.     protected:
  386.         DTJObject( const MetaObject * pMetaObj = NULL );
  387. };
  388.  
  389. // needed for mdreader
  390. typedef DTJObject DTjava__dot__lang__dot__Object__dot__102;
  391. typedef DTJObjectBase DTpowersoft__dot__generic__dot__Object__dot__102;
  392.  
  393. #include "dttyped.hpp"
  394.  
  395. class DTType_JBool_Or_Null;
  396. class DTType_WLong_Or_Null;
  397. class DTType_WInt_Or_Null;
  398. class DTType_WShort_Or_Null;
  399. class DTType_WChar_Or_Null;
  400. class DTType_WString_Or_Null;
  401. class DTType_JFont_Or_Null;
  402. class DTType_Color_Or_Null;
  403. class DTEnumType_Or_Null;
  404. extern DTType * METAEXPORTDEF Get_Generic_Color_Property( const DTObject * obj, const MMProperty * prop );
  405. extern WBool    METAEXPORTDEF Set_Generic_Color_Property( DTObject * obj, const DTType_Color_Or_Null * val, const MMProperty * );
  406. extern DTType * METAEXPORTDEF Get_Generic_Font_Property( const DTObject * obj, const MMProperty * prop );
  407. extern WBool    METAEXPORTDEF Set_Generic_Font_Property( DTObject * obj, const DTType_JFont_Or_Null * val, const MMProperty * );
  408. extern DTType * METAEXPORTDEF Get_Generic_String_Property( const DTObject * obj, const MMProperty * prop );
  409. extern WBool    METAEXPORTDEF Set_Generic_String_Property( DTObject * obj, const DTType_WString_Or_Null * val, const MMProperty * );
  410. extern DTType * METAEXPORTDEF Get_Generic_Boolean_Property( const DTObject * obj, const MMProperty * prop );
  411. extern WBool    METAEXPORTDEF Set_Generic_Boolean_Property( DTObject * obj, const DTType_JBool_Or_Null * val, const MMProperty * );
  412. extern DTType * METAEXPORTDEF Get_Generic_Long_Property( const DTObject * obj, const MMProperty * prop );
  413. extern WBool    METAEXPORTDEF Set_Generic_Long_Property( DTObject * obj, const DTType_WLong_Or_Null * val, const MMProperty * );
  414. extern DTType * METAEXPORTDEF Get_Generic_Int_Property( const DTObject * obj, const MMProperty * prop );
  415. extern WBool    METAEXPORTDEF Set_Generic_Int_Property( DTObject * obj, const DTType_WInt_Or_Null * val, const MMProperty * );
  416. extern DTType * METAEXPORTDEF Get_Generic_Short_Property( const DTObject * obj, const MMProperty * prop );
  417. extern WBool    METAEXPORTDEF Set_Generic_Short_Property( DTObject * obj, const DTType_WShort_Or_Null * val, const MMProperty * );
  418. extern DTType * METAEXPORTDEF Get_Generic_Char_Property( const DTObject * obj, const MMProperty * prop );
  419. extern WBool    METAEXPORTDEF Set_Generic_Char_Property( DTObject * obj, const DTType_WChar_Or_Null * val, const MMProperty * );
  420. extern DTType * METAEXPORTDEF Get_Generic_Enum_Property( const DTObject * obj, const MMProperty * prop );
  421. extern WBool    METAEXPORTDEF Set_Generic_Enum_Property( DTObject * obj, const DTEnumType_Or_Null * val, const MMProperty * );
  422.  
  423. #endif // _DTJOBJCT_HPP
  424.