setupGroup.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #ifndef NULLOSFT_ONLINEMEDIA_PLUGIN_SETUPGROUP_HEADER
  2. #define NULLOSFT_ONLINEMEDIA_PLUGIN_SETUPGROUP_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <wtypes.h>
  7. #include "./setupRecord.h"
  8. #include "./setupListbox.h"
  9. #include <vector>
  10. class SetupListboxLabel;
  11. class SetupLog;
  12. class SetupPage;
  13. class ifc_omstorage;
  14. class SetupGroup : public SetupListboxItem
  15. {
  16. public:
  17. typedef enum
  18. {
  19. styleDefaultUnsubscribed = 0x00000001,
  20. styleDefaultSubscribed = 0x00000002,
  21. styleSortAlphabetically = 0x00000008,
  22. styleSaveAll = 0x00000010,
  23. } GroupStyles;
  24. protected:
  25. typedef enum
  26. {
  27. flagCollapsed = 0x0001,
  28. flagMenuActive = 0x0002,
  29. flagLoading = 0x0004,
  30. } GroupFlags;
  31. protected:
  32. SetupGroup(INT groupId, LPCWSTR pszName, LPCWSTR pszAddress, const GUID *storageId, const GUID *filterId, UINT fStyle);
  33. ~SetupGroup();
  34. public:
  35. static SetupGroup *CreateInstance(INT groupId, LPCWSTR pszName, LPCWSTR pszAddress, const GUID *storageId, const GUID *filterId, UINT fStyle);
  36. public:
  37. ULONG AddRef();
  38. ULONG Release();
  39. INT GetId() { return id; }
  40. HRESULT GetName(LPWSTR pszBuffer, INT cchBufferMax);
  41. HRESULT GetLongName(LPWSTR pszBuffer, INT cchBufferMax);
  42. HRESULT GetDescription(LPWSTR pszBuffer, INT cchBufferMax);
  43. size_t GetRecordCount();
  44. SetupRecord *GetRecord(size_t index) { return list[index]; }
  45. size_t GetListboxCount();
  46. SetupListboxItem *GetListboxItem(size_t index);
  47. BOOL IsModified();
  48. BOOL IsExpanded();
  49. void SetExpanded(BOOL fExpanded);
  50. void SelectAll(SetupListbox *instance, BOOL fSelect);
  51. HRESULT RequestReload();
  52. HRESULT Save(SetupLog *log);
  53. void SetEmptyText(LPCWSTR pszText, BOOL fInvalidate);
  54. void SetLongName(LPCWSTR pszText);
  55. void SetDescription(LPCWSTR pszText);
  56. void GetColors(HDC hdc, UINT state, COLORREF *rgbBkOut, COLORREF *rgbTextOut);
  57. HBRUSH GetBrush(HDC hdc, UINT state);
  58. HRESULT SignalLoadCompleted(HANDLE event);
  59. void ValidateSelection(SetupListbox *instance);
  60. /* SetupListboxItem */
  61. BOOL MeasureItem(SetupListbox *instance, UINT *cx, UINT *cy);
  62. BOOL DrawItem(SetupListbox *instance, HDC hdc, const RECT *prc, UINT state);
  63. INT_PTR KeyToItem(SetupListbox *instance, const RECT *prcItem, INT vKey);
  64. BOOL MouseMove(SetupListbox *instance, const RECT *prcItem, UINT mouseFlags, POINT pt);
  65. BOOL MouseLeave(SetupListbox *instance, const RECT *prcItem);
  66. BOOL LButtonDown(SetupListbox *instance, const RECT *prcItem, UINT mouseFlags, POINT pt);
  67. BOOL LButtonUp(SetupListbox *instance, const RECT *prcItem, UINT mouseFlags, POINT pt);
  68. BOOL LButtonDblClk(SetupListbox *instance, const RECT *prcItem, UINT mouseFlags, POINT pt);
  69. BOOL RButtonDown(SetupListbox *instance, const RECT *prcItem, UINT mouseFlags, POINT pt);
  70. BOOL RButtonUp(SetupListbox *instance, const RECT *prcItem, UINT mouseFlags, POINT pt);
  71. void CaptureChanged(SetupListbox *instance, const RECT *prcItem, SetupListboxItem *captured);
  72. BOOL IsDisabled() { return FALSE; }
  73. void Command(SetupListbox *instance, INT commandId, INT eventId);
  74. HWND CreateDetailsView(HWND hParent);
  75. BOOL GetUniqueName(LPWSTR pszBuffer, UINT cchBufferMax);
  76. void SetError(HRESULT code) { errorCode = code; }
  77. HRESULT GetError() { return errorCode; }
  78. void Clear(BOOL fInvalidate);
  79. void SetPageWnd(HWND hPage);
  80. protected:
  81. void InvertExpanded(SetupListbox *instance);
  82. void OnLoadCompleted();
  83. private:
  84. friend static void CALLBACK SetupGroup_LoadCallback(ifc_omstorageasync *result);
  85. protected:
  86. ULONG ref;
  87. INT id;
  88. LPWSTR name;
  89. LPWSTR longName;
  90. LPWSTR description;
  91. UINT style;
  92. UINT flags;
  93. LPWSTR address;
  94. GUID storageId;
  95. GUID filterId;
  96. HRESULT errorCode;
  97. std::vector<SetupRecord*> list;
  98. SetupListboxLabel *emptyLabel;
  99. CRITICAL_SECTION lock;
  100. ifc_omstorageasync *loadResult;
  101. HWND hPage;
  102. HANDLE loadComplete;
  103. };
  104. #endif //NULLOSFT_ONLINEMEDIA_PLUGIN_SETUPGROUP_HEADER