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.

1008 lines
24 KiB

  1. //
  2. // nuibase.cpp
  3. //
  4. #include "private.h"
  5. #include "nuibase.h"
  6. #include "helpers.h"
  7. #define NUIBASE_ITEMSINK_COOKIE 0x80000001
  8. //////////////////////////////////////////////////////////////////////////////
  9. //
  10. // CLBarItemBase
  11. //
  12. //////////////////////////////////////////////////////////////////////////////
  13. //+---------------------------------------------------------------------------
  14. //
  15. // ctor
  16. //
  17. //----------------------------------------------------------------------------
  18. CLBarItemBase::CLBarItemBase()
  19. {
  20. _dwStatus = 0;
  21. _szToolTip[0] = L'\0';
  22. _cRef = 1;
  23. }
  24. //+---------------------------------------------------------------------------
  25. //
  26. // dtor
  27. //
  28. //----------------------------------------------------------------------------
  29. CLBarItemBase::~CLBarItemBase()
  30. {
  31. SafeRelease(_plbiSink);
  32. }
  33. //+---------------------------------------------------------------------------
  34. //
  35. // InitNuiInfo
  36. //
  37. //----------------------------------------------------------------------------
  38. void CLBarItemBase::InitNuiInfo(REFCLSID rclsid,
  39. REFGUID rguid,
  40. DWORD dwStyle,
  41. ULONG ulSort,
  42. WCHAR *pszDesc)
  43. {
  44. // init nuiInfo.
  45. _lbiInfo.clsidService = rclsid;
  46. _lbiInfo.guidItem = rguid;
  47. _lbiInfo.dwStyle = dwStyle;
  48. _lbiInfo.ulSort = ulSort;
  49. wcsncpy(_lbiInfo.szDescription, pszDesc, ARRAYSIZE(_lbiInfo.szDescription));
  50. }
  51. //+---------------------------------------------------------------------------
  52. //
  53. // GetType
  54. //
  55. //----------------------------------------------------------------------------
  56. STDAPI CLBarItemBase::GetInfo(TF_LANGBARITEMINFO *pInfo)
  57. {
  58. *pInfo = _lbiInfo;
  59. return S_OK;
  60. }
  61. //+---------------------------------------------------------------------------
  62. //
  63. // GetStatus
  64. //
  65. //----------------------------------------------------------------------------
  66. STDAPI CLBarItemBase::GetStatus(DWORD *pdw)
  67. {
  68. *pdw = _dwStatus;
  69. return S_OK;
  70. }
  71. //+---------------------------------------------------------------------------
  72. //
  73. // Show
  74. //
  75. //----------------------------------------------------------------------------
  76. STDAPI CLBarItemBase::Show(BOOL fShow)
  77. {
  78. return ShowInternal(fShow, TRUE);
  79. }
  80. //+---------------------------------------------------------------------------
  81. //
  82. // GetTooltipString
  83. //
  84. //----------------------------------------------------------------------------
  85. STDAPI CLBarItemBase::GetTooltipString(BSTR *pbstrToolTip)
  86. {
  87. if (!pbstrToolTip)
  88. return E_INVALIDARG;
  89. *pbstrToolTip = SysAllocString(_szToolTip);
  90. if (*pbstrToolTip)
  91. return S_OK;
  92. else
  93. return E_OUTOFMEMORY;
  94. }
  95. //+---------------------------------------------------------------------------
  96. //
  97. // AdviseSink
  98. //
  99. //----------------------------------------------------------------------------
  100. HRESULT CLBarItemBase::AdviseSink(REFIID riid, IUnknown *punk, DWORD *pdwCookie)
  101. {
  102. HRESULT hr;
  103. if (IsEqualIID(IID_ITfLangBarItemSink, riid))
  104. {
  105. if (_plbiSink)
  106. hr = CONNECT_E_CANNOTCONNECT;
  107. else
  108. {
  109. hr = punk->QueryInterface(IID_ITfLangBarItemSink, (void **)&_plbiSink);
  110. if (SUCCEEDED(hr))
  111. {
  112. *pdwCookie = NUIBASE_ITEMSINK_COOKIE;
  113. }
  114. }
  115. }
  116. else
  117. {
  118. hr = CONNECT_E_CANNOTCONNECT;
  119. }
  120. return hr;
  121. }
  122. //+---------------------------------------------------------------------------
  123. //
  124. // UnadviseSink
  125. //
  126. //----------------------------------------------------------------------------
  127. HRESULT CLBarItemBase::UnadviseSink(DWORD dwCookie)
  128. {
  129. if (NUIBASE_ITEMSINK_COOKIE != dwCookie)
  130. return E_FAIL;
  131. if (!_plbiSink)
  132. return E_UNEXPECTED;
  133. _plbiSink->Release();
  134. _plbiSink = NULL;
  135. return S_OK;
  136. }
  137. //+---------------------------------------------------------------------------
  138. //
  139. // Show
  140. //
  141. //----------------------------------------------------------------------------
  142. HRESULT CLBarItemBase::ShowInternal(BOOL fShow, BOOL fNotify)
  143. {
  144. DWORD dwOldStatus = _dwStatus;
  145. if (fShow)
  146. _dwStatus &= ~TF_LBI_STATUS_HIDDEN;
  147. else
  148. _dwStatus |= TF_LBI_STATUS_HIDDEN;
  149. if (fNotify && (dwOldStatus != _dwStatus) && _plbiSink)
  150. _plbiSink->OnUpdate(TF_LBI_STATUS);
  151. return S_OK;
  152. }
  153. //+---------------------------------------------------------------------------
  154. //
  155. // OnLButtonUp
  156. //
  157. //----------------------------------------------------------------------------
  158. HRESULT CLBarItemBase::OnLButtonUp(const POINT pt, const RECT *prcArea)
  159. {
  160. return E_NOTIMPL;
  161. }
  162. //+---------------------------------------------------------------------------
  163. //
  164. // OnRButtonUp
  165. //
  166. //----------------------------------------------------------------------------
  167. HRESULT CLBarItemBase::OnRButtonUp(const POINT pt, const RECT *prcArea)
  168. {
  169. return E_NOTIMPL;
  170. }
  171. //////////////////////////////////////////////////////////////////////////////
  172. //
  173. // CLBarItemButtonBase
  174. //
  175. //////////////////////////////////////////////////////////////////////////////
  176. //+---------------------------------------------------------------------------
  177. //
  178. // IUnknown
  179. //
  180. //----------------------------------------------------------------------------
  181. STDAPI CLBarItemButtonBase::QueryInterface(REFIID riid, void **ppvObj)
  182. {
  183. *ppvObj = NULL;
  184. if (IsEqualIID(riid, IID_IUnknown) ||
  185. IsEqualIID(riid, IID_ITfLangBarItem))
  186. {
  187. *ppvObj = SAFECAST(this, ITfLangBarItem *);
  188. }
  189. else if (IsEqualIID(riid, IID_ITfLangBarItemButton))
  190. {
  191. *ppvObj = SAFECAST(this, ITfLangBarItemButton *);
  192. }
  193. else if (IsEqualIID(riid, IID_ITfSource))
  194. {
  195. *ppvObj = SAFECAST(this, ITfSource *);
  196. }
  197. if (*ppvObj)
  198. {
  199. AddRef();
  200. return S_OK;
  201. }
  202. return E_NOINTERFACE;
  203. }
  204. STDAPI_(ULONG) CLBarItemButtonBase::AddRef()
  205. {
  206. return ++_cRef;
  207. }
  208. STDAPI_(ULONG) CLBarItemButtonBase::Release()
  209. {
  210. long cr;
  211. cr = --_cRef;
  212. Assert(cr >= 0);
  213. if (cr == 0)
  214. {
  215. delete this;
  216. }
  217. return cr;
  218. }
  219. //+---------------------------------------------------------------------------
  220. //
  221. // ctor
  222. //
  223. //----------------------------------------------------------------------------
  224. CLBarItemButtonBase::CLBarItemButtonBase()
  225. {
  226. }
  227. //+---------------------------------------------------------------------------
  228. //
  229. // dtor
  230. //
  231. //----------------------------------------------------------------------------
  232. CLBarItemButtonBase::~CLBarItemButtonBase()
  233. {
  234. if (_hIcon)
  235. {
  236. DestroyIcon(_hIcon);
  237. _hIcon = NULL;
  238. }
  239. }
  240. //+---------------------------------------------------------------------------
  241. //
  242. // AdviseSink
  243. //
  244. //----------------------------------------------------------------------------
  245. STDAPI CLBarItemButtonBase::AdviseSink(REFIID riid, IUnknown *punk, DWORD *pdwCookie)
  246. {
  247. return CLBarItemBase::AdviseSink(riid, punk, pdwCookie);
  248. }
  249. //+---------------------------------------------------------------------------
  250. //
  251. // UnadviseSink
  252. //
  253. //----------------------------------------------------------------------------
  254. STDAPI CLBarItemButtonBase::UnadviseSink(DWORD dwCookie)
  255. {
  256. return CLBarItemBase::UnadviseSink(dwCookie);
  257. }
  258. //+---------------------------------------------------------------------------
  259. //
  260. // GetInfo
  261. //
  262. //----------------------------------------------------------------------------
  263. STDAPI CLBarItemButtonBase::GetInfo(TF_LANGBARITEMINFO *pInfo)
  264. {
  265. return CLBarItemBase::GetInfo(pInfo);
  266. }
  267. //+---------------------------------------------------------------------------
  268. //
  269. // GetStatus
  270. //
  271. //----------------------------------------------------------------------------
  272. STDAPI CLBarItemButtonBase::GetStatus(DWORD *pdw)
  273. {
  274. return CLBarItemBase::GetStatus(pdw);
  275. }
  276. //+---------------------------------------------------------------------------
  277. //
  278. // Show
  279. //
  280. //----------------------------------------------------------------------------
  281. STDAPI CLBarItemButtonBase::Show(BOOL fShow)
  282. {
  283. return CLBarItemBase::Show(fShow);
  284. }
  285. //+---------------------------------------------------------------------------
  286. //
  287. // GetTooltipString
  288. //
  289. //----------------------------------------------------------------------------
  290. STDAPI CLBarItemButtonBase::GetTooltipString(BSTR *pbstrToolTip)
  291. {
  292. return CLBarItemBase::GetTooltipString(pbstrToolTip);
  293. }
  294. //+---------------------------------------------------------------------------
  295. //
  296. // OnClick
  297. //
  298. //----------------------------------------------------------------------------
  299. STDAPI CLBarItemButtonBase::OnClick(TfLBIClick click, POINT pt, const RECT *prcArea)
  300. {
  301. switch (click)
  302. {
  303. case TF_LBI_CLK_RIGHT:
  304. return OnRButtonUp(pt, prcArea);
  305. case TF_LBI_CLK_LEFT:
  306. return OnLButtonUp(pt, prcArea);
  307. }
  308. return E_NOTIMPL;
  309. }
  310. //+---------------------------------------------------------------------------
  311. //
  312. // InitMenu
  313. //
  314. //----------------------------------------------------------------------------
  315. STDAPI CLBarItemButtonBase::InitMenu(ITfMenu *pMenu)
  316. {
  317. return E_NOTIMPL;
  318. }
  319. //+---------------------------------------------------------------------------
  320. //
  321. // OnMenuSelect
  322. //
  323. //----------------------------------------------------------------------------
  324. STDAPI CLBarItemButtonBase::OnMenuSelect(UINT uID)
  325. {
  326. return E_NOTIMPL;
  327. }
  328. //+---------------------------------------------------------------------------
  329. //
  330. // GetIcon
  331. //
  332. //----------------------------------------------------------------------------
  333. STDAPI CLBarItemButtonBase::GetIcon(HICON *phIcon)
  334. {
  335. if (_hIcon)
  336. *phIcon = CopyIcon(_hIcon);
  337. else
  338. *phIcon = NULL;
  339. return S_OK;
  340. }
  341. //+---------------------------------------------------------------------------
  342. //
  343. // GetText
  344. //
  345. //----------------------------------------------------------------------------
  346. STDAPI CLBarItemButtonBase::GetText(BSTR *pbstrText)
  347. {
  348. if (!pbstrText)
  349. return E_INVALIDARG;
  350. *pbstrText = SysAllocString(_szText);
  351. if (*pbstrText)
  352. return S_OK;
  353. else
  354. return E_OUTOFMEMORY;
  355. }
  356. //////////////////////////////////////////////////////////////////////////////
  357. //
  358. // CLBarItemBitmapButtonBase
  359. //
  360. //////////////////////////////////////////////////////////////////////////////
  361. //+---------------------------------------------------------------------------
  362. //
  363. // IUnknown
  364. //
  365. //----------------------------------------------------------------------------
  366. STDAPI CLBarItemBitmapButtonBase::QueryInterface(REFIID riid, void **ppvObj)
  367. {
  368. *ppvObj = NULL;
  369. if (IsEqualIID(riid, IID_IUnknown) ||
  370. IsEqualIID(riid, IID_ITfLangBarItem))
  371. {
  372. *ppvObj = SAFECAST(this, ITfLangBarItem *);
  373. }
  374. else if (IsEqualIID(riid, IID_ITfLangBarItemBitmapButton))
  375. {
  376. *ppvObj = SAFECAST(this, ITfLangBarItemBitmapButton *);
  377. }
  378. else if (IsEqualIID(riid, IID_ITfSource))
  379. {
  380. *ppvObj = SAFECAST(this, ITfSource *);
  381. }
  382. if (*ppvObj)
  383. {
  384. AddRef();
  385. return S_OK;
  386. }
  387. return E_NOINTERFACE;
  388. }
  389. STDAPI_(ULONG) CLBarItemBitmapButtonBase::AddRef()
  390. {
  391. return ++_cRef;
  392. }
  393. STDAPI_(ULONG) CLBarItemBitmapButtonBase::Release()
  394. {
  395. long cr;
  396. cr = --_cRef;
  397. Assert(cr >= 0);
  398. if (cr == 0)
  399. {
  400. delete this;
  401. }
  402. return cr;
  403. }
  404. //+---------------------------------------------------------------------------
  405. //
  406. // ctor
  407. //
  408. //----------------------------------------------------------------------------
  409. CLBarItemBitmapButtonBase::CLBarItemBitmapButtonBase()
  410. {
  411. }
  412. //+---------------------------------------------------------------------------
  413. //
  414. // dtor
  415. //
  416. //----------------------------------------------------------------------------
  417. CLBarItemBitmapButtonBase::~CLBarItemBitmapButtonBase()
  418. {
  419. }
  420. //+---------------------------------------------------------------------------
  421. //
  422. // AdviseSink
  423. //
  424. //----------------------------------------------------------------------------
  425. STDAPI CLBarItemBitmapButtonBase::AdviseSink(REFIID riid, IUnknown *punk, DWORD *pdwCookie)
  426. {
  427. return CLBarItemBase::AdviseSink(riid, punk, pdwCookie);
  428. }
  429. //+---------------------------------------------------------------------------
  430. //
  431. // UnadviseSink
  432. //
  433. //----------------------------------------------------------------------------
  434. STDAPI CLBarItemBitmapButtonBase::UnadviseSink(DWORD dwCookie)
  435. {
  436. return CLBarItemBase::UnadviseSink(dwCookie);
  437. }
  438. //+---------------------------------------------------------------------------
  439. //
  440. // GetInfo
  441. //
  442. //----------------------------------------------------------------------------
  443. STDAPI CLBarItemBitmapButtonBase::GetInfo(TF_LANGBARITEMINFO *pInfo)
  444. {
  445. return CLBarItemBase::GetInfo(pInfo);
  446. }
  447. //+---------------------------------------------------------------------------
  448. //
  449. // GetStatus
  450. //
  451. //----------------------------------------------------------------------------
  452. STDAPI CLBarItemBitmapButtonBase::GetStatus(DWORD *pdw)
  453. {
  454. return CLBarItemBase::GetStatus(pdw);
  455. }
  456. //+---------------------------------------------------------------------------
  457. //
  458. // Show
  459. //
  460. //----------------------------------------------------------------------------
  461. STDAPI CLBarItemBitmapButtonBase::Show(BOOL fShow)
  462. {
  463. return CLBarItemBase::Show(fShow);
  464. }
  465. //+---------------------------------------------------------------------------
  466. //
  467. // GetTooltipString
  468. //
  469. //----------------------------------------------------------------------------
  470. STDAPI CLBarItemBitmapButtonBase::GetTooltipString(BSTR *pbstrToolTip)
  471. {
  472. return CLBarItemBase::GetTooltipString(pbstrToolTip);
  473. }
  474. //+---------------------------------------------------------------------------
  475. //
  476. // OnClick
  477. //
  478. //----------------------------------------------------------------------------
  479. STDAPI CLBarItemBitmapButtonBase::OnClick(TfLBIClick click, POINT pt, const RECT *prcArea)
  480. {
  481. switch (click)
  482. {
  483. case TF_LBI_CLK_RIGHT:
  484. return OnRButtonUp(pt, prcArea);
  485. case TF_LBI_CLK_LEFT:
  486. return OnLButtonUp(pt, prcArea);
  487. }
  488. return E_NOTIMPL;
  489. }
  490. //+---------------------------------------------------------------------------
  491. //
  492. // InitMenu
  493. //
  494. //----------------------------------------------------------------------------
  495. STDAPI CLBarItemBitmapButtonBase::InitMenu(ITfMenu *pMenu)
  496. {
  497. return E_NOTIMPL;
  498. }
  499. //+---------------------------------------------------------------------------
  500. //
  501. // OnMenuSelect
  502. //
  503. //----------------------------------------------------------------------------
  504. STDAPI CLBarItemBitmapButtonBase::OnMenuSelect(UINT uID)
  505. {
  506. return E_NOTIMPL;
  507. }
  508. //+---------------------------------------------------------------------------
  509. //
  510. // GetPreferredSize
  511. //
  512. //----------------------------------------------------------------------------
  513. STDAPI CLBarItemBitmapButtonBase::GetPreferredSize(const SIZE *pszDefault, SIZE *psize)
  514. {
  515. *psize = _sizePrefered;
  516. return S_OK;
  517. }
  518. //+---------------------------------------------------------------------------
  519. //
  520. // GetText
  521. //
  522. //----------------------------------------------------------------------------
  523. STDAPI CLBarItemBitmapButtonBase::GetText(BSTR *pbstrText)
  524. {
  525. if (!pbstrText)
  526. return E_INVALIDARG;
  527. *pbstrText = SysAllocString(_szText);
  528. if (*pbstrText)
  529. return S_OK;
  530. else
  531. return E_OUTOFMEMORY;
  532. }
  533. //////////////////////////////////////////////////////////////////////////////
  534. //
  535. // CLBarItemBitmapBase
  536. //
  537. //////////////////////////////////////////////////////////////////////////////
  538. //+---------------------------------------------------------------------------
  539. //
  540. // IUnknown
  541. //
  542. //----------------------------------------------------------------------------
  543. STDAPI CLBarItemBitmapBase::QueryInterface(REFIID riid, void **ppvObj)
  544. {
  545. *ppvObj = NULL;
  546. if (IsEqualIID(riid, IID_IUnknown) ||
  547. IsEqualIID(riid, IID_ITfLangBarItem))
  548. {
  549. *ppvObj = SAFECAST(this, ITfLangBarItem *);
  550. }
  551. else if (IsEqualIID(riid, IID_ITfLangBarItemBitmap))
  552. {
  553. *ppvObj = SAFECAST(this, ITfLangBarItemBitmap *);
  554. }
  555. else if (IsEqualIID(riid, IID_ITfSource))
  556. {
  557. *ppvObj = SAFECAST(this, ITfSource *);
  558. }
  559. if (*ppvObj)
  560. {
  561. AddRef();
  562. return S_OK;
  563. }
  564. return E_NOINTERFACE;
  565. }
  566. STDAPI_(ULONG) CLBarItemBitmapBase::AddRef()
  567. {
  568. return ++_cRef;
  569. }
  570. STDAPI_(ULONG) CLBarItemBitmapBase::Release()
  571. {
  572. long cr;
  573. cr = --_cRef;
  574. Assert(cr >= 0);
  575. if (cr == 0)
  576. {
  577. delete this;
  578. }
  579. return cr;
  580. }
  581. //+---------------------------------------------------------------------------
  582. //
  583. // ctor
  584. //
  585. //----------------------------------------------------------------------------
  586. CLBarItemBitmapBase::CLBarItemBitmapBase()
  587. {
  588. }
  589. //+---------------------------------------------------------------------------
  590. //
  591. // dtor
  592. //
  593. //----------------------------------------------------------------------------
  594. CLBarItemBitmapBase::~CLBarItemBitmapBase()
  595. {
  596. }
  597. //+---------------------------------------------------------------------------
  598. //
  599. // AdviseSink
  600. //
  601. //----------------------------------------------------------------------------
  602. STDAPI CLBarItemBitmapBase::AdviseSink(REFIID riid, IUnknown *punk, DWORD *pdwCookie)
  603. {
  604. return CLBarItemBase::AdviseSink(riid, punk, pdwCookie);
  605. }
  606. //+---------------------------------------------------------------------------
  607. //
  608. // UnadviseSink
  609. //
  610. //----------------------------------------------------------------------------
  611. STDAPI CLBarItemBitmapBase::UnadviseSink(DWORD dwCookie)
  612. {
  613. return CLBarItemBase::UnadviseSink(dwCookie);
  614. }
  615. //+---------------------------------------------------------------------------
  616. //
  617. // GetInfo
  618. //
  619. //----------------------------------------------------------------------------
  620. STDAPI CLBarItemBitmapBase::GetInfo(TF_LANGBARITEMINFO *pInfo)
  621. {
  622. return CLBarItemBase::GetInfo(pInfo);
  623. }
  624. //+---------------------------------------------------------------------------
  625. //
  626. // GetStatus
  627. //
  628. //----------------------------------------------------------------------------
  629. STDAPI CLBarItemBitmapBase::GetStatus(DWORD *pdw)
  630. {
  631. return CLBarItemBase::GetStatus(pdw);
  632. }
  633. //+---------------------------------------------------------------------------
  634. //
  635. // Show
  636. //
  637. //----------------------------------------------------------------------------
  638. STDAPI CLBarItemBitmapBase::Show(BOOL fShow)
  639. {
  640. return CLBarItemBase::Show(fShow);
  641. }
  642. //+---------------------------------------------------------------------------
  643. //
  644. // GetTooltipString
  645. //
  646. //----------------------------------------------------------------------------
  647. STDAPI CLBarItemBitmapBase::GetTooltipString(BSTR *pbstrToolTip)
  648. {
  649. return CLBarItemBase::GetTooltipString(pbstrToolTip);
  650. }
  651. //+---------------------------------------------------------------------------
  652. //
  653. // OnClick
  654. //
  655. //----------------------------------------------------------------------------
  656. STDAPI CLBarItemBitmapBase::OnClick(TfLBIClick click, POINT pt, const RECT *prcArea)
  657. {
  658. switch (click)
  659. {
  660. case TF_LBI_CLK_RIGHT:
  661. return OnRButtonUp(pt, prcArea);
  662. case TF_LBI_CLK_LEFT:
  663. return OnLButtonUp(pt, prcArea);
  664. }
  665. return E_NOTIMPL;
  666. }
  667. //+---------------------------------------------------------------------------
  668. //
  669. // GetPreferredSize
  670. //
  671. //----------------------------------------------------------------------------
  672. STDAPI CLBarItemBitmapBase::GetPreferredSize(const SIZE *pszDefault, SIZE *psize)
  673. {
  674. *psize = _sizePrefered;
  675. return S_OK;
  676. }
  677. //////////////////////////////////////////////////////////////////////////////
  678. //
  679. // CLBarItemBalloonBase
  680. //
  681. //////////////////////////////////////////////////////////////////////////////
  682. //+---------------------------------------------------------------------------
  683. //
  684. // IUnknown
  685. //
  686. //----------------------------------------------------------------------------
  687. STDAPI CLBarItemBalloonBase::QueryInterface(REFIID riid, void **ppvObj)
  688. {
  689. *ppvObj = NULL;
  690. if (IsEqualIID(riid, IID_IUnknown) ||
  691. IsEqualIID(riid, IID_ITfLangBarItem))
  692. {
  693. *ppvObj = SAFECAST(this, ITfLangBarItem *);
  694. }
  695. else if (IsEqualIID(riid, IID_ITfLangBarItemBalloon))
  696. {
  697. *ppvObj = SAFECAST(this, ITfLangBarItemBalloon *);
  698. }
  699. else if (IsEqualIID(riid, IID_ITfSource))
  700. {
  701. *ppvObj = SAFECAST(this, ITfSource *);
  702. }
  703. if (*ppvObj)
  704. {
  705. AddRef();
  706. return S_OK;
  707. }
  708. return E_NOINTERFACE;
  709. }
  710. STDAPI_(ULONG) CLBarItemBalloonBase::AddRef()
  711. {
  712. return ++_cRef;
  713. }
  714. STDAPI_(ULONG) CLBarItemBalloonBase::Release()
  715. {
  716. long cr;
  717. cr = --_cRef;
  718. Assert(cr >= 0);
  719. if (cr == 0)
  720. {
  721. delete this;
  722. }
  723. return cr;
  724. }
  725. //+---------------------------------------------------------------------------
  726. //
  727. // ctor
  728. //
  729. //----------------------------------------------------------------------------
  730. CLBarItemBalloonBase::CLBarItemBalloonBase()
  731. {
  732. }
  733. //+---------------------------------------------------------------------------
  734. //
  735. // dtor
  736. //
  737. //----------------------------------------------------------------------------
  738. CLBarItemBalloonBase::~CLBarItemBalloonBase()
  739. {
  740. }
  741. //+---------------------------------------------------------------------------
  742. //
  743. // AdviseSink
  744. //
  745. //----------------------------------------------------------------------------
  746. STDAPI CLBarItemBalloonBase::AdviseSink(REFIID riid, IUnknown *punk, DWORD *pdwCookie)
  747. {
  748. return CLBarItemBase::AdviseSink(riid, punk, pdwCookie);
  749. }
  750. //+---------------------------------------------------------------------------
  751. //
  752. // UnadviseSink
  753. //
  754. //----------------------------------------------------------------------------
  755. STDAPI CLBarItemBalloonBase::UnadviseSink(DWORD dwCookie)
  756. {
  757. return CLBarItemBase::UnadviseSink(dwCookie);
  758. }
  759. //+---------------------------------------------------------------------------
  760. //
  761. // GetInfo
  762. //
  763. //----------------------------------------------------------------------------
  764. STDAPI CLBarItemBalloonBase::GetInfo(TF_LANGBARITEMINFO *pInfo)
  765. {
  766. return CLBarItemBase::GetInfo(pInfo);
  767. }
  768. //+---------------------------------------------------------------------------
  769. //
  770. // GetStatus
  771. //
  772. //----------------------------------------------------------------------------
  773. STDAPI CLBarItemBalloonBase::GetStatus(DWORD *pdw)
  774. {
  775. return CLBarItemBase::GetStatus(pdw);
  776. }
  777. //+---------------------------------------------------------------------------
  778. //
  779. // Show
  780. //
  781. //----------------------------------------------------------------------------
  782. STDAPI CLBarItemBalloonBase::Show(BOOL fShow)
  783. {
  784. return CLBarItemBase::Show(fShow);
  785. }
  786. //+---------------------------------------------------------------------------
  787. //
  788. // GetTooltipString
  789. //
  790. //----------------------------------------------------------------------------
  791. STDAPI CLBarItemBalloonBase::GetTooltipString(BSTR *pbstrToolTip)
  792. {
  793. return CLBarItemBase::GetTooltipString(pbstrToolTip);
  794. }
  795. //+---------------------------------------------------------------------------
  796. //
  797. // OnClick
  798. //
  799. //----------------------------------------------------------------------------
  800. STDAPI CLBarItemBalloonBase::OnClick(TfLBIClick click, POINT pt, const RECT *prcArea)
  801. {
  802. switch (click)
  803. {
  804. case TF_LBI_CLK_RIGHT:
  805. return OnRButtonUp(pt, prcArea);
  806. case TF_LBI_CLK_LEFT:
  807. return OnLButtonUp(pt, prcArea);
  808. }
  809. return E_NOTIMPL;
  810. }
  811. //+---------------------------------------------------------------------------
  812. //
  813. // GetPreferredSize
  814. //
  815. //----------------------------------------------------------------------------
  816. STDAPI CLBarItemBalloonBase::GetPreferredSize(const SIZE *pszDefault, SIZE *psize)
  817. {
  818. *psize = _sizePrefered;
  819. return S_OK;
  820. }