Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

132 lines
4.4 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. bltdlgxp.hxx
  7. Expandable dialog class declaration.
  8. This class represents a standard BLT DIALOG_WINDOW which can
  9. be expanded once to reveal new controls. All other operations
  10. are common between EXPANDABLE_DIALOG and DIALOG_WINDOW.
  11. To construct, provide the control ID of two controls: a "boundary"
  12. static text control (SLT) and an "expand" button.
  13. The "boundary" control is declared in the resource file as 2x2
  14. units in size, containing no text, and has only the WS_CHILD style.
  15. Its location marks the lower right corner of the reduced (initial)
  16. size of the dialog. Controls lower and/or to the right of this
  17. boundary "point" are disabled until the dialog is expanded.
  18. The "expand" button is a normal two-state button which usually has
  19. a title like "Options >>" to indicate that it changes the dialog.
  20. EXPANDABLE_DIALOG handles the state transition entirely, and the
  21. "expand" button is permanently disabled after the transition. In
  22. other words, it's a one way street.
  23. The virtual method OnExpand() is called when expansion takes place;
  24. this can be overridden to initialize controls which have been
  25. heretofor invisible. It's usually necessary to override the default
  26. version of OnExpand() to set focus on whichever control you want,
  27. since the control which had focus (the expand button) is now disabled.
  28. There is one optional parameter to the constructor. It specifies a
  29. distance, in dialog units. If the ShowArea() member finds that the
  30. "boundary" control is within this distance of the real (.RC file)
  31. border of the dialog, it will use the original border. This prevents
  32. small (3-10 unit) errors caused by the inability to place a control
  33. immediately against the dialog border.
  34. FILE HISTORY:
  35. DavidHov 11/1/91 Created
  36. */
  37. #ifndef _BLTDLGXP_HXX_
  38. #define _BLTDLGXP_HXX_
  39. /*************************************************************************
  40. NAME: EXPANDABLE_DIALOG
  41. SYNOPSIS: A dialog whose initial state is small, and then expands
  42. to reveal more controls. Two controls are special:
  43. a "boundary" control which demarcates the
  44. limits of the smaller initial state, and
  45. an "expand" button which causes the dialog
  46. to grow to its full size; the button is then
  47. permanently disabled.
  48. About the "cPxBoundary" parameter: if the distance from
  49. the end of the boundary control to the edge of the dialog
  50. is LESS than this value, the size of the original dialog
  51. will be used for that dimension.
  52. INTERFACE:
  53. EXPANDABLE_DIALOG() -- constructor
  54. ~EXPANDABLE_DIALOG() -- destructor
  55. Process() -- run the dialog
  56. OnExpand() -- optional virtual routine
  57. called when the dialog is
  58. expanded. Default routine
  59. just sets focus on OK button.
  60. PARENT: DIALOG_WINDOW
  61. USES: PUSH_BUTTON, SLT
  62. CAVEATS: The expansion process is one-way; that is, the dialog
  63. cannot be shrunk. The controlling button is permanently
  64. disabled after the expansion.
  65. NOTES:
  66. HISTORY:
  67. DavidHov 10/30/91 Created
  68. **************************************************************************/
  69. DLL_CLASS EXPANDABLE_DIALOG ;
  70. #define EXP_MIN_USE_BOUNDARY 20
  71. DLL_CLASS EXPANDABLE_DIALOG : public DIALOG_WINDOW
  72. {
  73. public:
  74. EXPANDABLE_DIALOG
  75. ( const TCHAR * pszResourceName,
  76. HWND hwndOwner,
  77. CID cidBoundary,
  78. CID cidExpandButn,
  79. INT cPxBoundary = EXP_MIN_USE_BOUNDARY ) ;
  80. ~ EXPANDABLE_DIALOG () ;
  81. // Overloaded 'Process' members for reducing initial dialog extent
  82. APIERR Process ( UINT * pnRetVal = NULL ) ;
  83. APIERR Process ( BOOL * pfRetVal ) ;
  84. protected:
  85. PUSH_BUTTON _butnExpand ; // The button which bloats
  86. SLT _sltBoundary ; // The "point" marker
  87. BOOL OnCommand ( const CONTROL_EVENT & event ) ;
  88. // Virtual called when dialog is to be expanded.
  89. virtual VOID OnExpand () ;
  90. VOID ShowArea ( BOOL fFull ) ; // Change dialog size
  91. private:
  92. XYDIMENSION _xyOriginal ; // Original dlg box dimensions
  93. INT _cPxBoundary ; // Limit to force original boundary
  94. BOOL _fExpanded ; // Dialog is expanded
  95. };
  96. #endif // _BLTDLGXP_HXX_