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.

145 lines
3.8 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORPORATION, 1998
  4. *
  5. * TITLE: WIADBGUI.H
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: ShaunIv
  10. *
  11. * DATE: 5/11/1998
  12. *
  13. * DESCRIPTION: Private interfaces for the debug window
  14. *
  15. *******************************************************************************/
  16. #ifndef ___WIADBGUI_H_INCLUDED
  17. #define ___WIADBGUI_H_INCLUDED
  18. #include <windows.h>
  19. #include "wiadebug.h"
  20. #include "simreg.h"
  21. #define DEBUGWINDOW_CLASSNAMEA "WiaDebugWindow"
  22. #define DEBUGWINDOW_CLASSNAMEW L"WiaDebugWindow"
  23. #ifdef UNICODE
  24. #define DEBUGWINDOW_CLASSNAME DEBUGWINDOW_CLASSNAMEW
  25. #else
  26. #define DEBUGWINDOW_CLASSNAME DEBUGWINDOW_CLASSNAMEA
  27. #endif
  28. #define DWM_ADDSTRING (WM_USER+1)
  29. class CDebugWindowStringData
  30. {
  31. public:
  32. COLORREF m_crBackground;
  33. COLORREF m_crForeground;
  34. LPTSTR m_pszString;
  35. private:
  36. // No implementation
  37. CDebugWindowStringData(void);
  38. CDebugWindowStringData( const CDebugWindowStringData & );
  39. CDebugWindowStringData &operator=( const CDebugWindowStringData & );
  40. private:
  41. CDebugWindowStringData( LPCTSTR pszString, COLORREF crBackground, COLORREF crForeground )
  42. : m_crBackground( crBackground == DEFAULT_DEBUG_COLOR ? GetSysColor(COLOR_WINDOW) : crBackground ),
  43. m_crForeground( crForeground == DEFAULT_DEBUG_COLOR ? GetSysColor(COLOR_WINDOWTEXT) : crForeground ),
  44. m_pszString(NULL)
  45. {
  46. if (m_pszString = new TCHAR[pszString ? lstrlen(pszString)+1 : 1])
  47. {
  48. lstrcpy( m_pszString, pszString );
  49. // Get rid of any trailing newlines
  50. for (int i=lstrlen(m_pszString);i>0;i--)
  51. {
  52. if (m_pszString[i-1] == TEXT('\n'))
  53. m_pszString[i-1] = TEXT('\0');
  54. else break;
  55. }
  56. }
  57. }
  58. public:
  59. static CDebugWindowStringData *Allocate( LPCTSTR pszString, COLORREF crBackground, COLORREF crForeground )
  60. {
  61. return new CDebugWindowStringData(pszString,crBackground,crForeground);
  62. }
  63. LPTSTR String(void) const
  64. {
  65. return m_pszString;
  66. }
  67. COLORREF BackgroundColor(void) const
  68. {
  69. return m_crBackground;
  70. }
  71. COLORREF ForegroundColor(void) const
  72. {
  73. return m_crForeground;
  74. }
  75. ~CDebugWindowStringData(void)
  76. {
  77. if (m_pszString)
  78. delete[] m_pszString;
  79. }
  80. };
  81. class CWiaDebugWindow
  82. {
  83. private:
  84. // No implementation
  85. CWiaDebugWindow(void);
  86. CWiaDebugWindow( const CWiaDebugWindow & );
  87. CWiaDebugWindow &operator=( const CWiaDebugWindow & );
  88. private:
  89. // Per instance data
  90. HWND m_hWnd;
  91. CGlobalDebugState m_DebugData;
  92. HANDLE m_hDebugUiMutex;
  93. private:
  94. // Sole constructor
  95. explicit CWiaDebugWindow( HWND hWnd );
  96. // Destructor
  97. ~CWiaDebugWindow(void);
  98. private:
  99. // Message handlers
  100. LRESULT OnCreate( WPARAM, LPARAM );
  101. LRESULT OnDestroy( WPARAM, LPARAM );
  102. LRESULT OnSize( WPARAM, LPARAM );
  103. LRESULT OnMeasureItem( WPARAM, LPARAM );
  104. LRESULT OnDrawItem( WPARAM, LPARAM );
  105. LRESULT OnDeleteItem( WPARAM, LPARAM );
  106. LRESULT OnSetFocus( WPARAM, LPARAM );
  107. LRESULT OnAddString( WPARAM, LPARAM );
  108. LRESULT OnClose( WPARAM, LPARAM );
  109. LRESULT OnCommand( WPARAM, LPARAM );
  110. LRESULT OnCopyData( WPARAM, LPARAM );
  111. void OnCopy( WPARAM, LPARAM );
  112. void OnCut( WPARAM, LPARAM );
  113. void OnDelete( WPARAM, LPARAM );
  114. void OnSelectAll( WPARAM, LPARAM );
  115. void OnQuit( WPARAM, LPARAM );
  116. void OnFlags( WPARAM, LPARAM );
  117. private:
  118. CDebugWindowStringData *GetStringData( int nIndex );
  119. public:
  120. // Window Proc
  121. static LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM );
  122. // Miscellaneous
  123. static BOOL Register( HINSTANCE hInstance );
  124. };
  125. #endif // !defined(___WIADBGUI_H_INCLUDED)