home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / DTJOBJCT.HPP < prev    next >
C/C++ Source or Header  |  1996-12-28  |  7KB  |  218 lines

  1.  
  2.  
  3.  
  4. #ifndef _DTJOBJECT_HPP
  5. #define _DTJOBJECT_HPP
  6.  
  7. #include "dtobject.hpp"
  8. #include "dtformbs.hpp"
  9.         
  10. #define JAVA_FILE_EXTENSION             WTEXT(".java")
  11. #define JAVA_CLASS_EXTENSION            WTEXT(".class")
  12.  
  13. struct MMJFileGenerationParms;
  14.  
  15. enum __ControlScope {
  16.     ePublic        = 0,
  17.     eDefault        = 1,
  18.     eProtected         = 2,
  19.     ePrivateProtected     = 3,
  20.     ePrivate         = 4,
  21. };
  22.  
  23. enum MMJFileFragment {
  24.     JAVA_CG_GENFORM,            // generate all code for a form
  25.     JAVA_CG_GENHTML,            // generate the html for an applet
  26.     JAVA_CG_GENACTIVEX_HOOKS,   // for applets only: generate the hooks
  27.                     // that communicate between the actual
  28.                 // applet and the applet form
  29. };
  30.  
  31. enum MMJCodeGeneration {
  32.     JAVA_CG_IMPORTS,            // package imports
  33.     
  34.     JAVA_CG_CONSTRUCTOR,        // the class constructor
  35.     JAVA_CG_FINALIZER,          // finalizer (ie destructor) code
  36.     JAVA_CG_HANDLE_EVENT,       // event handler
  37.     JAVA_CG_DECLARATION,        // member declarations/initializations
  38.  
  39.     JAVA_CG_STYLES,             // code for additional styles
  40.     JAVA_CG_CREATE,             // create code
  41.     JAVA_CG_DESTROY,            // destroy code
  42.     JAVA_CG_AUTO,               // any code like auto connection code that
  43.                                 // will be generated in the create just before
  44.                 // the form is made visible
  45.     
  46.     JAVA_CG_DB_TRANSCONNECT,    // connect the transaction
  47.     JAVA_CG_DB_CREATEQUERY,     // create the query
  48.     JAVA_CG_DB_SETSQL,          // set the SQL for the query
  49.     JAVA_CG_DB_AUTOOPENQUERY,   // open the query
  50.     JAVA_CG_QUERY_DESTROY,    // destroy the query
  51.     JAVA_CG_TRANS_DISCONNECT,    // disconnect the transaction
  52.  
  53.     JAVA_CG_CHILDMETHODS,    // child-inspired methods, sent to form
  54.     JAVA_CG_PARENTMETHODS,    // child-inspired methods, sent from form
  55.                     // its children
  56.  
  57.     JAVA_CG_APPCHILDMETHODS,    // child-inspired applet methods, sent to form
  58.     JAVA_CG_APPPARENTMETHODS,    // child-inspired applet methods, sent from
  59.                     // form to its children
  60.  
  61.     JAVA_CG_APPCHILDHTML,    // child-inspired applet HTML code, sent to
  62.                     // form
  63.     JAVA_CG_APPPARENTHTML,    // child-inspired applet HTML code, sent from/
  64.                     // form to its children
  65.  
  66.     JAVA_CG_EVENTS,             // generate the events for a component
  67.     JAVA_CG_ADDLISTENER,        // generate the add listener calls for the component
  68. };
  69.  
  70. class METAEXPORTCLASSDEF DTJObject : public DTObjectBase
  71. /******************************************************/
  72. {
  73.     public:
  74.         virtual       ~DTJObject();
  75.  
  76.         virtual WBool GetIsHollow();                // groupbox
  77.  
  78.     virtual void GenFileFragment( MMFileFragment fg, WStringList &,
  79.                       MMFileGenerationParms * parms ) const;
  80.  
  81.     // not used any more
  82.         void GenCode( MMCodeGeneration mmCodeGen,
  83.               WStringList& srcList ) const;
  84.     public:
  85.  
  86.         // override this to demangle the Meta object name
  87.     virtual void GenClassName( WString & ) const;
  88.     //
  89.     // Style
  90.     //
  91.     //    The Windows style property of the associated Window.
  92.     //    This doesn't necessarily match GetWindow()->GetStyle()
  93.     //    because some styles are deferred until run-time (such
  94.     //    as WSVisible).
  95.  
  96.     virtual WStyle        GetStyle() const;
  97.     virtual WBool        SetStyle( WStyle stl, WBool clone=FALSE );
  98.  
  99.     //
  100.     // DefaultStyle
  101.     //
  102.     //    The style with which new instances are created.  Default
  103.     //    implementation returns GetWindow()->GetDefaultStyle().
  104.  
  105.     virtual WStyle        GetDefaultStyle() const;
  106.  
  107.     //
  108.     // ExtendedStyle
  109.     //
  110.     //    The ExtendedStyle property of the window nature.
  111.  
  112.     virtual WStyle        GetExtendedStyle() const;
  113.     virtual WBool        SetExtendedStyle( WStyle style, WBool clone=FALSE );
  114.  
  115.     //
  116.     // DefaultExtendedStyle
  117.     //
  118.     //    See DefaultStyle
  119.  
  120.     virtual WStyle        GetDefaultExtendedStyle() const;
  121.  
  122.  
  123.     //
  124.     // Create
  125.     //
  126.     //    Call Create on the windowed object.
  127.     //
  128.     virtual WBool        Create( WWindow * parent, const WRect & r,
  129.                         const WChar * text, WStyle style,
  130.                     WStyle exStyle, void * data = NULL,
  131.                     WBool isLoading = FALSE );
  132.         //
  133.         // Rectangle
  134.         //
  135.         //    The pixel-based position of the object; optionally, absolute
  136.         //    to the desktop.  
  137.  
  138.         virtual void            DTGetRectangle( WRect & r, 
  139.                                                 WBool abs = FALSE ) const;
  140.         virtual void            DTSetRectangle( const WRect & r );
  141.  
  142.         //
  143.         // ClientRectangle
  144.         //
  145.         //    Get the client rectangle.  This is mainly used for DTForms.
  146.  
  147.         virtual void            DTGetClientRectangle( WRect & r ) const;
  148.  
  149.         //
  150.         // RCRectangle
  151.         //
  152.         //    The rectangle to use in the .rc file (still in pixel though).
  153.         //    This differs for WComboBox, which gives a .rc file rectangle
  154.         //    of the correct height instead of the design time height.
  155.  
  156.         virtual void            DTGetRCRectangle( WRect & r ) const;
  157.  
  158.         //
  159.         // PixelsToDLU / DLUToPixels
  160.         //
  161.         //    Map between pixels and dialog units (DLU).
  162.  
  163.         virtual WRect           DTMapPixelsToDLU( const WRect & pix ) const;
  164.         virtual WRect           DTMapDLUToPixels( const WRect & dlu ) const;
  165.  
  166.         //
  167.         // BringToTop
  168.         //
  169.         //    Bring the object to the top of the Z- order
  170.  
  171.         virtual void            DTBringToTop();
  172.  
  173.         //
  174.         // Repaint
  175.         //
  176.         //    Invalidate an object and cause it to be repainted
  177.  
  178.         virtual void            DTRepaint();
  179.  
  180.  
  181.         //
  182.         // ObjectPrefix
  183.         //
  184.         //    Get the prefix used when accessing member functions of the
  185.         //    object -- eg. "cb_1->"
  186.  
  187.         WString GetObjectPrefix() const;
  188.  
  189.     virtual void GenerateCode( MMCodeGeneration, ostream &, MMCodeGenerationParms & );
  190.         virtual void GenerateCode( MMJCodeGeneration mmCodeGen,
  191.                    WStringList& srcList,
  192.                    MMJFileGenerationParms* pGenParms ) const;
  193.  
  194.     virtual void AddEventsToList( DTCodeBlockList* pEventList );
  195.  
  196.     protected:
  197.     virtual void GenerateImports( WStringList& srcList,
  198.                         MMJFileGenerationParms* pGenParms ) const;
  199.  
  200.     virtual void GenerateEvents( WStringList& source,
  201.                        MMJFileGenerationParms* pGenParms ) const;
  202.  
  203.     virtual void GenerateAddListenerCode( const WString prefix,
  204.                                               WStringList& srcList,
  205.                           MMJFileGenerationParms* pGenParms ) const;
  206.  
  207.         virtual WStyle CheckExtraStyles(WStyle style);
  208.  
  209.     WString GetLastPart( const WString &fulltype ) const;
  210.  
  211.     protected:
  212.         DTJObject( const MetaObject * pMetaObj = NULL );
  213.  
  214. };
  215.  
  216. #endif // _DTJOBJECT_HPP
  217.  
  218.