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.

154 lines
5.2 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. bltctlvl.hxx
  7. This file contains the definition for the CONTROL_VALUE class.
  8. FILE HISTORY:
  9. Johnl 23-Apr-1991 Created
  10. beng 14-May-1991 Made dependent on blt.hxx for client
  11. KeithMo 23-Oct-1991 Added forward references.
  12. */
  13. #ifndef _BLT_HXX_
  14. #error "Don't include this file directly; instead, include it through blt.hxx"
  15. #endif // _BLT_HXX_
  16. #ifndef _BLTCTLVL_HXX_
  17. #define _BLTCTLVL_HXX_
  18. #include "bltevent.hxx"
  19. /* Bitfield value returns for QueryEventEffects.
  20. */
  21. #define CVMI_NO_VALUE_CHANGE 0x0000 // No control change
  22. #define CVMI_VALUE_CHANGE 0x0001 // Control has changed
  23. #define CVMI_RESTORE_ON_INACTIVE 0x0002 // Restore if control was inactive
  24. //
  25. // Forward references.
  26. //
  27. DLL_CLASS CONTROL_VALUE;
  28. DLL_CLASS CONTROL_GROUP;
  29. DLL_CLASS CUSTOM_CONTROL;
  30. /*************************************************************************
  31. NAME: CONTROL_VALUE
  32. SYNOPSIS: This class provides the basic virtual functions for objects
  33. that can be disabled (i.e., no focus or value, does *not* mean
  34. unable to receive a user's input) or restored. See BLT.DOC for
  35. a full explanation.
  36. INTERFACE:
  37. CONTROL_VALUE
  38. Constructor
  39. SaveValue() - virtual
  40. SaveValue stores the value currently contained in the
  41. control and "empties" it (i.e., an SLE would delete its
  42. contents, a listbox would remove the selection bar etc.).
  43. The boolean value passed in is TRUE if we want to make
  44. the contents invisible and FALSE otherwise.
  45. RestoreValue() - virtual
  46. RestoreValue takes the value previously saved by SaveValue
  47. and puts it back into the control. It is not valid to
  48. call RestoreValue without having first called SaveValue.
  49. The boolean value passed in is TRUE if the contents
  50. is invisible and FALSE otherwise.
  51. QueryEventEffects() - virtual
  52. Returns CVMI_VALUE_CHANGE IF this message indicates that the
  53. control has "changed" (and thus this group should be activated).
  54. Additionally, CVMI_RESTORE_ON_INACTIVE can be ored with
  55. CVMI_VALUE_CHANGE which will cause this control to be restored
  56. if it is not currently active (this is currently only done
  57. for drop down list combos where the value needs to be set when
  58. the user drops the combo down). It is not valid to return
  59. CVMI_RESTORE_ON_INACTIVE by itself (must be ored with
  60. CVMI_VALUE_CHANGE).
  61. SetControlValueFocus() - virtual
  62. Tells a CONTROL_VALUE to set the windows focus to itself. For
  63. example, CONTROL_WINDOWS set the focus to themselves, RADIO_GROUPS
  64. set the focus to the currently selected RADIO_BUTTON and
  65. MAGIC_GROUPS set the focus to their member RADIO_GROUPs.
  66. SetGroup()
  67. Sets the group of this CONTROL_VALUE to pgroupOwner. Note that
  68. you can only call this once. Calling it more then once will
  69. will cause an assertion error under debug, under retail the call
  70. will have no effect.
  71. QueryGroup()
  72. Returns a pointer to the group this control value belongs to.
  73. CAVEATS:
  74. SaveValue should not be called twice without an intervening
  75. RestoreValue (you will overwrite the contents
  76. of the first save!).
  77. NOTES:
  78. HISTORY:
  79. Johnl 23-Apr-1991 Created
  80. terryk 10-Jul-1991 Delete MAGIC_GROUP from friend.
  81. From now on, MAGIC_GROUP will call its own
  82. member functions - CVSaveValue, CVRestoreValue
  83. to restore and save the control value object.
  84. beng 04-Oct-1991 Win32 conversion
  85. **************************************************************************/
  86. DLL_CLASS CONTROL_VALUE
  87. {
  88. friend class CONTROL_GROUP;
  89. friend class CUSTOM_CONTROL;
  90. private:
  91. /* The private member _pgroupOwner keeps track of what group this
  92. * control belongs to.
  93. */
  94. CONTROL_GROUP * _pgroupOwner;
  95. protected:
  96. virtual VOID SaveValue( BOOL fInvisible = TRUE );
  97. virtual VOID RestoreValue( BOOL fInvisible = TRUE );
  98. virtual VOID SetTabStop( BOOL fTabStop = TRUE );
  99. public:
  100. CONTROL_VALUE( CONTROL_GROUP * pgroupOwner = NULL )
  101. : _pgroupOwner( pgroupOwner )
  102. { /* do nothing */; }
  103. virtual VOID SetControlValueFocus();
  104. virtual UINT QueryEventEffects( const CONTROL_EVENT & e );
  105. VOID SetGroup( CONTROL_GROUP * pgroupOwner )
  106. {
  107. ASSERTSZ( (_pgroupOwner == NULL),
  108. "CONTROL_VALUE::SetGroup - Attempting to set group twice!");
  109. if ( _pgroupOwner == NULL )
  110. _pgroupOwner = pgroupOwner;
  111. }
  112. CONTROL_GROUP * QueryGroup() const
  113. { return _pgroupOwner ; }
  114. };
  115. #endif // _BLTCTLVL_HXX_ - end of file