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.

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