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