Leaked source code of windows server 2003
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.

116 lines
2.0 KiB

  1. #ifndef _ControlID_h_
  2. #define _ControlID_h_
  3. #include <list>
  4. using namespace std;
  5. #define MAX_DIGITS 16
  6. class CControlID
  7. {
  8. public:
  9. typedef enum eTypes
  10. {
  11. EDIT,
  12. CHECK,
  13. SLIDER,
  14. COMBO,
  15. EDIT_NUM,
  16. STATIC
  17. } IDTYPE;
  18. private:
  19. UINT m_ID;
  20. HWND m_hwndCond;
  21. UINT m_condID;
  22. UINT m_staticID;
  23. IDTYPE m_type;
  24. public:
  25. CControlID( HWND hwndCond, UINT condID, UINT ID, IDTYPE type )
  26. : m_ID( ID ), m_condID( condID ), m_hwndCond( hwndCond ), m_staticID( 0 ), m_type( type )
  27. {
  28. }
  29. CControlID( UINT ID, IDTYPE type )
  30. : m_ID( ID ), m_condID( 0 ), m_hwndCond( NULL ), m_staticID( 0 ), m_type( type )
  31. {
  32. }
  33. CControlID( IDTYPE type )
  34. : m_ID( 0 ), m_condID( 0 ), m_hwndCond( NULL ), m_staticID( 0 ), m_type( type )
  35. {
  36. }
  37. inline HWND GetCondHwnd() const
  38. {
  39. return m_hwndCond;
  40. }
  41. inline UINT GetCondID() const
  42. {
  43. return m_condID;
  44. }
  45. inline UINT GetID() const
  46. {
  47. return m_ID;
  48. }
  49. inline IDTYPE GetType() const
  50. {
  51. return m_type;
  52. }
  53. inline UINT GetStaticID() const
  54. {
  55. return m_staticID;
  56. }
  57. inline void SetStaticID( UINT ID )
  58. {
  59. m_staticID = ID;
  60. }
  61. void Reset( HWND hDlg )
  62. {
  63. switch( m_type )
  64. {
  65. case STATIC:
  66. break;
  67. case EDIT:
  68. case EDIT_NUM:
  69. {
  70. SetDlgItemText( hDlg, m_ID, TEXT("") );
  71. break;
  72. }
  73. case CHECK:
  74. {
  75. Button_SetCheck( GetDlgItem( hDlg, m_ID ), FALSE );
  76. break;
  77. }
  78. case SLIDER:
  79. {
  80. HWND hwndSlide = GetDlgItem( hDlg, m_ID );
  81. LONG lVal = TrackBar_GetRangeMin( hwndSlide );
  82. TrackBar_SetPos( hwndSlide, true, lVal );
  83. TCHAR szBuff[ MAX_DIGITS ];
  84. wsprintf( szBuff, "%d", lVal );
  85. SetDlgItemText( hDlg, m_staticID, szBuff );
  86. break;
  87. }
  88. case COMBO:
  89. {
  90. ComboBox_SetCurSel( GetDlgItem( hDlg, m_ID ), 0 );
  91. break;
  92. }
  93. default:
  94. assert( 0 );
  95. break;
  96. }
  97. }
  98. };
  99. #endif