home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 10 / ioProg_10.iso / soft / optima / hpp.z / WPROPSHT.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-19  |  10.6 KB  |  358 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. #ifndef _WPROPSHT_HPP_INCLUDED
  12. #define _WPROPSHT_HPP_INCLUDED
  13.  
  14. #ifndef _WNO_PRAGMA_PUSH
  15. #pragma pack(push,4);
  16. #pragma enum int;
  17. #endif
  18.  
  19. #ifndef _WCONTROL_HPP_INCLUDED
  20. #  include "wcontrol.hpp"
  21. #endif
  22. #ifndef _WVECTOR_HPP_INCLUDED
  23. #  include "wvector.hpp"
  24. #endif
  25.  
  26. /*************************************************************************
  27.  *
  28.  * WPropertySheetItem --
  29.  *
  30.  *************************************************************************/
  31.  
  32. class WIcon;
  33. class WPropertySheet;
  34.  
  35. struct WPropertySheetEventData : public WEventData {
  36.     WInt        index;
  37. };
  38.  
  39. struct WPSDialogEventData : public WEventData {
  40.     WLong       p1;
  41.     WLong       p2;
  42. };
  43.  
  44. //
  45. // PropertySheet styles
  46. //
  47.  
  48. #define WPSSDefault             ((WStyle)0x50000000L) // WS_VISIBLE|WS_CHILD
  49.  
  50. class WCMCLASS WPropertySheetItem : public WModelessDialog {
  51.     WDeclareSubclass( WPropertySheetItem, WModelessDialog );
  52.  
  53.     friend class WModelessPropertySheet;
  54.     friend class WPropertySheet;
  55.  
  56.     public:
  57.  
  58.         /**********************************************************
  59.          * Constructors and Destructors
  60.          *********************************************************/
  61.          
  62.         WPropertySheetItem( WWindow * prt, WPropertySheet * propsht=NULL );
  63.     
  64.         ~WPropertySheetItem();
  65.     
  66.         /**********************************************************
  67.          * Properties
  68.          *********************************************************/
  69.          
  70.         /**********************************************************
  71.          * Methods
  72.          *********************************************************/
  73.          
  74.         /**********************************************************
  75.          * Overrides
  76.          *********************************************************/
  77.  
  78.         virtual WBool ProcessMessage( const WMessage & msg,
  79.                                       WLong & returns );
  80.     
  81.         virtual void * GetTargetWindowProc() const;
  82.  
  83.         /**********************************************************
  84.          * Others
  85.          *********************************************************/
  86.  
  87.         virtual int operator ==( const WPropertySheetItem & obj ) const;
  88.  
  89.         /**********************************************************
  90.          * Data members
  91.          *********************************************************/
  92.          
  93.     private:
  94.  
  95.         WModelessPropertySheet *        _parent;
  96.         char const *                    _id;
  97.         void *                          _data;
  98.         WInt                            _index;
  99. };
  100.  
  101. class WCMCLASS WPropertySheetInfo {
  102.  
  103.     public:
  104.  
  105.         /**********************************************************
  106.          * Constructors and Destructors
  107.          *********************************************************/
  108.  
  109.         WPropertySheetInfo();
  110.         WPropertySheetInfo( const WPropertySheetInfo & info );
  111.         ~WPropertySheetInfo();
  112.  
  113.         /**********************************************************
  114.          * Methods
  115.          *********************************************************/
  116.  
  117.         void Init();
  118.  
  119.         /**********************************************************
  120.          * Others
  121.          *********************************************************/
  122.  
  123.         WPropertySheetInfo& operator=( const WPropertySheetInfo & info );
  124.  
  125.  
  126.     public:
  127.  
  128.         /**********************************************************
  129.          * Data members
  130.          *********************************************************/
  131.  
  132.         WString                 text;
  133.         void *                  data;
  134.         WIcon *                 image;
  135.         WBool                   selfDeleteImage;
  136.         WPropertySheetItem *    dialog;
  137.         WBool                   selfDeleteDialog;
  138.         WResourceID *           dlgID;
  139.         WBool                   selfDeleteDialogID;
  140.         WModuleHandle *         module;
  141.         WBool                   selfDeleteModule;
  142.         WBool                   hasHelp;
  143.         WWindowHandle           handle;         // ignored by Add(),
  144.                                                 // will be set later
  145.                                                 // automatically
  146. };
  147.  
  148. enum WPropertySheetButton {
  149.     WPSBOK,
  150.     WPSBCancel,
  151.     WPSBApplyNow,
  152.     WPSBHelp
  153. };
  154.  
  155. /*************************************************************************
  156.  *
  157.  * WModelessPropertySheet -- Wrapper for the Windows 95 Property Sheet
  158.  *
  159.  *   Events:
  160.  *
  161.  *       ApplyNowOrOK --
  162.  *
  163.  *       Back --
  164.  *
  165.  *       Cancel --
  166.  *
  167.  *       Finish --
  168.  *
  169.  *       Help --
  170.  *
  171.  *       Next --
  172.  *
  173.  *       PageSelect --
  174.  *
  175.  *       PageUnselect --
  176.  *
  177.  *       QueryCancel --
  178.  *
  179.  *       QuerySibling --
  180.  *
  181.  *************************************************************************/
  182.  
  183. class WCMCLASS WModelessPropertySheet : public WControl {
  184.     WDeclareSubclass( WModelessPropertySheet, WControl );
  185.  
  186.     friend class WPropertySheetItem;
  187.  
  188.     public:
  189.  
  190.         /**********************************************************
  191.          * Constructors and destructors
  192.          *********************************************************/
  193.          
  194.         WModelessPropertySheet( WBool hasHelp=FALSE, WIcon * image=NULL,
  195.                                 char * text=NULL, WBool isPropertyTitle=FALSE,
  196.                                 WInt startItemIndex=0,
  197.                                 WPropertySheetInfo * infoArray=NULL,
  198.                                 WInt numItems=0 );
  199.     
  200.         ~WModelessPropertySheet();
  201.  
  202.         /**********************************************************
  203.          * Properties
  204.          *********************************************************/
  205.  
  206.         // Changed
  207.  
  208.         WBool SetChanged( WBool changed );
  209.  
  210.         // Count
  211.  
  212.         WInt GetCount() const;
  213.  
  214.         // Selected
  215.  
  216.         WBool SetSelected( WInt index );
  217.  
  218.         /**********************************************************
  219.          * Methods
  220.          *********************************************************/
  221.  
  222.         // Add
  223.  
  224.         WPropertySheetItem * Add( const WPropertySheetInfo & info );
  225.  
  226.         // ChangeCancelToClose
  227.  
  228.         virtual WBool ChangeCancelToClose();
  229.  
  230.         // Delete
  231.  
  232.         WBool Delete( WInt index );
  233.  
  234.         // DeleteAll
  235.  
  236.         WBool DeleteAll();
  237.  
  238.         // QuerySiblings
  239.  
  240.         WInt QuerySiblings( WLong p1, WLong p2 );
  241.  
  242.         // PressButton
  243.  
  244.         WBool PressButton( WPropertySheetButton buttonToSimulate );
  245.  
  246.         // RebootSystem
  247.  
  248.         WBool RebootSystem();
  249.  
  250.         // RestartWindows
  251.  
  252.         WBool RestartWindows();
  253.  
  254.         /**********************************************************
  255.          * Overrides
  256.          *********************************************************/
  257.  
  258.         virtual WBool SetText( const WString & text );
  259.  
  260.         virtual const WChar * InitializeClass();
  261.  
  262.         virtual WStyle GetDefaultStyle() const;
  263.  
  264.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  265.                                    void * data=NULL );
  266.  
  267.     protected:
  268.  
  269.         virtual WBool ProcessNotify( WUInt id, WNotify code, WNotifyInfo info,
  270.                                      WLong & returns );
  271.  
  272.         virtual WBool MakeWindow( WWindow * parent, WUInt id,
  273.                                   const WChar * className,
  274.                                   const WChar * title,
  275.                                   const WRect & r, WStyle wstyle,
  276.                                   WStyle exStyle, void * data=NULL );
  277.  
  278.         /**********************************************************
  279.          * Data members
  280.          *********************************************************/
  281.  
  282.     protected:
  283.  
  284.         WBool                           _isWizard;
  285.     
  286.     public:
  287.  
  288.         static char *                   _WPropertySheetClassName;
  289.  
  290.     protected:
  291.  
  292.         WULong                          _return;
  293.  
  294.     private:
  295.  
  296.         WPropertySheetInfo *            _infoArray;
  297.         WInt                            _numItems;
  298.         WBool                           _hasHelp;
  299.         WBool                           _isPropertyTitle;
  300.         WString                         _text;
  301.         WIcon *                         _image;
  302.         WInt                            _startItemIndex;
  303.         WBool                           _canRebootOrRestart;
  304.         WInt                            _currItemIndex;
  305. };
  306.  
  307. /*************************************************************************
  308.  *
  309.  * WPropertySheet -- Wrapper for the Windows 95 Property Sheet
  310.  *
  311.  *   Events:
  312.  *
  313.  *************************************************************************/
  314.  
  315. class WCMCLASS WPropertySheet : public WModelessPropertySheet {
  316.     WDeclareSubclass( WPropertySheet, WModelessPropertySheet );
  317.  
  318.     friend class WPropertySheetItem;
  319.  
  320.     public:
  321.  
  322.         /**********************************************************
  323.          * Constructors and Destructors
  324.          *********************************************************/
  325.  
  326.         WPropertySheet( WBool hasHelp=FALSE, WIcon * image=NULL,
  327.                         char * text=NULL, WBool isPropertyTitle=FALSE,
  328.                         WInt startItemIndex=0,
  329.                         WPropertySheetInfo * infoArray=NULL,
  330.                         WInt numItems=0 );
  331.     
  332.         ~WPropertySheet();
  333.  
  334.         /**********************************************************
  335.          * Properties
  336.          *********************************************************/
  337.  
  338.         // ReturnValue
  339.  
  340.         WULong GetReturnValue() const;
  341.  
  342.         /**********************************************************
  343.          * Methods
  344.          *********************************************************/
  345.  
  346.         /**********************************************************
  347.          * Other
  348.          *********************************************************/
  349.  
  350. };
  351.  
  352. #ifndef _WNO_PRAGMA_PUSH
  353. #pragma enum pop;
  354. #pragma pack(pop);
  355. #endif
  356.  
  357. #endif // _WPROPSHT_HPP_INCLUDED
  358.