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.

209 lines
7.6 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Copyright (C) 1993-1996 Microsoft Corporation. All Rights Reserved.
  3. //
  4. // MODULE: spoolui.h
  5. //
  6. // PURPOSE: Defines the spooler UI classes, prototypes, constants, etc.
  7. //
  8. #ifndef __SPOOLUI_H__
  9. #define __SPOOLUI_H__
  10. #include "spoolapi.h"
  11. #include "msident.h"
  12. class CNewsTask;
  13. /////////////////////////////////////////////////////////////////////////////
  14. // Spooler UI class
  15. //
  16. class CSpoolerDlg :
  17. public ISpoolerUI,
  18. public IIdentityChangeNotify
  19. {
  20. public:
  21. /////////////////////////////////////////////////////////////////////////
  22. // Constructor, destructor, initialization
  23. CSpoolerDlg();
  24. ~CSpoolerDlg();
  25. /////////////////////////////////////////////////////////////////////////
  26. // IUnknown Interface
  27. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *ppvObj);
  28. STDMETHOD_(ULONG, AddRef)(THIS);
  29. STDMETHOD_(ULONG, Release)(THIS);
  30. /////////////////////////////////////////////////////////////////////////
  31. // ISpoolerUI Interface
  32. STDMETHOD(Init)(HWND hwndParent);
  33. STDMETHOD(RegisterBindContext)(ISpoolerBindContext *pBindCtx);
  34. STDMETHOD(InsertEvent)(EVENTID eid, LPCSTR pszDescription,
  35. LPCWSTR pwszConnection);
  36. STDMETHOD(InsertError)(EVENTID eid, LPCSTR pszError);
  37. STDMETHOD(UpdateEventState)(EVENTID eid, INT nImage, LPCSTR pszDescription,
  38. LPCSTR pszStatus);
  39. STDMETHOD(SetProgressRange)(WORD wMax);
  40. STDMETHOD(IncrementProgress)(WORD wDelta);
  41. STDMETHOD(SetProgressPosition)(WORD wPos);
  42. STDMETHOD(SetGeneralProgress)(LPCSTR pszProgress);
  43. STDMETHOD(SetSpecificProgress)(LPCSTR pszProgress);
  44. STDMETHOD(SetAnimation)(int nAnimationId, BOOL fPlay);
  45. STDMETHOD(EnsureVisible)(EVENTID eid);
  46. STDMETHOD(ShowWindow)(int nCmdShow);
  47. STDMETHOD(GetWindow)(HWND *pHwnd);
  48. STDMETHOD(StartDelivery)(void);
  49. STDMETHOD(GoIdle)(BOOL fErrors, BOOL fShutdown, BOOL fNoSync);
  50. STDMETHOD(ClearEvents)(void);
  51. STDMETHOD(SetTaskCounts)(DWORD cSucceeded, DWORD cTotal);
  52. STDMETHOD(IsDialogMessage)(LPMSG pMsg);
  53. STDMETHOD(Close)(void);
  54. STDMETHOD(ChangeHangupOption)(BOOL fEnable, DWORD dwOption);
  55. STDMETHOD(AreThereErrors)(void);
  56. STDMETHOD(Shutdown)(void);
  57. /////////////////////////////////////////////////////////////////////////
  58. // IIdentityChangeNotify Interface
  59. virtual STDMETHODIMP QuerySwitchIdentities();
  60. virtual STDMETHODIMP SwitchIdentities();
  61. virtual STDMETHODIMP IdentityInformationChanged(DWORD dwType);
  62. /////////////////////////////////////////////////////////////////////////
  63. // Dialog message handling
  64. protected:
  65. static INT_PTR CALLBACK SpoolerDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  66. static LRESULT CALLBACK ListSubClassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  67. BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam);
  68. void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify);
  69. LRESULT OnNotify(HWND hwnd, int idFrom, LPNMHDR pnmhdr);
  70. void OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT* lpDrawItem);
  71. void OnMeasureItem(HWND hwnd, MEASUREITEMSTRUCT * lpMeasureItem);
  72. void OnDeleteItem(HWND hwnd, const DELETEITEMSTRUCT * lpDeleteItem);
  73. void OnClose(HWND hwnd);
  74. void OnDestroy(HWND hwnd);
  75. void OnContextMenu(HWND hwnd, HWND hwndContext, UINT xPos, UINT yPos);
  76. void OnTabChange(LPNMHDR pnmhdr);
  77. /////////////////////////////////////////////////////////////////////////
  78. // UI Utility functions
  79. BOOL InitializeTabs(void);
  80. BOOL InitializeLists(void);
  81. BOOL InitializeAnimation(void);
  82. BOOL InitializeToolbar(void);
  83. void ExpandCollapse(BOOL fExpand, BOOL fSetFocus=TRUE);
  84. void UpdateLists(BOOL fEvents, BOOL fErrors, BOOL fHistory);
  85. void ToggleStatics(BOOL fIdle);
  86. /////////////////////////////////////////////////////////////////////////
  87. // Class member data
  88. private:
  89. ULONG m_cRef; // Object reference count
  90. // Interfaces
  91. ISpoolerBindContext *m_pBindCtx; // Interface to communicate with the engine
  92. // Window handles
  93. HWND m_hwnd; // Handle of the primary dialog window
  94. HWND m_hwndOwner; // Handle of the window that parents the dialog
  95. HWND m_hwndEvents; // Handle of the listview which displays the event list
  96. HWND m_hwndErrors; // Handle of the listview which displays errors
  97. CRITICAL_SECTION m_cs; // Thread safety
  98. // Drawing info
  99. HIMAGELIST m_himlImages; // Images shared by the list views
  100. DWORD m_cxErrors; // Width of the error list box
  101. // State
  102. BOOL m_fTack; // TRUE if the tack is pressed
  103. BOOL m_iTab; // Which tab currently has the foreground
  104. BOOL m_fExpanded; // TRUE if the details part of the dialog is visible
  105. RECT m_rcDlg; // Size of the fully expanded dialog
  106. DWORD m_cyCollapsed; // Height of the collapsed dialog
  107. BOOL m_fIdle; // TRUE if we're in an idle state
  108. BOOL m_fErrors; // Are errors in the error box
  109. BOOL m_fShutdown; // Are we in shutdown mode
  110. BOOL m_fSaveSize; // Set to TRUE if we should persist our expanded / collapsed state
  111. // Strings
  112. TCHAR m_szCount[256];
  113. HICON m_hIcon,
  114. m_hIconSm;
  115. DWORD m_dwIdentCookie;
  116. };
  117. /////////////////////////////////////////////////////////////////////////////
  118. // Structures
  119. //
  120. typedef struct tagLBDATA
  121. {
  122. LPTSTR pszText;
  123. RECT rcText;
  124. EVENTID eid;
  125. } LBDATA;
  126. /////////////////////////////////////////////////////////////////////////////
  127. // Images
  128. //
  129. enum {
  130. IMAGE_BLANK = 0,
  131. IMAGE_TACK_IN,
  132. IMAGE_TACK_OUT,
  133. IMAGE_ERROR,
  134. IMAGE_CHECK,
  135. IMAGE_BULLET,
  136. IMAGE_EXECUTE,
  137. IMAGE_WARNING,
  138. IMAGE_MAX
  139. };
  140. #define BULLET_WIDTH 20
  141. #define BULLET_INDENT 2
  142. /////////////////////////////////////////////////////////////////////////////
  143. // Tabs on the details dialog
  144. //
  145. enum {
  146. TAB_TASKS,
  147. TAB_ERRORS,
  148. TAB_MAX
  149. };
  150. const int c_cxImage = 16;
  151. const int c_cyImage = 16;
  152. /////////////////////////////////////////////////////////////////////////////
  153. // Resource ID's
  154. //
  155. #define IDC_SP_MINIMIZE 1001
  156. #define IDC_SP_STOP 1002
  157. #define IDC_SP_DETAILS 1003
  158. #define IDC_SP_SEPARATOR 1004
  159. #define IDC_SP_ANIMATE 1006
  160. #define IDC_SP_PROGRESS_BAR 1007
  161. #define IDC_SP_GENERAL_PROG 1009
  162. #define IDC_SP_SPECIFIC_PROG 1010
  163. #define IDC_SP_TABS 1011
  164. #define IDC_SP_SKIP_TASK 1012
  165. #define IDC_SP_TACK 1015
  166. #define IDC_SP_OVERALL_STATUS 1016
  167. #define IDC_SP_EVENTS 1017
  168. #define IDC_SP_ERRORS 1018
  169. #define IDC_SP_TOOLBAR 1019
  170. #define IDC_SP_HANGUP 1020
  171. #define IDC_SP_IDLETEXT 1021
  172. #define IDC_SP_IDLEICON 1022
  173. #define IDC_SP_PROGSTAT 1023
  174. #endif // __SPOOLUI_H__