Source code of Windows XP (NT5)
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.

1078 lines
20 KiB

  1. /*++
  2. Copyright (c) 1994-1998 Microsoft Corporation
  3. Module Name :
  4. odlbox.h
  5. Abstract:
  6. Owner draw listbox/combobox base class
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. #ifndef _ODLBOX_H
  14. #define _ODLBOX_H
  15. //
  16. // Get control rect in terms of
  17. // parent coordinates
  18. //
  19. COMDLL void
  20. GetDlgCtlRect(
  21. IN HWND hWndParent,
  22. IN HWND hWndControl,
  23. OUT LPRECT lprcControl
  24. );
  25. //
  26. // Fith path to the given control
  27. //
  28. COMDLL void
  29. FitPathToControl(
  30. IN CWnd & wndControl,
  31. IN LPCTSTR lpstrPath
  32. );
  33. //
  34. // Show/hide _AND_ enable/disable control
  35. //
  36. COMDLL void
  37. ActivateControl(
  38. IN CWnd & wndControl,
  39. IN BOOL fShow = TRUE
  40. );
  41. //
  42. // Helper
  43. //
  44. inline void DeActivateControl(CWnd & wndControl)
  45. {
  46. ActivateControl(wndControl, FALSE);
  47. }
  48. class COMDLL CMappedBitmapButton : public CBitmapButton
  49. /*++
  50. Class Description:
  51. Similar to CBitmapbutton, but use ::LoadMappedBitmap to reflect
  52. propert colour mapping.
  53. Public Interface:
  54. CMappedBitmapButton : Constructor
  55. --*/
  56. {
  57. //
  58. // Constructor
  59. //
  60. public:
  61. CMappedBitmapButton();
  62. protected:
  63. BOOL LoadMappedBitmaps(
  64. UINT nIDBitmapResource,
  65. UINT nIDBitmapResourceSel = 0,
  66. UINT nIDBitmapResourceFocus = 0,
  67. UINT nIDBitmapResourceDisabled = 0
  68. );
  69. };
  70. class COMDLL CUpButton : public CMappedBitmapButton
  71. /*++
  72. Class Description:
  73. Up button.
  74. Public Interface:
  75. CUpButton : Constructor; does everything
  76. --*/
  77. {
  78. public:
  79. CUpButton();
  80. };
  81. class COMDLL CDownButton : public CMappedBitmapButton
  82. /*++
  83. Class Description:
  84. Down button
  85. Public Interface:
  86. CDownButton : Constructor; does everything
  87. --*/
  88. {
  89. public:
  90. CDownButton();
  91. };
  92. class COMDLL CRMCListBoxResources
  93. {
  94. /*++
  95. Class Description:
  96. Listbox resources, a series of bitmaps for use by the listbox. Will
  97. generate bitmaps against the proper background colours for both
  98. selected and non-selected states.
  99. Public Interface:
  100. CRMCListBoxResources : Constructor
  101. ~CRMCListBoxResources : Destructor
  102. SysColorChanged : Regenerate bitmaps in response to change in colours
  103. DcBitMap : Get final DC
  104. BitmapHeight : Get bitmap height
  105. BitmapWidth : Get bitmap width
  106. ColorWindow : Get currently set window colour
  107. ColorHighlight : Get currently set highlight colour
  108. ColorWindowText : Get currently set window text colour
  109. ColorHighlightText : Get currently set text highlight colour
  110. --*/
  111. //
  112. // Constructor
  113. //
  114. public:
  115. CRMCListBoxResources(
  116. IN int bmId,
  117. IN int nBitmapWidth,
  118. IN COLORREF crBackground = RGB(0,255,0) /* Green */
  119. );
  120. ~CRMCListBoxResources();
  121. //
  122. // Interface
  123. //
  124. public:
  125. void SysColorChanged();
  126. const CDC & dcBitMap() const;
  127. int BitmapHeight() const;
  128. int BitmapWidth() const;
  129. COLORREF ColorWindow() const;
  130. COLORREF ColorHighlight() const;
  131. COLORREF ColorWindowText() const;
  132. COLORREF ColorHighlightText() const;
  133. //
  134. // Internal Helpers
  135. //
  136. protected:
  137. void GetSysColors();
  138. void PrepareBitmaps();
  139. void UnprepareBitmaps();
  140. void UnloadResources();
  141. void LoadResources();
  142. private:
  143. COLORREF m_rgbColorWindow;
  144. COLORREF m_rgbColorHighlight;
  145. COLORREF m_rgbColorWindowText;
  146. COLORREF m_rgbColorHighlightText;
  147. COLORREF m_rgbColorTransparent;
  148. HGDIOBJ m_hOldBitmap;
  149. CBitmap m_bmpScreen;
  150. CDC m_dcFinal;
  151. BOOL m_fInitialized;
  152. int m_idBitmap;
  153. int m_nBitmapHeight;
  154. int m_nBitmapWidth;
  155. int m_nBitmaps;
  156. };
  157. class COMDLL CRMCListBoxDrawStruct
  158. {
  159. /*++
  160. Class Description:
  161. Drawing information passed on to ODLBox
  162. Public Interface:
  163. CRMCListBoxDrawStruct : Constructor
  164. --*/
  165. public:
  166. CRMCListBoxDrawStruct(
  167. IN CDC * pDC,
  168. IN RECT * pRect,
  169. IN BOOL sel,
  170. IN DWORD_PTR item,
  171. IN int itemIndex,
  172. IN const CRMCListBoxResources * pres
  173. );
  174. public:
  175. const CRMCListBoxResources * m_pResources;
  176. int m_ItemIndex;
  177. CDC * m_pDC;
  178. CRect m_Rect;
  179. BOOL m_Sel;
  180. DWORD_PTR m_ItemData;
  181. };
  182. /* abstract */ class COMDLL CODLBox
  183. /*++
  184. Class Description:
  185. abstract base class for owner-draw listbox and combobox
  186. Public Interface:
  187. AttachResources : Attach the resource structure to the list/combo box
  188. ChangeFont : Change the font
  189. NumTabs : Get the number of tabs currently set
  190. AddTab : Add tab
  191. AddTabFromHeaders : Add tab computed from the difference in left coordinate
  192. of two controls.
  193. InsertTab : Insert a tab
  194. RemoveTab : Remove a tab
  195. RemoveAllTabs : Remove all tabs
  196. SetTab : Set tab value
  197. GetTab : Get tab value
  198. TextHeight : Get the text height of the current font
  199. __GetCount : Pure virtual function to get the number of items in the
  200. list/combo box
  201. __SetItemHeight : Pure virtual function to set the text height of the font
  202. --*/
  203. {
  204. //
  205. // Operations
  206. //
  207. public:
  208. void AttachResources(
  209. IN const CRMCListBoxResources * pResources
  210. );
  211. BOOL ChangeFont(
  212. CFont * pNewFont
  213. );
  214. int NumTabs() const;
  215. int AddTab(
  216. IN UINT uTab
  217. );
  218. int AddTabFromHeaders(
  219. IN CWnd & wndLeft,
  220. IN CWnd & wndRight
  221. );
  222. int AddTabFromHeaders(
  223. IN UINT idLeft,
  224. IN UINT idRight
  225. );
  226. void InsertTab(
  227. IN int nIndex,
  228. IN UINT uTab
  229. );
  230. void RemoveTab(
  231. IN int nIndex,
  232. IN int nCount = 1
  233. );
  234. void RemoveAllTabs();
  235. void SetTab(
  236. IN int nIndex,
  237. IN UINT uTab
  238. );
  239. UINT GetTab(
  240. IN int nIndex
  241. ) const;
  242. int TextHeight() const;
  243. /* pure */ virtual int __GetCount() const = 0;
  244. /* pure */ virtual int __SetItemHeight(
  245. IN int nIndex,
  246. IN UINT cyItemHeight
  247. ) = 0;
  248. protected:
  249. CODLBox();
  250. ~CODLBox();
  251. protected:
  252. //
  253. // Determine required display width of the string
  254. //
  255. static int GetRequiredWidth(
  256. IN CDC * pDC,
  257. IN const CRect & rc,
  258. IN LPCTSTR lpstr,
  259. IN int nLength
  260. );
  261. //
  262. // Helper function to display text in a limited rectangle
  263. //
  264. static BOOL ColumnText(
  265. IN CDC * pDC,
  266. IN int left,
  267. IN int top,
  268. IN int right,
  269. IN int bottom,
  270. IN LPCTSTR str
  271. );
  272. protected:
  273. //
  274. // Helper functions for displaying bitmaps and text
  275. //
  276. BOOL DrawBitmap(
  277. IN CRMCListBoxDrawStruct & ds,
  278. IN int nCol,
  279. IN int nID
  280. );
  281. BOOL ColumnText(
  282. IN CRMCListBoxDrawStruct & ds,
  283. IN int nCol,
  284. IN BOOL fSkipBitmap,
  285. IN LPCTSTR lpstr
  286. );
  287. void ComputeMargins(
  288. IN CRMCListBoxDrawStruct & ds,
  289. IN int nCol,
  290. OUT int & nLeft,
  291. OUT int & nRight
  292. );
  293. protected:
  294. void CalculateTextHeight(
  295. IN CFont * pFont
  296. );
  297. void AttachWindow(
  298. IN CWnd * pWnd
  299. );
  300. protected:
  301. //
  302. // must override this to provide drawing of item
  303. //
  304. /* pure */ virtual void DrawItemEx(
  305. IN CRMCListBoxDrawStruct & dw
  306. ) = 0;
  307. void __MeasureItem(
  308. IN OUT LPMEASUREITEMSTRUCT lpMIS
  309. );
  310. void __DrawItem(
  311. IN LPDRAWITEMSTRUCT lpDIS
  312. );
  313. virtual BOOL Initialize();
  314. protected:
  315. int m_lfHeight;
  316. const CRMCListBoxResources* m_pResources;
  317. private:
  318. //
  319. // Window handle -- to be attached by derived class
  320. //
  321. CWnd * m_pWnd;
  322. CUIntArray m_auTabs;
  323. };
  324. //
  325. // Forward decleration
  326. //
  327. class CHeaderListBox;
  328. //
  329. // Styles for listbox headers
  330. //
  331. #define HLS_STRETCH (0x00000001)
  332. #define HLS_BUTTONS (0x00000002)
  333. #define HLS_DEFAULT (HLS_STRETCH | HLS_BUTTONS)
  334. class COMDLL CRMCListBoxHeader : public CStatic
  335. /*++
  336. Class Description:
  337. Header object to be used in conjunction with listbox
  338. Public Interface:
  339. CRMCListBoxHeader : Constructor
  340. ~CRMCListBoxHeader : Destructor
  341. Create : Create control
  342. GetItemCount : Get the number of items in the header control
  343. GetColumnWidth : Get column width of a specific column
  344. QueryNumColumns : Get the number of columns in the listbox
  345. SetColumnWidth : Set the width of specified column
  346. GetItem : Get header item information about specific
  347. column
  348. SetItem : Set header item information about specific
  349. column
  350. InsertItem : Insert header item
  351. DeleteItem : Delete header item
  352. RespondToColumnWidthChanges : Set response flagg
  353. --*/
  354. {
  355. DECLARE_DYNAMIC(CRMCListBoxHeader)
  356. public:
  357. //
  358. // Constructor
  359. //
  360. CRMCListBoxHeader(
  361. IN DWORD dwStyle = HLS_DEFAULT
  362. );
  363. ~CRMCListBoxHeader();
  364. //
  365. // Create control
  366. //
  367. BOOL Create(
  368. IN DWORD dwStyle,
  369. IN const RECT & rect,
  370. IN CWnd * pParentWnd,
  371. IN CHeaderListBox * pListBox,
  372. IN UINT nID
  373. );
  374. //
  375. // Header control stuff
  376. //
  377. public:
  378. int GetItemCount() const;
  379. int GetColumnWidth(
  380. IN int nPos
  381. ) const;
  382. BOOL GetItem(
  383. IN int nPos,
  384. IN HD_ITEM * pHeaderItem
  385. ) const;
  386. BOOL SetItem(
  387. IN int nPos,
  388. IN HD_ITEM * pHeaderItem
  389. );
  390. int InsertItem(
  391. IN int nPos,
  392. IN HD_ITEM * phdi
  393. );
  394. BOOL DeleteItem(
  395. IN int nPos
  396. );
  397. void SetColumnWidth(
  398. IN int nCol,
  399. IN int nWidth
  400. );
  401. BOOL DoesRespondToColumnWidthChanges() const;
  402. void RespondToColumnWidthChanges(
  403. IN BOOL fRespond = TRUE
  404. );
  405. int QueryNumColumns() const;
  406. protected:
  407. //{{AFX_MSG(CRMCListBoxHeader)
  408. afx_msg void OnDestroy();
  409. //}}AFX_MSG
  410. afx_msg void OnHeaderItemChanged(UINT nId, NMHDR * n, LRESULT * l);
  411. afx_msg void OnHeaderEndTrack(UINT nId, NMHDR * n, LRESULT * l);
  412. afx_msg void OnHeaderItemClick(UINT nId, NMHDR * n, LRESULT * l);
  413. DECLARE_MESSAGE_MAP()
  414. void CRMCListBoxHeader::SetTabsFromHeader();
  415. BOOL UseStretch() const;
  416. BOOL UseButtons() const;
  417. private:
  418. CHeaderCtrl * m_pHCtrl;
  419. CHeaderListBox * m_pListBox;
  420. DWORD m_dwStyle;
  421. BOOL m_fRespondToColumnWidthChanges;
  422. };
  423. class COMDLL CRMCListBox : public CListBox, public CODLBox
  424. /*++
  425. Class Description:
  426. Super listbox class. Its methods work for both
  427. single selection, and multi selection listboxes.
  428. Public Interface:
  429. CRMCListBox : Constructor
  430. ~CRMCListBox : Destructor
  431. Initialize : Initialize the control
  432. __GetCount : Get the count of items in the listbox
  433. __SetItemHeight : Set the item height in the listbox
  434. InvalidateSelection : Invalidate selection
  435. --*/
  436. {
  437. DECLARE_DYNAMIC(CRMCListBox)
  438. public:
  439. //
  440. // Plain Construction
  441. //
  442. CRMCListBox();
  443. virtual ~CRMCListBox();
  444. virtual BOOL Initialize();
  445. //
  446. // Implementation
  447. //
  448. public:
  449. virtual int __GetCount() const;
  450. virtual int __SetItemHeight(
  451. IN int nIndex,
  452. IN UINT cyItemHeight
  453. );
  454. //
  455. // Invalidate item
  456. //
  457. void InvalidateSelection(
  458. IN int nSel
  459. );
  460. //
  461. // Select single item
  462. //
  463. int SetCurSel(int nSelect);
  464. //
  465. // Get index of selected item. For multi-selects
  466. // with more than 1 selected, it will return LB_ERR
  467. //
  468. int GetCurSel() const;
  469. //
  470. // Check to see if item is selected
  471. //
  472. int GetSel(int nSel) const;
  473. //
  474. // Get count of selected items
  475. //
  476. int GetSelCount() const;
  477. //
  478. // Get next select item (single or multi-select).
  479. // Returns NULL if no further selected items available
  480. //
  481. void * GetNextSelectedItem(
  482. IN OUT int * pnStartingIndex
  483. );
  484. //
  485. // Select a single item (works for multi and single
  486. // select listboxes)
  487. //
  488. BOOL SelectItem(
  489. IN void * pItemData = NULL
  490. );
  491. //
  492. // Get the item at the single selection (works for both
  493. // multi and single selection listboxes). Return NULL
  494. // if fewer than or more than one is selected.
  495. //
  496. void * GetSelectedListItem(
  497. OUT int * pnSel = NULL
  498. );
  499. protected:
  500. //
  501. // Do-nothing drawitemex for non-owner draw listboxes.
  502. //
  503. virtual void DrawItemEx(
  504. IN CRMCListBoxDrawStruct & dw
  505. );
  506. virtual void MeasureItem(
  507. IN OUT LPMEASUREITEMSTRUCT lpMIS
  508. );
  509. virtual void DrawItem(
  510. IN LPDRAWITEMSTRUCT lpDIS
  511. );
  512. protected:
  513. //{{AFX_MSG(CRMCListBox)
  514. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  515. //}}AFX_MSG
  516. DECLARE_MESSAGE_MAP()
  517. //
  518. // Helpers
  519. //
  520. protected:
  521. BOOL IsMultiSelect() const;
  522. private:
  523. BOOL m_fInitialized;
  524. BOOL m_fMultiSelect;
  525. };
  526. //
  527. // Column Definition Structure
  528. //
  529. typedef struct tagODL_COLUMN_DEF
  530. {
  531. int nWeight;
  532. UINT nLabelID;
  533. } ODL_COLUMN_DEF;
  534. //
  535. // Enhanced Column Definition Structure (Can't
  536. // be used in global structures in an AFXEXT dll
  537. // because of the CObjectPlus reference)
  538. //
  539. typedef struct tagODL_COLUMN_DEF_EX
  540. {
  541. ODL_COLUMN_DEF cd;
  542. CObjectPlus::PCOBJPLUS_ORDER_FUNC pSortFn;
  543. } ODL_COLUMN_DEF_EX;
  544. class COMDLL CHeaderListBox : public CRMCListBox
  545. /*++
  546. Class Description:
  547. Header listbox class. When using this class, do not use the tabbing
  548. functions of the base class. These will be set by the header control.
  549. Public Interface:
  550. CHeaderListBox : Constructor
  551. ~CHeaderListBox : Destructor
  552. Initialize : Initialize the control
  553. QueryNumColumns : Get the number of columns in the listbox
  554. QueryColumnWidth : Get the width of specified column
  555. SetColumnWidth : Set the width of specified column
  556. --*/
  557. {
  558. DECLARE_DYNAMIC(CHeaderListBox)
  559. public:
  560. //
  561. // Plain Construction
  562. //
  563. CHeaderListBox(
  564. IN DWORD dwStyle = HLS_DEFAULT,
  565. LPCTSTR lpRegKey = NULL
  566. );
  567. virtual ~CHeaderListBox();
  568. virtual BOOL Initialize();
  569. public:
  570. BOOL EnableWindow(
  571. IN BOOL bEnable = TRUE
  572. );
  573. BOOL ShowWindow(
  574. IN int nCmdShow
  575. );
  576. int QueryNumColumns() const;
  577. int QueryColumnWidth(
  578. IN int nCol
  579. ) const;
  580. BOOL SetColumnWidth(
  581. IN int nCol,
  582. IN int nWidth
  583. );
  584. //
  585. // Header Control Attachment Access
  586. //
  587. protected:
  588. int GetHeaderItemCount() const;
  589. BOOL GetHeaderItem(
  590. IN int nPos,
  591. IN HD_ITEM * pHeaderItem
  592. ) const;
  593. BOOL SetHeaderItem(
  594. IN int nPos,
  595. IN HD_ITEM * pHeaderItem
  596. );
  597. int InsertHeaderItem(
  598. IN int nPos,
  599. IN HD_ITEM * phdi
  600. );
  601. BOOL DeleteHeaderItem(
  602. IN int nPos
  603. );
  604. CRMCListBoxHeader * GetHeader();
  605. int InsertColumn(
  606. IN int nCol,
  607. IN int nWeight,
  608. IN UINT nStringID
  609. );
  610. void ConvertColumnWidth(
  611. IN int nCol,
  612. IN int nTotalWeight,
  613. IN int nTotalWidth
  614. );
  615. BOOL SetWidthsFromReg();
  616. void DistributeColumns();
  617. protected:
  618. //{{AFX_MSG(CHeaderListBox)
  619. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  620. afx_msg void OnDestroy();
  621. //}}AFX_MSG
  622. DECLARE_MESSAGE_MAP()
  623. private:
  624. BOOL m_fInitialized;
  625. CString m_strRegKey;
  626. CRMCListBoxHeader * m_pHeader;
  627. };
  628. class COMDLL CRMCComboBox : public CComboBox, public CODLBox
  629. /*++
  630. Class Description:
  631. Super combo box class
  632. Public Interface:
  633. CRMCComboBox : Constructor
  634. ~CRMCComboBox : Destructor
  635. Initialize : Initialize the control
  636. __GetCount : Get the count of items in the combobox
  637. __SetItemHeight : Set the item height in the combobox
  638. InvalidateSelection : Invalidate selection
  639. --*/
  640. {
  641. DECLARE_DYNAMIC(CRMCComboBox)
  642. //
  643. // Construction
  644. //
  645. public:
  646. CRMCComboBox();
  647. virtual BOOL Initialize();
  648. //
  649. // Implementation
  650. //
  651. public:
  652. virtual ~CRMCComboBox();
  653. virtual int __GetCount() const;
  654. virtual int __SetItemHeight(
  655. IN int nIndex,
  656. IN UINT cyItemHeight
  657. );
  658. void InvalidateSelection(
  659. IN int nSel
  660. );
  661. protected:
  662. //
  663. // Do-nothing drawitemex for non-owner draw comboboxes.
  664. //
  665. virtual void DrawItemEx(
  666. IN CRMCListBoxDrawStruct & dw
  667. );
  668. virtual void MeasureItem(
  669. IN OUT LPMEASUREITEMSTRUCT lpMIS
  670. );
  671. virtual void DrawItem(
  672. IN LPDRAWITEMSTRUCT lpDIS
  673. );
  674. protected:
  675. //{{AFX_MSG(CRMCComboBox)
  676. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  677. //}}AFX_MSG
  678. DECLARE_MESSAGE_MAP()
  679. private:
  680. BOOL m_fInitialized;
  681. };
  682. //
  683. // Inline Expansion
  684. //
  685. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  686. inline CMappedBitmapButton::CMappedBitmapButton()
  687. {
  688. };
  689. inline CUpButton::CUpButton()
  690. {
  691. LoadMappedBitmaps(IDB_UP, IDB_UPINV, IDB_UPFOC, IDB_UPDIS);
  692. }
  693. inline CDownButton::CDownButton()
  694. {
  695. LoadMappedBitmaps(IDB_DOWN, IDB_DOWNINV, IDB_DOWNFOC, IDB_DOWNDIS);
  696. }
  697. inline const CDC & CRMCListBoxResources::dcBitMap() const
  698. {
  699. return m_dcFinal;
  700. }
  701. inline int CRMCListBoxResources::BitmapHeight() const
  702. {
  703. return m_nBitmapHeight;
  704. }
  705. inline int CRMCListBoxResources::BitmapWidth() const
  706. {
  707. return m_nBitmapWidth;
  708. }
  709. inline COLORREF CRMCListBoxResources::ColorWindow() const
  710. {
  711. return m_rgbColorWindow;
  712. }
  713. inline COLORREF CRMCListBoxResources::ColorHighlight() const
  714. {
  715. return m_rgbColorHighlight;
  716. }
  717. inline COLORREF CRMCListBoxResources::ColorWindowText() const
  718. {
  719. return m_rgbColorWindowText;
  720. }
  721. inline COLORREF CRMCListBoxResources::ColorHighlightText() const
  722. {
  723. return m_rgbColorHighlightText;
  724. }
  725. inline int CODLBox::NumTabs() const
  726. {
  727. return (int)m_auTabs.GetSize();
  728. }
  729. inline void CODLBox::SetTab(
  730. IN int nIndex,
  731. IN UINT uTab
  732. )
  733. {
  734. ASSERT(nIndex >= 0 && nIndex < NumTabs());
  735. m_auTabs[nIndex] = uTab;
  736. }
  737. inline UINT CODLBox::GetTab(
  738. IN int nIndex
  739. ) const
  740. {
  741. ASSERT(nIndex >= 0 && nIndex < NumTabs());
  742. return m_auTabs[nIndex];
  743. }
  744. inline int CODLBox::TextHeight() const
  745. {
  746. return m_lfHeight;
  747. }
  748. inline void CODLBox::AttachWindow(
  749. IN CWnd * pWnd
  750. )
  751. {
  752. m_pWnd = pWnd;
  753. }
  754. inline BOOL CRMCListBoxHeader::DoesRespondToColumnWidthChanges() const
  755. {
  756. return m_fRespondToColumnWidthChanges;
  757. }
  758. inline void CRMCListBoxHeader::RespondToColumnWidthChanges(
  759. IN BOOL fRespond
  760. )
  761. {
  762. m_fRespondToColumnWidthChanges = fRespond;
  763. }
  764. inline int CRMCListBoxHeader::QueryNumColumns() const
  765. {
  766. return GetItemCount();
  767. }
  768. inline BOOL CRMCListBoxHeader::UseStretch() const
  769. {
  770. return (m_dwStyle & HLS_STRETCH) != 0L;
  771. }
  772. inline BOOL CRMCListBoxHeader::UseButtons() const
  773. {
  774. return (m_dwStyle & HLS_BUTTONS) != 0L;
  775. }
  776. inline int CHeaderListBox::QueryNumColumns() const
  777. {
  778. return GetHeaderItemCount();
  779. }
  780. inline int CHeaderListBox::GetHeaderItemCount() const
  781. {
  782. ASSERT(m_pHeader);
  783. return m_pHeader->GetItemCount();
  784. }
  785. inline BOOL CHeaderListBox::GetHeaderItem(
  786. IN int nPos,
  787. IN HD_ITEM * pHeaderItem
  788. ) const
  789. {
  790. ASSERT(m_pHeader);
  791. return m_pHeader->GetItem(nPos, pHeaderItem);
  792. }
  793. inline BOOL CHeaderListBox::SetHeaderItem(
  794. IN int nPos,
  795. IN HD_ITEM * pHeaderItem
  796. )
  797. {
  798. ASSERT(m_pHeader);
  799. return m_pHeader->SetItem(nPos, pHeaderItem);
  800. }
  801. inline int CHeaderListBox::InsertHeaderItem(
  802. IN int nPos,
  803. IN HD_ITEM * phdi
  804. )
  805. {
  806. ASSERT(m_pHeader);
  807. return m_pHeader->InsertItem(nPos, phdi);
  808. }
  809. inline BOOL CHeaderListBox::DeleteHeaderItem(
  810. IN int nPos
  811. )
  812. {
  813. ASSERT(m_pHeader);
  814. return m_pHeader->DeleteItem(nPos);
  815. }
  816. inline CRMCListBoxHeader * CHeaderListBox::GetHeader()
  817. {
  818. return m_pHeader;
  819. }
  820. inline BOOL CRMCListBox::IsMultiSelect() const
  821. {
  822. ASSERT(m_fInitialized);
  823. return m_fMultiSelect;
  824. }
  825. #endif // _ODLBOX_H_