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.

166 lines
4.8 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Copyright (C) 1993-1996 Microsoft Corporation. All Rights Reserved.
  3. //
  4. // MODULE: statbar.h
  5. //
  6. // PURPOSE: Defines the CStatusBar class
  7. //
  8. #ifndef __STATBAR_H__
  9. #define __STATBAR_H__
  10. #include "spoolapi.h"
  11. /////////////////////////////////////////////////////////////////////////////
  12. // STATUS_BAR_PART
  13. //
  14. // Defines the different parts that are available in the status bar
  15. //
  16. typedef enum {
  17. SBP_FILTERED = 0,
  18. SBP_GENERAL,
  19. SBP_PROGRESS,
  20. SBP_CONNECTED,
  21. SBP_SPOOLER,
  22. SBP_MAX
  23. } STATUS_BAR_PART;
  24. /////////////////////////////////////////////////////////////////////////////
  25. // Initialization Flags
  26. //
  27. #define SBI_HIDE_SPOOLER 0x00000001
  28. #define SBI_HIDE_CONNECTED 0x00000002
  29. #define SBI_HIDE_FILTERED 0x00000004
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CONN_STATUS
  32. //
  33. // Parameter to SetConnectedStatus().
  34. //
  35. typedef enum {
  36. CONN_STATUS_WORKOFFLINE = 0,
  37. CONN_STATUS_CONNECTED,
  38. CONN_STATUS_DISCONNECTED,
  39. CONN_STATUS_MAX
  40. } CONN_STATUS;
  41. enum {
  42. STATUS_IMAGE_CONNECTED = 0,
  43. STATUS_IMAGE_AUTHORIZING,
  44. STATUS_IMAGE_CHECKING,
  45. STATUS_IMAGE_CHECKING_NEWS,
  46. STATUS_IMAGE_SENDING,
  47. STATUS_IMAGE_RECEIVING,
  48. STATUS_IMAGE_NOMSGS,
  49. STATUS_IMAGE_NEWMSGS,
  50. STATUS_IMAGE_ERROR,
  51. STATUS_IMAGE_DISCONNECTED,
  52. STATUS_IMAGE_OFFLINE,
  53. STATUS_IMAGE_ONLINE,
  54. STATUS_IMAGE_MAX
  55. };
  56. /////////////////////////////////////////////////////////////////////////////
  57. // IStatusBar
  58. //
  59. interface IStatusBar : public IUnknown
  60. {
  61. STDMETHOD(Initialize)(THIS_ HWND hwndParent, DWORD dwFlags) PURE;
  62. STDMETHOD(ShowStatus)(THIS_ BOOL fShow) PURE;
  63. STDMETHOD(OnSize)(THIS_ int cx, int cy) PURE;
  64. STDMETHOD(GetHeight)(THIS_ int *cy) PURE;
  65. STDMETHOD(ShowSimpleText)(THIS_ LPTSTR pszText) PURE;
  66. STDMETHOD(HideSimpleText)(THIS) PURE;
  67. STDMETHOD(SetStatusText)(THIS_ LPTSTR pszText) PURE;
  68. STDMETHOD(ShowProgress)(THIS_ DWORD dwRange) PURE;
  69. STDMETHOD(SetProgress)(THIS_ DWORD dwPos) PURE;
  70. STDMETHOD(HideProgress)(THIS) PURE;
  71. STDMETHOD(SetConnectedStatus)(THIS_ CONN_STATUS status) PURE;
  72. STDMETHOD(SetSpoolerStatus)(THIS_ DELIVERYNOTIFYTYPE type, DWORD cMsgs) PURE;
  73. STDMETHOD(OnNotify)(THIS_ NMHDR *pnmhdr) PURE;
  74. STDMETHOD(SetFilter)(THIS_ RULEID ridFilter) PURE;
  75. };
  76. #define IDC_STATUS_BAR 4000
  77. #define IDC_STATUS_PROGRESS 4001
  78. /////////////////////////////////////////////////////////////////////////////
  79. // CStatusBar
  80. //
  81. class CStatusBar : public IStatusBar
  82. {
  83. public:
  84. /////////////////////////////////////////////////////////////////////////
  85. // Constructors, Destructors, and Initialization
  86. //
  87. CStatusBar();
  88. ~CStatusBar();
  89. /////////////////////////////////////////////////////////////////////////
  90. // IUnknown
  91. //
  92. STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj);
  93. ULONG STDMETHODCALLTYPE AddRef(void);
  94. ULONG STDMETHODCALLTYPE Release(void);
  95. /////////////////////////////////////////////////////////////////////////
  96. // IStatusBar
  97. //
  98. STDMETHODIMP Initialize(HWND hwndParent, DWORD dwFlags);
  99. STDMETHODIMP ShowStatus(BOOL fShow);
  100. STDMETHODIMP OnSize(int cx, int cy);
  101. STDMETHODIMP GetHeight(int *pcy);
  102. STDMETHODIMP ShowSimpleText(LPTSTR pszText);
  103. STDMETHODIMP HideSimpleText(void);
  104. STDMETHODIMP SetStatusText(LPTSTR pszText);
  105. STDMETHODIMP ShowProgress(DWORD dwRange);
  106. STDMETHODIMP SetProgress(DWORD dwPos);
  107. STDMETHODIMP HideProgress(void);
  108. STDMETHODIMP SetConnectedStatus(CONN_STATUS status);
  109. STDMETHODIMP SetSpoolerStatus(DELIVERYNOTIFYTYPE type, DWORD cMsgs);
  110. STDMETHODIMP OnNotify(NMHDR *pnmhdr);
  111. STDMETHODIMP SetFilter(RULEID ridFilter);
  112. private:
  113. /////////////////////////////////////////////////////////////////////////
  114. // Utility Functions
  115. //
  116. void _UpdateWidths(void);
  117. HICON _GetIcon(DWORD iIndex);
  118. private:
  119. /////////////////////////////////////////////////////////////////////////
  120. // Class Data
  121. //
  122. ULONG m_cRef;
  123. HWND m_hwnd;
  124. HWND m_hwndProg;
  125. DWORD m_tidOwner;
  126. DWORD m_dwFlags;
  127. HIMAGELIST m_himl;
  128. HICON m_rgIcons[STATUS_IMAGE_MAX];
  129. // Cached width information
  130. int m_cxFiltered;
  131. int m_cxSpooler;
  132. int m_cxConnected;
  133. int m_cxProgress;
  134. // State
  135. BOOL m_fInSimple;
  136. // Cached filter info
  137. RULEID m_ridFilter;
  138. CONN_STATUS m_statusConn;
  139. DELIVERYNOTIFYTYPE m_typeDelivery;
  140. DWORD m_cMsgsDelivery;
  141. };
  142. #endif