home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WDIALOG.HPP < prev    next >
C/C++ Source or Header  |  1996-11-14  |  9KB  |  278 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.         // FDXInitializeControls
  114.         //
  115.         //      Called by the default Initialize event handler
  116.  
  117.         virtual WBool FDXInitializeControls();
  118.  
  119.         // FDXUpdateControls
  120.         //
  121.         //      Called by the default OK event handler
  122.  
  123.         virtual WBool FDXUpdateControls();
  124.  
  125.         /**********************************************************
  126.          * Event Handlers
  127.          *********************************************************/
  128.  
  129.         WBool OKButtonCallback( WWindow *, WEventData * );
  130.     
  131.         WBool CancelButtonCallback( WWindow *, WEventData * );
  132.     
  133.         virtual WBool DialogCloseEventHandler( WModelessDialog * dialog,
  134.                                                WEventData * event );
  135.  
  136.         /**********************************************************
  137.          * Overrides
  138.          *********************************************************/
  139.  
  140.         virtual void AddControl( WControl * ctrl );
  141.  
  142.         virtual WBool ProcessMessage( const WMessage & msg,
  143.                                       WLong & returns );
  144.     
  145.         virtual WBool DefaultProcess( const WMessage & msg,
  146.                                       WLong & returns );
  147.  
  148.         virtual WStyle GetDefaultStyle() const;
  149.  
  150.         virtual WBool Destroy();
  151.  
  152.         virtual void * GetTargetWindowProc() const;
  153.  
  154.         virtual WInt GetTargetOffset() const;
  155.  
  156.         virtual WBool LoadWindow( WWindow * parent,
  157.                                   const WResourceID & id,
  158.                                   WModuleHandle module=_ApplicationModule );
  159.  
  160.         virtual WBool MakeWindow( WWindow * parent, WUInt id,
  161.                                   const WChar * className,
  162.                                   const WChar * title, const WRect & r,
  163.                                   WStyle wstyle, WStyle exStyle,
  164.                                   void * data=NULL );
  165.     
  166.         /**********************************************************
  167.          * Other
  168.          *********************************************************/
  169.  
  170.         WBool DialogFilter( WMessageFilterData * data );
  171.  
  172.         WCallbackProc GetDialogProcedure() const;
  173.  
  174.         WResourceID GetResourceID() const;
  175.  
  176.         int operator ==( const WModelessDialog & obj ) const;
  177.  
  178.         WBool PrepareChildHelpIDs();
  179.  
  180.         virtual WBool CallNextWindowProcedure( const WMessage & msg,
  181.                                                WLong & returns );
  182.     
  183.     private:
  184.  
  185.         void EventInit();
  186.  
  187.         /**********************************************************
  188.          * Data members
  189.          *********************************************************/
  190.  
  191.     protected:
  192.  
  193.         void *                  _internalData3;
  194.         void *                  _internalData2;
  195.         int                     _internalCount;
  196.         WModuleHandle           _moduleHandle;
  197.  
  198.     private:
  199.     
  200.         WCallbackProc           _procInst;
  201.         WResourceID             _dialog_id;
  202.         WCommandButton *        _okButton;
  203.         WCommandButton *        _cancelButton;
  204. };
  205.  
  206. /*************************************************************************
  207.  *
  208.  * WDialog -- Wrapper for the Windows 95 Dialog object.
  209.  *
  210.  *
  211.  *   Events:
  212.  *
  213.  *************************************************************************/
  214.  
  215. class WCMCLASS WDialog : public WModelessDialog {
  216.     WDeclareSubclass( WDialog, WModelessDialog );
  217.  
  218.     public:
  219.  
  220.         /**********************************************************
  221.          * Constructors and Destructors
  222.          *********************************************************/
  223.  
  224.         WDialog();
  225.         WDialog( WWindow *parent );
  226.     
  227.         ~WDialog();
  228.  
  229.         /**********************************************************
  230.          * Properties
  231.          *********************************************************/
  232.  
  233.         // ReturnValue
  234.  
  235.         WULong GetReturnValue() const;
  236.  
  237.         /**********************************************************
  238.          * Methods
  239.          *********************************************************/
  240.  
  241.         /**********************************************************
  242.          * Overrides
  243.          *********************************************************/
  244.  
  245.         virtual WBool ProcessMessage( const WMessage & msg,
  246.                                       WLong & returns );
  247.     
  248.         virtual void Dismiss( WULong code );
  249.  
  250.         virtual WBool Destroy();
  251.  
  252.         virtual WBool LoadWindow( WWindow * parent,
  253.                                   const WResourceID & id,
  254.                                   WModuleHandle module=_ApplicationModule );
  255.  
  256.         virtual WBool MakeWindow( WWindow * parent, WUInt id,
  257.                                   const WChar * className,
  258.                                   const WChar * title, const WRect & r,
  259.                                   WStyle wstyle, WStyle exStyle,
  260.                                   void * data=NULL );
  261.     
  262.         /**********************************************************
  263.          * Data Members
  264.          *********************************************************/
  265.  
  266.     private:
  267.  
  268.         WULong                  _return;
  269.         void *                  _internalData;
  270. };
  271.  
  272. #ifndef _WNO_PRAGMA_PUSH
  273. #pragma enum pop;
  274. #pragma pack(pop);
  275. #endif
  276.  
  277. #endif // _WDIALOG_HPP_INCLUDED
  278.