home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / WMSGDLG.HPP < prev    next >
C/C++ Source or Header  |  1996-12-09  |  9KB  |  220 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.  * WMessageBox -- Wrapper for the Windows 95 Message box control.
  14.  *
  15.  *   Events:
  16.  *
  17.  *************************************************************************/
  18.  
  19. #ifndef _WMSGDLG_HPP_INCLUDED
  20. #define _WMSGDLG_HPP_INCLUDED
  21.  
  22. #ifndef _WNO_PRAGMA_PUSH
  23. #pragma pack(push,8);
  24. #pragma enum int;
  25. #endif
  26.  
  27. #ifndef _WOBJECT_HPP_INCLUDED
  28. #  include "wobject.hpp"
  29. #endif
  30.  
  31. class WMessageBox;
  32. class WWindow;
  33.  
  34. enum WMessageBoxReturn {
  35.     WMBReturnOk         = 1,
  36.     WMBReturnCancel     = 2,
  37.     WMBReturnAbort      = 3,
  38.     WMBReturnRetry      = 4,
  39.     WMBReturnIgnore     = 5,
  40.     WMBReturnYes        = 6,
  41.     WMBReturnNo         = 7,
  42.     WMBReturnClose      = 8,
  43.     WMBReturnHelp       = 9,
  44.     WMBReturnUnknown    = 10,
  45. };
  46.  
  47. typedef WStyle                  WMsgBStyle;
  48.  
  49. //
  50. // MessageBox styles
  51. //
  52.  
  53. #define WMsgBSOk                       ((WMsgBStyle)0x00000000L)
  54. #define WMsgBSOkCancel                 ((WMsgBStyle)0x00000001L)
  55. #define WMsgBSAbortRetryIgnore         ((WMsgBStyle)0x00000002L)
  56. #define WMsgBSYesNoCancel              ((WMsgBStyle)0x00000003L)
  57. #define WMsgBSYesNo                    ((WMsgBStyle)0x00000004L)
  58. #define WMsgBSRetryCancel              ((WMsgBStyle)0x00000005L)
  59.  
  60. #define WMsgBSIconError                ((WMsgBStyle)0x00000010L)
  61. #define WMsgBSIconQuestion             ((WMsgBStyle)0x00000020L)
  62. #define WMsgBSIconWarning              ((WMsgBStyle)0x00000030L)
  63. #define WMsgBSIconInformation          ((WMsgBStyle)0x00000040L)
  64. #define WMsgBSIconHand                 WMsgBSIconError
  65. #define WMsgBSIconStop                 WMsgBSIconError
  66. #define WMsgBSIconExclamation          WMsgBSIconWarning
  67. #define WMsgBSIconAsterisk             WMsgBSIconInformation
  68.  
  69. #define WMsgBSDefButton1               ((WMsgBStyle)0x00000000L)
  70. #define WMsgBSDefButton2               ((WMsgBStyle)0x00000100L)
  71. #define WMsgBSDefButton3               ((WMsgBStyle)0x00000200L)
  72. #define WMsgBSDefButton4               ((WMsgBStyle)0x00000300L)
  73.  
  74. #define WMsgBSApplModal                ((WMsgBStyle)0x00000000L)
  75. #define WMsgBSApplicationModal         ((WMsgBStyle)0x00000000L)
  76. #define WMsgBSSystemModal              ((WMsgBStyle)0x00001000L)
  77. #define WMsgBSTaskModal                ((WMsgBStyle)0x00002000L)
  78. #define WMsgBSHelp                     ((WMsgBStyle)0x00004000L)
  79.  
  80. #define WMsgBSLeft                     ((WMsgBStyle)0x00000000L)
  81. #define WMsgBSRight                    ((WMsgBStyle)0x00080000L)
  82.  
  83. #define WMsgBSRtlReading               ((WMsgBStyle)0x00100000L)
  84.  
  85. #define WMsgBSNoFocus                  ((WMsgBStyle)0x00008000L)
  86. #define WMsgBSSetForeground            ((WMsgBStyle)0x00010000L)
  87. #define WMsgBSDefaultDesktopOnly       ((WMsgBStyle)0x00020000L)
  88. #define WMsgBSServiceNotification      ((WMsgBStyle)0x00040000L)
  89.  
  90. #define WMsgBSTypeMask                 ((WMsgBStyle)0x0000000FL)
  91. #define WMsgBSUserIcon                 ((WMsgBStyle)0x00000080L)
  92. #define WMsgBSIconMask                 ((WMsgBStyle)0x000000F0L)
  93. #define WMsgBSDefMask                  ((WMsgBStyle)0x00000F00L)
  94. #define WMsgBSModeMask                 ((WMsgBStyle)0x00003000L)
  95. #define WMsgBSMiscMask                 ((WMsgBStyle)0x0000C000L)
  96.  
  97. enum WMessageBoxButton {
  98.     WMBButtonOk = WMsgBSOk,
  99.     WMBButtonOkCancel = WMsgBSOkCancel,
  100.     WMBButtonAbortRetryIgnore = WMsgBSAbortRetryIgnore,
  101.     WMBButtonYesNoCancel = WMsgBSYesNoCancel,
  102.     WMBButtonYesNo = WMsgBSYesNo,
  103.     WMBButtonRetryCancel = WMsgBSRetryCancel,
  104. };
  105.  
  106. enum WMessageBoxLevel {
  107.     WMBLevelPlain = 0,
  108.     WMBLevelInfo = WMsgBSIconInformation,
  109.     WMBLevelQuestion = WMsgBSIconQuestion,
  110.     WMBLevelReminder = WMsgBSIconWarning,
  111.     WMBLevelWarning = WMsgBSIconWarning,
  112.     WMBLevelError = WMsgBSIconError,
  113. };
  114.     
  115. enum WMessageBoxDefaultButton {
  116.     WMBDefault1 = WMsgBSDefButton1,
  117.     WMBDefault2 = WMsgBSDefButton2,
  118.     WMBDefault3 = WMsgBSDefButton3,
  119.     WMBDefault4 = WMsgBSDefButton4,
  120. };
  121.  
  122. enum WMessageBoxAttribute {
  123.     WMBAttributeNormal = WMsgBSTaskModal,
  124.     WMBAttributeSystemModal = WMsgBSSystemModal,
  125.     WMBAttributeNoFocus = WMsgBSNoFocus,
  126.     WMBAttributeTaskModal = WMsgBSTaskModal,
  127.     WMBAttributeApplModal = WMsgBSApplModal,
  128.     WMBAttributeApplicationModal = WMsgBSApplicationModal,
  129. };
  130.  
  131. class WCMCLASS WMessageBox : public WObject {
  132.     WDeclareSubclass( WMessageBox, WObject );
  133.     
  134.     public:
  135.     
  136.         /*******************************************************
  137.          * Constructors and Destructors
  138.          *******************************************************/
  139.         
  140.         WMessageBox();
  141.     
  142.         ~WMessageBox();
  143.     
  144.         /*******************************************************
  145.          * Properties
  146.          *******************************************************/
  147.  
  148.         /*******************************************************
  149.          * Methods
  150.          *******************************************************/
  151.  
  152.         // Messagef
  153.  
  154.         static WMessageBoxReturn Messagef( WWindow * parent,
  155.                                            WMsgBStyle style,
  156.                                            const WChar * caption,
  157.                                            const WChar * format, ... );
  158.         static WMessageBoxReturn Messagef( WWindow * parent,
  159.                                            WMessageBoxLevel level,
  160.                                            WMessageBoxButton button,
  161.                                            const WChar * caption,
  162.                                            const WChar * format, ... );
  163.         static WMessageBoxReturn MessageFormat( WWindow * parent,
  164.                                            WMsgBStyle style,
  165.                                            const WChar * caption,
  166.                                            const WChar * format, ... );
  167.         static WMessageBoxReturn MessageFormat( WWindow * parent,
  168.                                            WMessageBoxLevel level,
  169.                                            WMessageBoxButton button,
  170.                                            const WChar * caption,
  171.                                            const WChar * format, ... );
  172.  
  173.         // Message
  174.  
  175.         static WMessageBoxReturn Message( WWindow * parent, WMsgBStyle style,
  176.                                           const WChar * caption,
  177.                                           const WChar * text );
  178.         static WMessageBoxReturn Message( WWindow * parent,
  179.                                           WMessageBoxLevel level,
  180.                                           WMessageBoxButton button,
  181.                                           const WChar * caption,
  182.                                           const WChar * text,
  183.                                           WMessageBoxDefaultButton
  184.                                             defaultButton = WMBDefault1,
  185.                                           WMessageBoxAttribute
  186.                                             attribute = WMBAttributeNormal );
  187.  
  188.         // Info
  189.  
  190.         static void Info( WWindow * parent, const WChar * caption,
  191.                           const WChar * format, ... );
  192.     
  193.         /*******************************************************
  194.          * Others
  195.          *******************************************************/
  196.  
  197.     private:
  198.     
  199.         static WMessageBoxReturn DoMessage( WWindow * parent,
  200.                                             WMsgBStyle style,
  201.                                             const WChar * text,
  202.                                             const WChar * caption );
  203.         static WMessageBoxReturn DoMessage( WWindow * parent,
  204.                                             WMessageBoxLevel level,
  205.                                             WMessageBoxButton button,
  206.                                             const WChar * text,
  207.                                             const WChar * caption,
  208.                                             WMessageBoxDefaultButton
  209.                                               defaultButton = WMBDefault1,
  210.                                             WMessageBoxAttribute
  211.                                               attribute = WMBAttributeNormal );
  212. };
  213.  
  214. #ifndef _WNO_PRAGMA_PUSH
  215. #pragma enum pop;
  216. #pragma pack(pop);
  217. #endif
  218.  
  219. #endif // _WMSGDLG_HPP_INCLUDED
  220.