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

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WOleContainer -- Ole Object Container class
  14.  *
  15.  *
  16.  *   Events:
  17.  *
  18.  *      NewObject               -- a new object has been created
  19.  *
  20.  *      SetStatusText           -- a request to set the app's status bar
  21.  *
  22.  *      GetBorder               -- object is requesting the rect in which
  23.  *                                 it will perform border negotiation
  24.  *
  25.  *      RequestBorderSpace      -- the object is asking for border space
  26.  *
  27.  *      SetBorderSpace          -- the object is informing you how much
  28.  *                                 border space it is actually using
  29.  *
  30.  *      DragEnter               -- an Ole drag enter event
  31.  *
  32.  *      DragLeave               -- an Ole drag leave event
  33.  *
  34.  *      DragOver                -- an Ole drag over event
  35.  *
  36.  *      DragDrop                -- an Ole drag drop event
  37.  *
  38.  *
  39.  *************************************************************************/
  40.  
  41. #ifndef _WOLEFORM_HPP_INCLUDED
  42. #define _WOLEFORM_HPP_INCLUDED
  43.  
  44. #ifndef _WNO_PRAGMA_PUSH
  45. #pragma pack(push,8);
  46. #pragma enum int;
  47. #endif
  48.  
  49. #ifndef _WOLEAUTO_HPP_INCLUDED
  50. #  include "woleauto.hpp"
  51. #endif
  52. #ifndef _WSTRING_HPP_INCLUDED
  53. #  include "wstring.hpp"
  54. #endif
  55. #ifndef _WCOLOR_HPP_INCLUDED
  56. #  include "wcolor.hpp"
  57. #endif
  58. #ifndef _WFONT_HPP_INCLUDED
  59. #  include "wfont.hpp"
  60. #endif
  61. #ifndef _WOLEDEF_HPP_INCLUDED
  62. #   include "woledef.hpp"
  63. #endif
  64. #ifndef _WWINDOW_HPP_INCLUDED
  65. #   include "wwindow.hpp"
  66. #endif
  67. #ifndef _WTHREAD_HPP_INCLUDED
  68. #   include "wthread.hpp"
  69. #endif
  70.  
  71. // forward declarations
  72. class WCMCLASS WOleObject;
  73. class WCMCLASS WOleIContainer;
  74. class WCMCLASS WForm;
  75. class WCMCLASS WFont;
  76. class WCMCLASS WCanvas;
  77. class WCMCLASS WDisplayCanvas;
  78. class WCMCLASS WString;
  79.  
  80. // new object event data structure
  81. struct WNewObjectEventData : public WEventData {
  82.     WOleObject  *newObject;
  83. };
  84.  
  85. // set status text event data structure
  86. struct WSetStatusTextEventData : public WEventData {
  87.     WChar       *statusText;
  88. };
  89.  
  90. // border negotiation event data structures
  91. typedef struct WBorderWidths {
  92.     WLong       left;
  93.     WLong       top;
  94.     WLong       right;
  95.     WLong       bottom;
  96. } WBorderWidths;
  97.  
  98. struct WBorderWidthsEventData : public WEventData {
  99.     WBorderWidths       widths;
  100. };
  101.  
  102. struct WBorderEventData : public WEventData {
  103.     WRect       rect;
  104. };
  105.  
  106. class WCMCLASS WOleContainer {
  107.  
  108.     public:
  109.  
  110.         /**********************************************************
  111.          * Constructors and Destructors
  112.          *********************************************************/
  113.  
  114.         WOleContainer( WForm *form );
  115.  
  116.         virtual ~WOleContainer();
  117.  
  118.     public:
  119.         /**************************************************************
  120.          * Properties
  121.          **************************************************************/
  122.  
  123.         // Show Object Type
  124.         WBool SetShowObjectType( WBool show );
  125.         WBool GetShowObjectType( void ) const;
  126.  
  127.         // Inplace Active
  128.         WBool SetAllowInplaceActive( WBool inplaceActive );
  129.         WBool GetAllowInplaceActive( void ) const;
  130.  
  131.         // Negotiate Menus
  132.         WBool SetNegotiateMenus( WBool negotiate );
  133.         WBool GetNegotiateMenus( void ) const;
  134.     
  135.         // Ambient properties for the container
  136.  
  137.         // Locale ID
  138.         WBool SetLocaleID( WULong lcid );
  139.         WULong GetLocaleID( void ) const;
  140.  
  141.         // Design Mode
  142.         WBool SetDesignMode( WBool set );
  143.         WBool GetDesignMode( void ) const;
  144.  
  145.         // UI dead
  146.         WBool SetUIDead( WBool set );
  147.         WBool GetUIDead( void ) const;
  148.  
  149.         // Show Grab Handles
  150.         WBool SetShowGrabHandles( WBool set );
  151.         WBool GetShowGrabHandles( void ) const;
  152.  
  153.         // Show Hatching
  154.         WBool SetShowHatching( WBool set );
  155.         WBool GetShowHatching( void ) const;
  156.  
  157.         // Document Name
  158.         WBool SetDocumentTitle( const WString & title );
  159.         WString GetDocumentTitle( void ) const;
  160.  
  161.         // Disable Ole Drag Drop
  162.         WBool SetDisableOleDragDrop( WBool disable );
  163.         WBool GetDisableOleDragDrop( void ) const;
  164.  
  165.         // Inplace Frame
  166.         WBool SetInplaceFrame( WOleContainer *frame );
  167.         WOleContainer *GetInplaceFrame( void ) const;
  168.  
  169.         // read-only properties
  170.         WBool GetHasLinks( void ) const;
  171.         WBool GetDirty( void ) const;
  172.         WString GetDocFile( void ) const;
  173.         WString GetActiveObjectName( void ) const;
  174.         WOleObject *GetFirstObject( void );
  175.         WOleObject *GetNextObject( WOleObject * );
  176.         WOleObject *GetCurrentObject( void );
  177.         WBool GetPasteValid( void );
  178.         WBool GetPasteLinkValid( void );
  179.         unsigned int GetOleObjectCount( void ) const;
  180.         WOleObject *GetOleObject( unsigned int index ) const;
  181.  
  182.         WForm *GetForm( void ) const { return( _form ); };
  183.  
  184.         /**************************************************************
  185.          * Methods
  186.          **************************************************************/
  187.  
  188.         // creation and initialization functions
  189.         WBool InitializeContainer( const WString * file=NULL );
  190.         WBool UninitializeContainer( void );
  191.         WBool LoadContainer( const WString & file );
  192.         WBool SaveContainer( const WString * file=NULL );
  193.  
  194.         // ambient properties notifications
  195.         void AmbientsChanged( WAmbientID *ambientIDs, WInt num );
  196.         void AmbientChanged( WAmbientID ambientID );
  197.  
  198.         void DestroyObjects( WBool deleteObjects=FALSE );
  199.         WBool Paste( void );
  200.         WBool PasteLink( void );
  201.         WBool EditLinks( void );
  202.         WBool UpdateLinks( void );
  203.         WBool PasteSpecial( WBool allowLinks=TRUE );
  204.         void RenegotiateBorder( void );
  205.     
  206.     /**********************************************************
  207.      * Internal Members
  208.      *********************************************************/
  209.     
  210.         WOleIContainer *IContainer( void ) const;
  211.  
  212.         // mouse and paint events
  213.         WBool OlePaint( WDisplayCanvas & port );
  214.         WBool OleMouseEvent( WMouseEventData *ev );
  215.         WBool OleContextMenu( WContextMenuEventData *ev );
  216.         WBool OleCharPressEvent( WCharacterPressEventData *ev );
  217.  
  218.         // event handlers
  219.         WBool FormResizeEventHandler( WResizeEventData *ev );
  220.         WBool MessageHookEventHandler( WMessageFilterData *ev );
  221.         WBool InstallMsgFilter( void );
  222.         void UninstallMsgFilter( WBool force = FALSE );
  223.  
  224.         WBool ResizePercentageHandler( WResizeEventData * event );
  225.  
  226.         // This property is obsolete. Usrs should use the DesignMode
  227.         // property instead.
  228.  
  229.         // User Mode
  230.         WBool SetUserMode( WBool set );
  231.         WBool GetUserMode( void ) const;
  232.  
  233.     /**********************************************************
  234.      * Data Members
  235.      *********************************************************/
  236.     
  237.     protected:
  238.  
  239.         WRect                           _lastResizeRect;
  240.  
  241.     protected:
  242.         class WOleContainerEventHandler : public WObject {
  243.     
  244.             public:
  245.                 WOleContainerEventHandler( WOleContainer *container );
  246.                 ~WOleContainerEventHandler( void );
  247.         
  248.                 // event handlers
  249.                 WBool Paint( WObject *, WPaintEventData *ev );
  250.                 WBool MouseEvent( WObject *, WMouseEventData *ev );
  251.                 WBool ContextMenuEvent( WObject *, WContextMenuEventData *ev );
  252.                 WBool CharPressEvent( WObject *,WCharacterPressEventData *ev );
  253.                 WBool FormResizeEventHandler( WObject *, WResizeEventData *ev );
  254.                 WBool MessageHookEventHandler( WMessageFilterData *ev );
  255.  
  256.                 WBool InstallMsgFilter( void );
  257.                 void UninstallMsgFilter( WBool force );
  258.         
  259.                 WOleContainer   *_container;
  260.  
  261.             private:
  262.                 WUInt           _filterInstalled;
  263.         };
  264.  
  265.     protected:
  266.         WForm           *_form;
  267.         WOleIContainer  *_iform;
  268.  
  269.         WOleContainerEventHandler       _eventHandler;
  270.  
  271.         // ambient properties for this object
  272.         WULong          _localeID;      // locale ID
  273.         WBool           _designMode;    // design mode?
  274.         WBool           _UIDead;        // UI dead?
  275.         WBool           _showGrabHandles;// show grab handles?
  276.         WBool           _showHatching;  // show hatching?
  277.  
  278. };
  279.  
  280. #ifndef _WNO_PRAGMA_PUSH
  281. #pragma enum pop;
  282. #pragma pack(pop);
  283. #endif
  284.  
  285. #endif // _WOLEFORM_HPP_INCLUDED
  286.