home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / deans.zip / DIALOG.HPP < prev    next >
Text File  |  1994-08-26  |  7KB  |  182 lines

  1. //
  2. // NAME: CIDGui_Dialog.Hpp
  3. //
  4. // DESCRIPTION:
  5. //
  6. //  This is the header for the CIDGui_Dialog.Cpp module. This module provides
  7. //  the DIALOGWND class. This class can create a modal dialog or a non-modal
  8. //  dialog that is like any other frame window, often used for creating main
  9. //  windows.
  10. //
  11. //  This class does its thing by loading the dialog template manually and
  12. //  then interpreting it. It looks at the controls defined in the template
  13. //  and creates the equivilent CIDLib control window object. For each control,
  14. //  a callout method is called, which will allow derived classes to control
  15. //  the creation of controls. If the user passed a null pointer, then a local
  16. //  method will handle it. If the user function returns a 0 for a particular
  17. //  control, the local function is called to handle it.
  18. //
  19. //  Note that the DIALOGWND class itself is of little use since the user has
  20. //  no access to the goings on inside it. The user must derive a class and
  21. //  override the _bCommand() and _bControl() methods (along with any others
  22. //  that are needed) in order to do meaningful work. In this version, the
  23. //  command messages will filter up to the default dialog proc, which will
  24. //  cause the dialog to be dismissed if it is being processed modally.
  25. //
  26. //
  27. //  The class hierarchy here is:
  28. //
  29. //              CIDOBJECT
  30. //                  │
  31. //               WINDOW
  32. //                  │
  33. //              FRAMEWND
  34. //                  │
  35. //              DIALOGWND
  36. //
  37. //
  38. // AUTHOR: Dean Roddey
  39. //
  40. // CREATE DATE: 09/24/93
  41. //
  42. // COPYRIGHT: 1992..1994, 'CIDCorp
  43. //
  44. // CAVEATS/GOTCHAS:
  45. //
  46. //  1)  The control creation callout will pass along control data for certain
  47. //      control types. A pointer and length is passed. If no control data then
  48. //      the pointer is 0 and the length is undefined. These are the classes that
  49. //      will have control data and what is in the data.
  50. //
  51. //      a)  ICONWND and BITMAPWND both get CARD4 value that contains the
  52. //          resource id of the icon or bitmap. The length is 4. Since the
  53. //          source facility cannot be indicated in the resource, this is left
  54. //          up to the creator. If the client app does not handle these
  55. //          controls, then the default is to assume the .Exe facility.
  56. //
  57. // MODIFICATION LOG:
  58. //
  59.  
  60.  
  61. // Avoid multiple inclusions
  62. #if            !defined(CIDGUI_DIALOGWND_HPP)
  63. #define        CIDGUI_DIALOGWND_HPP
  64.  
  65.  
  66.  
  67. // -----------------------------------------------------------------------------
  68. //   CLASS: DIALOGWND
  69. //  PREFIX: dlgw
  70. //
  71. //  This is the primal dialog window class. It is the basis for all dialog
  72. //  window classes.
  73. // -----------------------------------------------------------------------------
  74. class               DIALOGWND : public FRAMEWND
  75. {
  76.     public          :
  77.         // ---------------------------------------------------------------------
  78.         //  Constructors and Destructors.
  79.         //
  80.         //  DIALOGWND
  81.         //      The default constructor is protected because it should only be
  82.         //      available to derived classes. The available public constructor
  83.         //      needs the owner window, the facility that contains the dialog
  84.         //      resource, and the resource id of the dialog. The dialog
  85.         //      definition defines all of the styles and size/pos of the
  86.         //      dialog so they are not provided here.
  87.         //
  88.         //      This constructor will call the passed function, pwndMakeCtrl()
  89.         //      to create objects for all of the dialog controls.
  90.         //
  91.         //  ~DIALOGWND
  92.         //      Does any required clean up.
  93.         // ---------------------------------------------------------------------
  94.         DIALOGWND
  95.         (
  96.             const WINDOW&                   wndOwner
  97.             ,       tCIDLib::CARD4          c4RscId
  98.             , const CIDFAC&                 facSource
  99.             ,       tCIDGui::PFNMAKECTRL    pwndMakeCtrl = 0
  100.             ,       tCIDLib::eBOOL          bDefMenus = tCIDLib::eFALSE
  101.         );
  102.  
  103.         ~DIALOGWND();
  104.  
  105.  
  106.         // ---------------------------------------------------------------------
  107.         //  Public, inherited methods
  108.         //
  109.         //  FormatToStr
  110.         //      Formats some debug info into the string.
  111.         // ---------------------------------------------------------------------
  112.         STDVPUBMETHODS(DIALOGWND,FRAMEWND,tCIDLib::eFALSE);
  113.  
  114.         virtual tCIDLib::VOID FormatToStr
  115.         (
  116.                     STRGBUF&                strbDest
  117.         )   const;
  118.  
  119.  
  120.         // ---------------------------------------------------------------------
  121.         //  Public, non-virtual methods
  122.         //
  123.         //  c4Process
  124.         //      This method will process the dialog window modally. Upon
  125.         //      return the return value will be the value returned when the
  126.         //      dialog was dismissed.
  127.         //
  128.         //  Dismiss
  129.         //      This method will dismiss the dialog window, passing along the
  130.         //      return status value to the caller. It is not relevant unless
  131.         //      the dialog was processed via c4Process(). If it is called
  132.         //      when the dialog is not being modally processed, then a fatal
  133.         //      error is logged.
  134.         // ---------------------------------------------------------------------
  135.         tCIDLib::CARD4 c4Process();
  136.  
  137.         tCIDLib::VOID Dismiss
  138.         (
  139.                     tCIDLib::CARD4          c4RetStatus
  140.         );
  141.  
  142.  
  143.     protected       :
  144.         // ---------------------------------------------------------------------
  145.         //  Protected, non-virtual methods
  146.         //
  147.         //  DIALOGWND
  148.         //      The constructor is protected because it should only be
  149.         //      available to derived classes. Client apps should not be able
  150.         //      to create empty window objects.
  151.         // ---------------------------------------------------------------------
  152.         DIALOGWND() {}
  153.  
  154.  
  155.         // ---------------------------------------------------------------------
  156.         //  Protected, inherited methods
  157.         //
  158.         //  _bIsEqual
  159.         //      This method is called from the public bIsEqual, which has
  160.         //      determined that the objects are of comparable classes and are
  161.         //      not the same object. It does the comparison down the class
  162.         //      hierarchy.
  163.         // ---------------------------------------------------------------------
  164.         virtual tCIDLib::eBOOL _bIsEqual
  165.         (
  166.             const   CIDOBJECT&              objTarget
  167.         )   const;
  168.  
  169.     private         :
  170.         // ---------------------------------------------------------------------
  171.         //  Private data members
  172.         //
  173.         //  __bModalProcessing
  174.         //      Set to eTRUE by c4Process() to let anyone know later whether
  175.         //      the dialog is being modally processed. It is cleared by
  176.         //      Dismiss().
  177.         // ---------------------------------------------------------------------
  178.         tCIDLib::eBOOL          __bModalProcessing;
  179. };
  180.  
  181. #endif
  182.