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.

825 lines
26 KiB

  1. // ARP.h
  2. //
  3. // Default position and size
  4. #define ARP_DEFAULT_POS_X 35
  5. #define ARP_DEFAULT_POS_Y 10
  6. #define ARP_DEFAULT_WIDTH 730
  7. #define ARP_DEFAULT_HEIGHT 530
  8. // Class definitions
  9. // Frame
  10. // Thread-safe API types
  11. #define ARP_SETINSTALLEDITEMCOUNT 0 // pData is count
  12. #define ARP_DECREMENTINSTALLEDITEMCOUNT 1
  13. #define ARP_INSERTINSTALLEDITEM 2 // InsertItemData struct
  14. #define ARP_INSERTPUBLISHEDITEM 3
  15. #define ARP_INSERTOCSETUPITEM 4
  16. #define ARP_SETPUBLISHEDFEEDBACKEMPTY 5
  17. #define ARP_POPULATECATEGORYCOMBO 6
  18. #define ARP_PUBLISHEDLISTCOMPLETE 7
  19. #define ARP_SETPUBLISHEDITEMCOUNT 8
  20. #define ARP_DECREMENTPUBLISHEDITEMCOUNT 9
  21. #define ARP_DONEINSERTINSTALLEDITEM 10
  22. #define WM_ARPWORKERCOMPLETE WM_USER + 1024
  23. Element* FindDescendentByName(Element* peRoot, LPCWSTR pszName);
  24. Element* GetNthChild(Element *peRoot, UINT index);
  25. // Thread-safe API structures
  26. struct InsertItemData
  27. {
  28. IInstalledApp* piia;
  29. IPublishedApp* pipa;
  30. PUBAPPINFO* ppai;
  31. COCSetupApp* pocsa;
  32. WCHAR pszTitle[MAX_PATH];
  33. WCHAR pszImage[MAX_PATH];
  34. int iIconIndex;
  35. ULONGLONG ullSize;
  36. FILETIME ftLastUsed;
  37. int iTimesUsed;
  38. DWORD dwActions;
  39. bool bSupportInfo;
  40. bool bDuplicateName;
  41. };
  42. enum SortType
  43. {
  44. SORT_NAME = 0,
  45. SORT_SIZE,
  46. SORT_TIMESUSED,
  47. SORT_LASTUSED,
  48. };
  49. class ARPClientCombo;
  50. class Expando;
  51. class Clipper;
  52. class ClientBlock;
  53. enum CLIENTFILTER {
  54. CLIENTFILTER_OEM,
  55. CLIENTFILTER_MS,
  56. CLIENTFILTER_NONMS,
  57. };
  58. class ARPSelector: public Selector
  59. {
  60. public:
  61. static HRESULT Create(OUT Element** ppElement);
  62. // Generic events
  63. virtual void OnEvent(Event* pEvent);
  64. // ClassInfo accessors (static and virtual instance-based)
  65. static IClassInfo* Class;
  66. virtual IClassInfo* GetClassInfo() { return Class; }
  67. static HRESULT Register();
  68. // Bypass Selector::OnKeyFocusMoved because Selector will change the
  69. // selection when focus changes, but we don't want that.
  70. virtual void OnKeyFocusMoved(Element *peFrom, Element *peTo) {Element::OnKeyFocusMoved(peFrom, peTo);}
  71. virtual Element *GetAdjacent(Element *peFrom, int iNavDir, NavReference const *pnr, bool bKeyable);
  72. };
  73. class ARPFrame : public HWNDElement, public Proxy
  74. {
  75. public:
  76. static HRESULT Create(OUT Element** ppElement);
  77. static HRESULT Create(NativeHWNDHost* pnhh, bool bDblBuffer, OUT Element** ppElement);
  78. // Initialize IDs and hold parser, called after contents are filled
  79. bool Setup(Parser* pParser, int uiStartPane);
  80. // Thread-safe APIs (do any additional work on callers thread and then marshal)
  81. void SetInstalledItemCount(UINT cItems);
  82. void DecrementInstalledItemCount();
  83. void SetPublishedItemCount(UINT cItems);
  84. void DecrementPublishedItemCount();
  85. void SortItemList();
  86. void SortList(int iNew, int iOld);
  87. CompareCallback GetCompareFunction();
  88. void InsertInstalledItem(IInstalledApp* piia);
  89. void InsertPublishedItem(IPublishedApp* pipa, bool bDuplicateName);
  90. void InsertOCSetupItem(COCSetupApp* pocsa);
  91. void PopulateCategoryCombobox();
  92. SHELLAPPCATEGORYLIST* GetShellAppCategoryList() {return _psacl;}
  93. void SetShellAppCategoryList(SHELLAPPCATEGORYLIST* psacl) {_psacl = psacl;}
  94. LPCWSTR GetCurrentPublishedCategory();
  95. void FeedbackEmptyPublishedList();
  96. void DirtyPublishedListFlag();
  97. void DirtyInstalledListFlag();
  98. void RePopulateOCSetupItemList();
  99. bool OnClose(); // return 0 to fail
  100. // Generic events
  101. virtual void OnEvent(Event* pEvent);
  102. //
  103. // NTRAID#NTBUG9-314154-2001/3/12-brianau Handle Refresh
  104. //
  105. // Need to finish this for Whistler.
  106. //
  107. virtual void OnInput(InputEvent *pEvent);
  108. //
  109. virtual void OnKeyFocusMoved(Element* peFrom, Element* peTo);
  110. void OnPublishedListComplete();
  111. virtual void RestoreKeyFocus() { if(peLastFocused) peLastFocused->SetKeyFocus();}
  112. virtual bool CanSetFocus();
  113. bool GetPublishedComboFilled() {return _bPublishedComboFilled;}
  114. void SetPublishedComboFilled(bool bPublishedComboFilled) {_bPublishedComboFilled = bPublishedComboFilled;}
  115. bool GetPublishedListFilled () {return _bPublishedListFilled;}
  116. void SetPublishedListFilled (bool bPublishedListFilled) {_bPublishedListFilled = bPublishedListFilled;}
  117. bool IsChangeRestricted();
  118. virtual SetModalMode(bool ModalMode) { _bInModalMode = ModalMode;}
  119. HWND GetHostWindow() {if (_pnhh) return _pnhh->GetHWND(); return NULL;}
  120. void SelectInstalledApp(IInstalledApp* piia);
  121. void SelectClosestApp(IInstalledApp* piia);
  122. void UpdateInstalledItems();
  123. void RunOCManager();
  124. void ChangePane(Element *pePane);
  125. void PutFocusOnList(Selector* peList);
  126. // If all else fails, focus goes to the Places pane
  127. Element* FallbackFocus() { return _peOptionList->GetSelection(); }
  128. HRESULT InitClientCombos(Expando* pexParent, CLIENTFILTER cf);
  129. HRESULT CreateStyleParser(Parser** ppParser);
  130. Parser* GetStyleParser() { return _pParserStyle; }
  131. HRESULT CreateElement(LPCWSTR pszResID, Element* peSubstitute, OUT Element** ppElement)
  132. {
  133. return _pParser->CreateElement(pszResID, peSubstitute, ppElement);
  134. }
  135. virtual LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  136. // We allocate zero-initialized so you don't need to set things to 0.
  137. ARPFrame() {_bInDomain = true; _curCategory = CB_ERR; }
  138. virtual ~ARPFrame();
  139. HRESULT Initialize(NativeHWNDHost* pnhh, bool fDlbBuffer);
  140. // Callee thread-safe invoke sink
  141. virtual void OnInvoke(UINT nType, void* pData);
  142. // HACK! The value of 350ms is hard-coded here and in DirectUI
  143. void ManageAnimations();
  144. bool IsFrameAnimationEnabled() { return _bAnimationEnabled; }
  145. int GetAnimationTime() { return IsFrameAnimationEnabled() ? 350 : 0; }
  146. ClientBlock* FindClientBlock(LPCWSTR pwszType);
  147. HRESULT LaunchClientCommandAndWait(UINT ids, LPCTSTR pszName, LPTSTR pszCommand);
  148. void InitProgressDialog();
  149. void SetProgressFakeMode(bool bFake) { _bFakeProgress = bFake; }
  150. void SetProgressDialogText(UINT ids, LPCTSTR pszName);
  151. void EndProgressDialog();
  152. // Managing the OK button.
  153. void BlockOKButton()
  154. {
  155. if (++_cBlockOK == 1) {
  156. _peOK->SetEnabled(false);
  157. }
  158. }
  159. void UnblockOKButton()
  160. {
  161. if (--_cBlockOK == 0) {
  162. _peOK->SetEnabled(true);
  163. }
  164. }
  165. private:
  166. NativeHWNDHost* _pnhh;
  167. // ARP parser (tree resources)
  168. Parser* _pParser;
  169. // ARP parser for styles (multiple UI files available for different looks)
  170. Parser* _pParserStyle;
  171. BOOL _fThemedStyle;
  172. HANDLE _arH[LASTHTHEME+1];
  173. // ARP frame option list (navigation bar)
  174. ARPSelector* _peOptionList;
  175. // ARP installed item list
  176. Selector* _peInstalledItemList;
  177. HDSA _hdsaInstalledItems;
  178. int _cMaxInstalledItems;
  179. // ARP published item list
  180. Selector* _pePublishedItemList;
  181. HDSA _hdsaPublishedItems;
  182. int _cMaxPublishedItems;
  183. // ARP OC Setup item list
  184. Selector* _peOCSetupItemList;
  185. // ARP Current item list
  186. Selector* _peCurrentItemList;
  187. // ARP Sort by Combobox
  188. Combobox* _peSortCombo;
  189. SHELLAPPCATEGORYLIST* _psacl;
  190. // ARP Published Category Combobox
  191. Combobox* _pePublishedCategory;
  192. Element* _pePublishedCategoryLabel;
  193. int _curCategory;
  194. Element* peFloater;
  195. Element* peLastFocused;
  196. // ARP "customization block" element
  197. ARPSelector* _peClientTypeList; // The outer selector
  198. Expando* _peOEMClients; // The four "big switches"
  199. Expando* _peMSClients;
  200. Expando* _peNonMSClients;
  201. Expando* _peCustomClients;
  202. Element* _peOK; // How to get out
  203. Element* _peCancel;
  204. // ARP Panes
  205. Element* _peChangePane;
  206. Element* _peAddNewPane;
  207. Element* _peAddRmWinPane;
  208. Element* _pePickAppPane;
  209. // Number of items blocking the OK button from being enabled
  210. // (If this is 0, then OK is enabled)
  211. int _cBlockOK;
  212. // ARP Current Sort Type
  213. SortType CurrentSortType;
  214. bool _bTerminalServer;
  215. bool _bPublishedListFilled;
  216. bool _bInstalledListFilled;
  217. bool _bOCSetupListFilled;
  218. bool _bPublishedComboFilled;
  219. bool _bDoubleBuffer;
  220. bool _bInModalMode;
  221. bool _bSupportInfoRestricted;
  222. bool _bOCSetupNeeded;
  223. bool _bInDomain;
  224. bool _bAnimationEnabled;
  225. bool _bPickAppInitialized;
  226. bool _bFakeProgress;
  227. UINT _uiStartPane;
  228. class ARPHelp* _pah;
  229. IProgressDialog* _ppd;
  230. DWORD _dwProgressTotal;
  231. DWORD _dwProgressSoFar;
  232. bool ShowSupportInfo(APPINFODATA *paid);
  233. void PrepareSupportInfo(Element* peHelp, APPINFODATA *paid);
  234. void RePopulatePublishedItemList();
  235. // Check for policies, apply as needed.
  236. void ApplyPolices();
  237. public:
  238. // ARPFrame IDs (for identifying targets of events)
  239. static ATOM _idChange;
  240. static ATOM _idAddNew;
  241. static ATOM _idAddRmWin;
  242. static ATOM _idClose;
  243. static ATOM _idAddFromDisk;
  244. static ATOM _idAddFromMsft;
  245. static ATOM _idComponents;
  246. static ATOM _idSortCombo;
  247. static ATOM _idCategoryCombo;
  248. static ATOM _idAddFromCDPane;
  249. static ATOM _idAddFromMSPane;
  250. static ATOM _idAddFromNetworkPane;
  251. static ATOM _idAddWinComponent;
  252. static ATOM _idPickApps;
  253. static ATOM _idOptionList;
  254. // Helper thread handles
  255. static HANDLE htPopulateInstalledItemList;
  256. static HANDLE htPopulateAndRenderOCSetupItemList;
  257. static HANDLE htPopulateAndRenderPublishedItemList;
  258. // ClassInfo accessors (static and virtual instance-based)
  259. static IClassInfo* Class;
  260. virtual IClassInfo* GetClassInfo() { return Class; }
  261. static HRESULT Register();
  262. };
  263. // Item
  264. class ARPItem : public Button
  265. {
  266. public:
  267. static HRESULT Create(OUT Element** ppElement);
  268. // Generic events
  269. virtual void OnEvent(Event* pEvent);
  270. // System events
  271. virtual void OnPropertyChanged(PropertyInfo* ppi, int iIndex, Value* pvOld, Value* pvNew);
  272. // ClassInfo accessors (static and virtual instance-based)
  273. static IClassInfo* Class;
  274. virtual IClassInfo* GetClassInfo() { return Class; }
  275. static HRESULT Register();
  276. void SortBy(int iNew, int iOld);
  277. // ARP item IDs
  278. static ATOM _idTitle;
  279. static ATOM _idIcon;
  280. static ATOM _idSize;
  281. static ATOM _idFreq;
  282. static ATOM _idLastUsed;
  283. static ATOM _idExInfo;
  284. static ATOM _idInstalled;
  285. static ATOM _idChgRm;
  286. static ATOM _idChg;
  287. static ATOM _idRm;
  288. static ATOM _idAdd;
  289. static ATOM _idConfigure;
  290. static ATOM _idSupInfo;
  291. static ATOM _idItemAction;
  292. static ATOM _idRow[3];
  293. IInstalledApp* _piia;
  294. IPublishedApp* _pipa;
  295. PUBAPPINFO* _ppai;
  296. COCSetupApp* _pocsa;
  297. ARPFrame* _paf;
  298. UINT _iTimesUsed;
  299. FILETIME _ftLastUsed;
  300. ULONGLONG _ullSize;
  301. UINT _iIdx;
  302. ARPItem() { _piia = NULL; _pipa = NULL; _ppai = NULL; _paf = NULL; _pocsa = NULL;}
  303. virtual ~ARPItem();
  304. HRESULT Initialize();
  305. void ShowInstalledString(BOOL bInstalled);
  306. };
  307. // Help box
  308. class ARPHelp : public HWNDElement, public Proxy
  309. {
  310. public:
  311. static HRESULT Create(OUT Element** ppElement);
  312. static HRESULT Create(NativeHWNDHost* pnhh, ARPFrame* paf, bool bDblBuffer, OUT Element** ppElement);
  313. NativeHWNDHost* GetHost() {return _pnhh;}
  314. virtual void OnDestroy();
  315. // Generic events
  316. virtual void OnEvent(Event* pEvent);
  317. void ARPHelp::SetDefaultFocus();
  318. // ClassInfo accessors (static and virtual instance-based)
  319. static IClassInfo* Class;
  320. virtual IClassInfo* GetClassInfo() { return Class; }
  321. static HRESULT Register();
  322. IInstalledApp* _piia;
  323. ARPHelp() {_paf = NULL;}
  324. virtual ~ARPHelp();
  325. HRESULT Initialize(NativeHWNDHost* pnhh, ARPFrame* paf, bool bDblBuffer);
  326. private:
  327. NativeHWNDHost* _pnhh;
  328. ARPFrame* _paf;
  329. HRESULT Initialize();
  330. };
  331. class ARPSupportItem : public Element
  332. {
  333. public:
  334. static HRESULT Create(OUT Element** ppElement);
  335. // System events
  336. virtual void OnPropertyChanged(PropertyInfo* ppi, int iIndex, Value* pvOld, Value* pvNew);
  337. // Generic events
  338. virtual void OnEvent(Event* pEvent);
  339. // Property definitions
  340. static PropertyInfo* URLProp;
  341. // Quick property accessors
  342. const LPWSTR GetURL(Value** ppv) DUIQuickGetterInd(GetString(), URL, Specified)
  343. HRESULT SetURL(LPCWSTR v) DUIQuickSetter(CreateString(v), URL)
  344. // ClassInfo accessors (static and virtual instance-based)
  345. static IClassInfo* Class;
  346. virtual IClassInfo* GetClassInfo() { return Class; }
  347. static HRESULT Register();
  348. IInstalledApp* _piia;
  349. ARPSupportItem() { }
  350. virtual ~ARPSupportItem() { }
  351. HRESULT Initialize();
  352. private:
  353. Element* GetChild(UINT index);
  354. };
  355. class CLIENTINFO
  356. {
  357. public:
  358. static CLIENTINFO* Create(HKEY hkApp, HKEY hkInfo, LPCWSTR pszKey);
  359. void Delete() { HDelete(this); }
  360. static int __cdecl QSortCMP(const void*, const void*);
  361. bool IsSentinel() { return _pszKey == NULL; }
  362. bool IsKeepUnchanged() { return IsSentinel() && _pe; }
  363. bool IsPickFromList() { DUIAssertNoMsg(_pe || IsSentinel()); return !_pe; }
  364. void SetFriendlyName(LPCWSTR pszName)
  365. {
  366. FindDescendentByName(_pe, L"radiotext")->SetContentString(pszName);
  367. FindDescendentByName(_pe, L"setdefault")->SetAccName(pszName);
  368. }
  369. void SetMSName(LPCWSTR pszMSName);
  370. LPCWSTR GetFilteredName(CLIENTFILTER cf)
  371. {
  372. LPCWSTR pszName = _pszName;
  373. if (cf == CLIENTFILTER_MS && _pvMSName && _pvMSName->GetString())
  374. {
  375. pszName = _pvMSName->GetString();
  376. }
  377. return pszName;
  378. }
  379. Element* GetSetDefault()
  380. {
  381. return FindDescendentByName(_pe, L"setdefault");
  382. }
  383. Element* GetShowCheckbox()
  384. {
  385. return FindDescendentByName(_pe, L"show");
  386. }
  387. HRESULT SetShowCheckbox(bool bShow)
  388. {
  389. return GetShowCheckbox()->SetSelected(bShow);
  390. }
  391. bool IsShowChecked()
  392. {
  393. return GetShowCheckbox()->GetSelected();
  394. }
  395. bool GetInstallFile(HKEY hkInfo, LPCTSTR pszValue, LPTSTR pszBuf, UINT cchBuf, bool fFile);
  396. bool GetInstallCommand(HKEY hkInfo, LPCTSTR pszValue, LPTSTR pszBuf, UINT cchBuf);
  397. public:
  398. ~CLIENTINFO(); // to be used only by HDelete()
  399. private:
  400. bool Initialize(HKEY hkApp, HKEY hkInfo, LPCWSTR pszKey);
  401. public:
  402. LPWSTR _pszKey;
  403. LPWSTR _pszName;
  404. Value * _pvMSName;
  405. Element*_pe;
  406. bool _bShown; // Actual show/hide state
  407. bool _bOEMDefault; // Is this the OEM default client?
  408. TRIBIT _tOEMShown; // OEM desired show/hide state
  409. };
  410. class StringList
  411. {
  412. public:
  413. StringList() { DUIAssertNoMsg(_pdaStrings == NULL && _pszBuf == NULL); }
  414. HRESULT SetStringList(LPCTSTR pszInit); // semicolon-separated list
  415. void Reset();
  416. ~StringList() { Reset(); }
  417. bool IsStringInList(LPCTSTR pszFind);
  418. private:
  419. DynamicArray<LPTSTR>* _pdaStrings;
  420. LPTSTR _pszBuf;
  421. };
  422. class ClientPicker: public Element
  423. {
  424. typedef Element super; // name for our superclass
  425. public:
  426. static HRESULT Create(OUT Element** ppElement);
  427. // overrides
  428. virtual ~ClientPicker();
  429. HRESULT Initialize();
  430. // Property definitions
  431. static PropertyInfo* ClientTypeProp;
  432. static PropertyInfo* ParentExpandedProp;
  433. // Quick property accessors
  434. const LPWSTR GetClientTypeString(Value** ppv) { return (*ppv = GetValue(ClientTypeProp, PI_Specified))->GetString(); }
  435. HRESULT SetClientTypeString(LPCWSTR v) DUIQuickSetter(CreateString(v), ClientType)
  436. bool GetParentExpanded() DUIQuickGetter(bool, GetBool(), ParentExpanded, Specified)
  437. HRESULT SetParentExpanded(bool v) DUIQuickSetter(CreateBool(v), ParentExpanded)
  438. // System events
  439. virtual void OnEvent(Event* pEvent);
  440. virtual void OnPropertyChanged(PropertyInfo* ppi, int iIndex, Value* pvOld, Value* pvNew);
  441. // ClassInfo accessors (static and virtual instance-based)
  442. static IClassInfo* Class;
  443. virtual IClassInfo* GetClassInfo() { return Class; }
  444. static HRESULT Register();
  445. // Customization
  446. CLIENTFILTER GetFilter() { return _cf; }
  447. HRESULT SetFilter(CLIENTFILTER cf, ARPFrame* paf);
  448. HRESULT TransferToCustom();
  449. // to be used by ClientBlock::InitializeClientPicker
  450. DynamicArray<CLIENTINFO*>* GetClientList() { return _pdaClients; }
  451. void AddClientToOEMRow(LPCWSTR pszName, CLIENTINFO* pci);
  452. HRESULT AddKeepUnchanged(CLIENTINFO* pciKeepUnchanged);
  453. void SetNotEmpty() { _bEmpty = false; }
  454. // to be used by SetFilterCB
  455. bool IsEmpty() { return _bEmpty; }
  456. // to be used by ClientBlock::TransferFromClientPicker
  457. CLIENTINFO* GetSelectedClient();
  458. // to be used by ARPFrame when metrics change
  459. void CalculateWidth();
  460. private:
  461. static void CALLBACK s_DelayShowCombo(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
  462. void _DelayShowCombo();
  463. void _CancelDelayShowCombo();
  464. bool _NeedsCombo() { return GetClientList()->GetSize() > 1; }
  465. void _SyncUIActive();
  466. void _SetStaticText(LPCWSTR pszText);
  467. void _CheckBlockOK(bool bSelected);
  468. private:
  469. int _iSel;
  470. CLIENTFILTER _cf;
  471. bool _bFilledCombo;
  472. bool _bEmpty;
  473. bool _bUIActive;
  474. bool _bBlockedOK; // did I block the OK button?
  475. HWND _hwndHost;
  476. DynamicArray<CLIENTINFO*>*_pdaClients;
  477. Element* _peStatic;
  478. Combobox* _peCombo;
  479. ClientBlock* _pcb; // associated client block
  480. public: // manipulated from ClientBlock
  481. Element* _peShowHide;
  482. };
  483. class ClientBlock : public Element
  484. {
  485. typedef Element super; // name for our superclass
  486. public:
  487. static HRESULT Create(OUT Element** ppElement);
  488. // Property definitions
  489. static PropertyInfo* ClientTypeProp;
  490. static PropertyInfo* WindowsClientProp;
  491. static PropertyInfo* OtherMSClientsProp;
  492. static PropertyInfo* KeepTextProp;
  493. static PropertyInfo* KeepMSTextProp;
  494. static PropertyInfo* PickTextProp;
  495. // Quick property accessors
  496. const LPWSTR GetClientTypeString(Value** ppv) DUIQuickGetterInd(GetString(), ClientType, Specified)
  497. HRESULT SetClientTypeString(LPCWSTR v) DUIQuickSetter(CreateString(v), ClientType)
  498. const LPWSTR GetWindowsClientString(Value** ppv) DUIQuickGetterInd(GetString(), WindowsClient, Specified)
  499. HRESULT SetWindowsClientString(LPCWSTR v) DUIQuickSetter(CreateString(v), WindowsClient)
  500. const LPWSTR GetOtherMSClientsString(Value** ppv) DUIQuickGetterInd(GetString(), OtherMSClients, Specified)
  501. HRESULT SetOtherMSClientsString(LPCWSTR v) DUIQuickSetter(CreateString(v), OtherMSClients)
  502. const LPWSTR GetKeepTextString(Value** ppv) DUIQuickGetterInd(GetString(), KeepText, Specified)
  503. HRESULT SetKeepTextString(LPCWSTR v) DUIQuickSetter(CreateString(v), KeepText)
  504. const LPWSTR GetKeepMSTextString(Value** ppv) DUIQuickGetterInd(GetString(), KeepMSText, Specified)
  505. HRESULT SetKeepMSTextString(LPCWSTR v) DUIQuickSetter(CreateString(v), KeepMSText)
  506. const LPWSTR GetPickTextString(Value** ppv) DUIQuickGetterInd(GetString(), PickText, Specified)
  507. HRESULT SetPickTextString(LPCWSTR v) DUIQuickSetter(CreateString(v), PickText)
  508. // Generic events
  509. virtual void OnEvent(Event* pEvent);
  510. // ClassInfo accessors (static and virtual instance-based)
  511. static IClassInfo* Class;
  512. virtual IClassInfo* GetClassInfo() { return Class; }
  513. static HRESULT Register();
  514. // overrides
  515. HRESULT Initialize();
  516. ~ClientBlock();
  517. // post-parse initialization
  518. HRESULT ParseCompleted(ARPFrame* paf);
  519. HRESULT AddStaticClientInfoToTop(PropertyInfo* ppi);
  520. HRESULT InitializeClientPicker(ClientPicker* pcp);
  521. HRESULT TransferFromClientPicker(ClientPicker* pcp);
  522. // doing actual work
  523. HRESULT Apply(ARPFrame* paf);
  524. private:
  525. void _EnableShowCheckbox(Element* peRadio, bool fEnable);
  526. enum CBTIER { // clients fall into one of these three tiers
  527. CBT_NONMS, // third-party client
  528. CBT_MS, // Microsoft client but not Windows default
  529. CBT_WINDOWSDEFAULT, // Windows default client
  530. };
  531. inline bool IsThirdPartyClient(CBTIER cbt) { return cbt == CBT_NONMS; }
  532. inline bool IsMicrosoftClient(CBTIER cbt) { return cbt >= CBT_MS; }
  533. inline bool IsWindowsDefaultClient(CBTIER cbt) { return cbt == CBT_WINDOWSDEFAULT; }
  534. CBTIER _GetClientTier(LPCTSTR pszClient);
  535. TRIBIT _GetFilterShowAdd(CLIENTINFO* pci, ClientPicker* pcp, bool* pbAdd);
  536. HKEY _OpenClientKey(HKEY hkRoot = HKEY_LOCAL_MACHINE, DWORD dwAccess = KEY_READ);
  537. bool _GetDefaultClient(HKEY hkClient, HKEY hkRoot, LPTSTR pszBuf, LONG cchBuf);
  538. bool _IsCurrentClientNonWindowsMS();
  539. void _RemoveEmptyOEMRow(Element* peShowHide, LPCWSTR pszName);
  540. private:
  541. DynamicArray<CLIENTINFO*>* _pdaClients;
  542. StringList _slOtherMSClients;
  543. Selector* _peSel;
  544. };
  545. class Expandable : public Element
  546. {
  547. typedef Element super; // name for our superclass
  548. public:
  549. static HRESULT Create(OUT Element** ppElement);
  550. // Everything inherits from Element; we just have a new property
  551. // Property definitions
  552. static PropertyInfo* ExpandedProp;
  553. // Quick property accessors
  554. bool GetExpanded() DUIQuickGetter(bool, GetBool(), Expanded, Specified)
  555. HRESULT SetExpanded(bool v) DUIQuickSetter(CreateBool(v), Expanded)
  556. // ClassInfo accessors (static and virtual instance-based)
  557. static IClassInfo* Class;
  558. virtual IClassInfo* GetClassInfo() { return Class; }
  559. static HRESULT Register();
  560. };
  561. class Expando : public Expandable
  562. {
  563. typedef Expandable super; // name for our superclass
  564. public:
  565. static HRESULT Create(OUT Element** ppElement);
  566. // Generic events
  567. virtual void OnEvent(Event* pEvent);
  568. // System events
  569. virtual void OnPropertyChanged(PropertyInfo* ppi, int iIndex, Value* pvOld, Value* pvNew);
  570. // Event types
  571. static UID Click; // no parameters
  572. // ClassInfo accessors (static and virtual instance-based)
  573. static IClassInfo* Class;
  574. virtual IClassInfo* GetClassInfo() { return Class; }
  575. static HRESULT Register();
  576. HRESULT Initialize();
  577. Clipper* GetClipper();
  578. private:
  579. void FireClickEvent();
  580. private:
  581. bool _fExpanding;
  582. };
  583. class Clipper: public Expandable
  584. {
  585. typedef Expandable super; // name for our superclass
  586. public:
  587. static HRESULT Create(OUT Element** ppElement);
  588. // Self-layout methods
  589. void _SelfLayoutDoLayout(int dWidth, int dHeight);
  590. SIZE _SelfLayoutUpdateDesiredSize(int dConstW, int dConstH, Surface* psrf);
  591. // ClassInfo accessors (static and virtual instance-based)
  592. static IClassInfo* Class;
  593. virtual IClassInfo* GetClassInfo() { return Class; }
  594. static HRESULT Register();
  595. HRESULT Initialize();
  596. private:
  597. };
  598. class AutoButton : public Button
  599. {
  600. typedef Button super; // name for our superclass
  601. public:
  602. static HRESULT Create(OUT Element** ppElement);
  603. // Generic events
  604. virtual void OnEvent(Event* pEvent);
  605. // System events
  606. virtual void OnPropertyChanged(PropertyInfo* ppi, int iIndex, Value* pvOld, Value* pvNew);
  607. // ClassInfo accessors (static and virtual instance-based)
  608. static IClassInfo* Class;
  609. virtual IClassInfo* GetClassInfo() { return Class; }
  610. static HRESULT Register();
  611. // misc public stuff
  612. void SyncDefAction();
  613. private:
  614. };
  615. class GradientLine : public Element
  616. {
  617. typedef Element super; // name for our superclass
  618. public:
  619. static HRESULT Create(OUT Element** ppElement);
  620. // Everything inherits from Element
  621. // We use the foreground as the center color
  622. // and the background as the edge color
  623. // Rendering callbacks
  624. void Paint(HDC hDC, const RECT* prcBounds, const RECT* prcInvalid, RECT* prcSkipBorder, RECT* prcSkipContent);
  625. // ClassInfo accessors (static and virtual instance-based)
  626. static IClassInfo* Class;
  627. virtual IClassInfo* GetClassInfo() { return Class; }
  628. static HRESULT Register();
  629. private:
  630. COLORREF GetColorProperty(PropertyInfo* ppi);
  631. };
  632. class BigElement : public Element
  633. {
  634. typedef Element super; // name for our superclass
  635. public:
  636. static HRESULT Create(OUT Element** ppElement);
  637. // Everything inherits from Element; we just have a new property
  638. // Property definitions
  639. static PropertyInfo* StringResIDProp;
  640. // Quick property accessors
  641. int GetStringResID() DUIQuickGetter(int, GetInt(), StringResID, Specified)
  642. HRESULT SetStringResID(int ids) DUIQuickSetter(CreateInt(ids), StringResID)
  643. // System events
  644. virtual void OnPropertyChanged(PropertyInfo* ppi, int iIndex, Value* pvOld, Value* pvNew);
  645. // ClassInfo accessors (static and virtual instance-based)
  646. static IClassInfo* Class;
  647. virtual IClassInfo* GetClassInfo() { return Class; }
  648. static HRESULT Register();
  649. };
  650. class ARPParser : public Parser
  651. {
  652. public:
  653. static HRESULT Create(ARPFrame* paf, UINT uRCID, HINSTANCE hInst, PPARSEERRORCB pfnErrorCB, OUT Parser** ppParser);
  654. HRESULT Initialize(ARPFrame* paf, UINT uRCID, HINSTANCE hInst, PPARSEERRORCB pfnErrorCB);
  655. virtual Value* GetSheet(LPCWSTR pszResID);
  656. private:
  657. ARPFrame* _paf;
  658. HANDLE _arH[2];
  659. };