DialogToolbar.cpp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : LevelEdit *
  23. * *
  24. * $Archive:: /Commando/Code/Tools/W3DView/DialogToolbar.cpp $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 2/23/99 10:58a $*
  29. * *
  30. * $Revision:: 1 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include "StdAfx.H"
  36. #include "DialogToolbar.H"
  37. #include "AfxPriv.H"
  38. BEGIN_MESSAGE_MAP(DialogToolbarClass, CToolBar)
  39. //{{AFX_MSG_MAP(DialogToolbarClass)
  40. ON_MESSAGE(WM_IDLEUPDATECMDUI, OnIdleUpdateCmdUI)
  41. ON_MESSAGE_VOID(WM_INITIALUPDATE, OnInitialUpdate)
  42. ON_NOTIFY_EX( TTN_NEEDTEXT, 0, OnNeedToolTipText)
  43. //}}AFX_MSG_MAP
  44. END_MESSAGE_MAP()
  45. DialogToolbarClass::DialogToolbarClass (void)
  46. : CToolBar ()
  47. {
  48. //{{AFX_DATA_INIT(DialogToolbarClass)
  49. // NOTE: the ClassWizard will add member initialization here
  50. //}}AFX_DATA_INIT
  51. return ;
  52. }
  53. #ifdef _DEBUG
  54. void DialogToolbarClass::AssertValid() const
  55. {
  56. CToolBar::AssertValid();
  57. }
  58. void DialogToolbarClass::Dump(CDumpContext& dc) const
  59. {
  60. CToolBar::Dump(dc);
  61. }
  62. #endif //_DEBUG
  63. ///////////////////////////////////////////////////////////////////
  64. //
  65. // Enable_Button
  66. //
  67. void
  68. DialogToolbarClass::Enable_Button
  69. (
  70. int id,
  71. bool benable
  72. )
  73. {
  74. // Get the button's style (we enable by using a style bit)
  75. int index = CommandToIndex (id);
  76. UINT style = GetButtonStyle (index) & (~TBBS_DISABLED);
  77. // If we are disabling the button, set the
  78. // disabled style bit.
  79. if (benable == false) {
  80. style |= TBBS_DISABLED;
  81. style &= ~TBBS_PRESSED;
  82. }
  83. // If the button isn't a separator, then modify its style
  84. if (!(style & TBBS_SEPARATOR)) {
  85. SetButtonStyle (index, style);
  86. }
  87. return ;
  88. }
  89. ///////////////////////////////////////////////////////////////////
  90. //
  91. // OnIdleUpdateCmdUI
  92. //
  93. LRESULT
  94. DialogToolbarClass::OnIdleUpdateCmdUI (WPARAM, LPARAM)
  95. {
  96. return 0L;
  97. }
  98. ///////////////////////////////////////////////////////////////////
  99. //
  100. // OnInitialUpdate
  101. //
  102. void
  103. DialogToolbarClass::OnInitialUpdate (void)
  104. {
  105. return ;
  106. }
  107. ///////////////////////////////////////////////////////////////////
  108. //
  109. // OnNotify
  110. //
  111. BOOL
  112. DialogToolbarClass::OnNeedToolTipText
  113. (
  114. UINT id,
  115. NMHDR *pTTTStruct,
  116. LRESULT *pResult
  117. )
  118. {
  119. if (pTTTStruct->code == TTN_NEEDTEXTA) {
  120. TOOLTIPTEXTA *ptooltip_info = (TOOLTIPTEXTA*)pTTTStruct;
  121. ::lstrcpy (ptooltip_info->szText, "test");
  122. }
  123. (*pResult) = 0L;
  124. return TRUE;
  125. }