home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / WDIALOG.HPP < prev    next >
C/C++ Source or Header  |  1996-11-29  |  9KB  |  266 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.  * WModelessDialog -- Wrapper for the Windows 95 Dialog object.
  14.  *
  15.  *
  16.  *   Events:
  17.  *
  18.  *       Cancel --
  19.  *
  20.  *       Close --
  21.  *
  22.  *       OK --
  23.  *
  24.  *************************************************************************/
  25.  
  26. #ifndef _WDIALOG_HPP_INCLUDED
  27. #define _WDIALOG_HPP_INCLUDED
  28.  
  29. #ifndef _WNO_PRAGMA_PUSH
  30. #pragma pack(push,8);
  31. #pragma enum int;
  32. #endif
  33.  
  34. #ifndef _WFORM_HPP_INCLUDED
  35. #  include "wform.hpp"
  36. #endif
  37. #ifndef _WRESID_HPP_INCLUDED
  38. #  include "wresid.hpp"
  39. #endif
  40. #ifndef _WVECTOR_HPP_INCLUDED
  41. #  include "wvector.hpp"
  42. #endif
  43. #ifndef _WSEMAPHR_HPP_INCLUDED
  44. #  include "wsemaphr.hpp"
  45. #endif
  46. struct WMessageFilterData;
  47.  
  48. class WCommandButton;
  49.  
  50. #define WIDOK                   1
  51. #define WIDCancel               2
  52. #define WIDAbort                3
  53. #define WIDRetry                4
  54. #define WIDIgnore               5
  55. #define WIDYes                  6
  56. #define WIDNo                   7
  57. #define WIDClose                8
  58. #define WIDHelp                 9
  59.  
  60. //
  61. // Dialog styles
  62. //
  63.  
  64. #define WDSAbsAlign                     ((WStyle)0x0001L) // DS_ABSALIGN
  65. #define WDSSysModal                     ((WStyle)0x0002L) // DS_SYSMODAL
  66. #define WDS3DLook                       ((WStyle)0x0004L) // DS_3DLOOK
  67. #define WDSFixedSys                     ((WStyle)0x0008L) // DS_FIXEDSYS
  68. #define WDSNoFailCreate                 ((WStyle)0x0010L) // DS_NOFAILCREATE
  69. #define WDSLocalEdit                    ((WStyle)0x0020L) // DS_LOCALEDIT
  70. #define WDSSetFont                      ((WStyle)0x0040L) // DS_SETFONT
  71. #define WDSModalFrame                   ((WStyle)0x0080L) // DS_MODALFRAME
  72. #define WDSNoIdleMsg                    ((WStyle)0x0100L) // DS_NOIDLEMSG
  73. #define WDSSetForeGround                ((WStyle)0x0200L) // DS_SETFOREGROUND
  74. #define WDSControl                      ((WStyle)0x0400L) // DS_CONTROL
  75. #define WDSCenter                       ((WStyle)0x0800L) // DS_CENTER
  76. #define WDSCenterMouse                  ((WStyle)0x1000L) // DS_CENTERMOUSE
  77. #define WDSContextHelp                  ((WStyle)0x2000L) // DS_CONTEXTHELP
  78.  
  79. class WCMCLASS WModelessDialog : public WForm {
  80.     WDeclareSubclass( WModelessDialog, WForm );
  81.  
  82.     public:
  83.  
  84.         /**********************************************************
  85.          * Constructors and Destructors
  86.          *********************************************************/
  87.  
  88.         WModelessDialog();
  89.         WModelessDialog( WWindow *parent );
  90.     
  91.         ~WModelessDialog();
  92.  
  93.         /**********************************************************
  94.          * Properties
  95.          *********************************************************/
  96.  
  97.         // CancelButton
  98.  
  99.         WCommandButton * SetCancelButton( WCommandButton * cancelButton );
  100.  
  101.         // OKButton
  102.  
  103.         WCommandButton * SetOKButton( WCommandButton * okButton );
  104.  
  105.         /**********************************************************
  106.          * Methods
  107.          *********************************************************/
  108.  
  109.         // Dismiss
  110.  
  111.         virtual void Dismiss( WULong code );
  112.  
  113.         /**********************************************************
  114.          * Event Handlers
  115.          *********************************************************/
  116.  
  117.         WBool OKButtonCallback( WWindow *, WEventData * );
  118.     
  119.         WBool CancelButtonCallback( WWindow *, WEventData * );
  120.     
  121.         virtual WBool DialogCloseEventHandler( WModelessDialog * dialog,
  122.                                                WEventData * event );
  123.  
  124.         /**********************************************************
  125.          * Overrides
  126.          *********************************************************/
  127.  
  128.         virtual void AddControl( WControl * ctrl );
  129.  
  130.         virtual WBool ProcessMessage( const WMessage & msg,
  131.                                       WLong & returns );
  132.     
  133.         virtual WBool DefaultProcess( const WMessage & msg,
  134.                                       WLong & returns );
  135.  
  136.         virtual WStyle GetDefaultStyle() const;
  137.  
  138.         virtual WBool Destroy();
  139.  
  140.         virtual void * GetTargetWindowProc() const;
  141.  
  142.         virtual WInt GetTargetOffset() const;
  143.  
  144.         virtual WBool LoadWindow( WWindow * parent,
  145.                                   const WResourceID & id,
  146.                                   WModuleHandle module=_ApplicationModule );
  147.  
  148.         virtual WBool MakeWindow( WWindow * parent, WUInt id,
  149.                                   const WChar * className,
  150.                                   const WChar * title, const WRect & r,
  151.                                   WStyle wstyle, WStyle exStyle,
  152.                                   void * data=NULL );
  153.     
  154.         /**********************************************************
  155.          * Other
  156.          *********************************************************/
  157.  
  158.         WBool DialogFilter( WMessageFilterData * data );
  159.  
  160.         WCallbackProc GetDialogProcedure() const;
  161.  
  162.         WResourceID GetResourceID() const;
  163.  
  164.         int operator ==( const WModelessDialog & obj ) const;
  165.  
  166.         WBool PrepareChildHelpIDs();
  167.  
  168.         virtual WBool CallNextWindowProcedure( const WMessage & msg,
  169.                                                WLong & returns );
  170.     
  171.     private:
  172.  
  173.         void EventInit();
  174.  
  175.         /**********************************************************
  176.          * Data members
  177.          *********************************************************/
  178.  
  179.     protected:
  180.  
  181.         void *                  _internalData3;
  182.         void *                  _internalData2;
  183.         int                     _internalCount;
  184.         WModuleHandle           _moduleHandle;
  185.  
  186.     private:
  187.     
  188.         WCallbackProc           _procInst;
  189.         WResourceID             _dialog_id;
  190.         WCommandButton *        _okButton;
  191.         WCommandButton *        _cancelButton;
  192. };
  193.  
  194. /*************************************************************************
  195.  *
  196.  * WDialog -- Wrapper for the Windows 95 Dialog object.
  197.  *
  198.  *
  199.  *   Events:
  200.  *
  201.  *************************************************************************/
  202.  
  203. class WCMCLASS WDialog : public WModelessDialog {
  204.     WDeclareSubclass( WDialog, WModelessDialog );
  205.  
  206.     public:
  207.  
  208.         /**********************************************************
  209.          * Constructors and Destructors
  210.          *********************************************************/
  211.  
  212.         WDialog();
  213.         WDialog( WWindow *parent );
  214.     
  215.         ~WDialog();
  216.  
  217.         /**********************************************************
  218.          * Properties
  219.          *********************************************************/
  220.  
  221.         // ReturnValue
  222.  
  223.         WULong GetReturnValue() const;
  224.  
  225.         /**********************************************************
  226.          * Methods
  227.          *********************************************************/
  228.  
  229.         /**********************************************************
  230.          * Overrides
  231.          *********************************************************/
  232.  
  233.         virtual WBool ProcessMessage( const WMessage & msg,
  234.                                       WLong & returns );
  235.     
  236.         virtual void Dismiss( WULong code );
  237.  
  238.         virtual WBool Destroy();
  239.  
  240.         virtual WBool LoadWindow( WWindow * parent,
  241.                                   const WResourceID & id,
  242.                                   WModuleHandle module=_ApplicationModule );
  243.  
  244.         virtual WBool MakeWindow( WWindow * parent, WUInt id,
  245.                                   const WChar * className,
  246.                                   const WChar * title, const WRect & r,
  247.                                   WStyle wstyle, WStyle exStyle,
  248.                                   void * data=NULL );
  249.     
  250.         /**********************************************************
  251.          * Data Members
  252.          *********************************************************/
  253.  
  254.     private:
  255.  
  256.         WULong                  _return;
  257.         void *                  _internalData;
  258. };
  259.  
  260. #ifndef _WNO_PRAGMA_PUSH
  261. #pragma enum pop;
  262. #pragma pack(pop);
  263. #endif
  264.  
  265. #endif // _WDIALOG_HPP_INCLUDED
  266.