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.

1077 lines
21 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 lpstrString,
  30. IN BOOL bIsFilePath
  31. );
  32. //
  33. // Show/hide _AND_ enable/disable control
  34. //
  35. void COMDLL ActivateControl(
  36. IN CWnd & wndControl,
  37. IN BOOL fShow = TRUE
  38. );
  39. //
  40. // Helper
  41. //
  42. inline void DeActivateControl(CWnd & wndControl)
  43. {
  44. ActivateControl(wndControl, FALSE);
  45. }
  46. BOOL COMDLL VerifyState();
  47. class COMDLL CMappedBitmapButton : public CBitmapButton
  48. /*++
  49. Class Description:
  50. Similar to CBitmapbutton, but use ::LoadMappedBitmap to reflect
  51. propert colour mapping.
  52. Public Interface:
  53. CMappedBitmapButton : Constructor
  54. --*/
  55. {
  56. //
  57. // Constructor
  58. //
  59. public:
  60. CMappedBitmapButton();
  61. protected:
  62. BOOL LoadMappedBitmaps(
  63. UINT nIDBitmapResource,
  64. UINT nIDBitmapResourceSel = 0,
  65. UINT nIDBitmapResourceFocus = 0,
  66. UINT nIDBitmapResourceDisabled = 0
  67. );
  68. };
  69. class COMDLL CUpButton : public CMappedBitmapButton
  70. /*++
  71. Class Description:
  72. Up button.
  73. Public Interface:
  74. CUpButton : Constructor; does everything
  75. --*/
  76. {
  77. public:
  78. CUpButton();
  79. };
  80. class COMDLL CDownButton : public CMappedBitmapButton
  81. /*++
  82. Class Description:
  83. Down button
  84. Public Interface:
  85. CDownButton : Constructor; does everything
  86. --*/
  87. {
  88. public:
  89. CDownButton();
  90. };
  91. class COMDLL CRMCListBoxResources
  92. {
  93. /*++
  94. Class Description:
  95. Listbox resources, a series of bitmaps for use by the listbox. Will
  96. generate bitmaps against the proper background colours for both
  97. selected and non-selected states.
  98. Public Interface:
  99. CRMCListBoxResources : Constructor
  100. ~CRMCListBoxResources : Destructor
  101. SysColorChanged : Regenerate bitmaps in response to change in colours
  102. DcBitMap : Get final DC
  103. BitmapHeight : Get bitmap height
  104. BitmapWidth : Get bitmap width
  105. ColorWindow : Get currently set window colour
  106. ColorHighlight : Get currently set highlight colour
  107. ColorWindowText : Get currently set window text colour
  108. ColorHighlightText : Get currently set text highlight colour
  109. --*/
  110. //
  111. // Constructor
  112. //
  113. public:
  114. CRMCListBoxResources(
  115. IN int bmId,
  116. IN int nBitmapWidth,
  117. IN COLORREF crBackground = RGB(0,255,0) /* Green */
  118. );
  119. ~CRMCListBoxResources();
  120. //
  121. // Interface
  122. //
  123. public:
  124. void SysColorChanged();
  125. const CDC & dcBitMap() const;
  126. int BitmapHeight() const;
  127. int BitmapWidth() const;
  128. COLORREF ColorWindow() const;
  129. COLORREF ColorHighlight() const;
  130. COLORREF ColorWindowText() const;
  131. COLORREF ColorHighlightText() const;
  132. //
  133. // Internal Helpers
  134. //
  135. protected:
  136. void GetSysColors();
  137. void PrepareBitmaps();
  138. void UnprepareBitmaps();
  139. void UnloadResources();
  140. void LoadResources();
  141. private:
  142. COLORREF m_rgbColorWindow;
  143. COLORREF m_rgbColorHighlight;
  144. COLORREF m_rgbColorWindowText;
  145. COLORREF m_rgbColorHighlightText;
  146. COLORREF m_rgbColorTransparent;
  147. HGDIOBJ m_hOldBitmap;
  148. CBitmap m_bmpScreen;
  149. CDC m_dcFinal;
  150. BOOL m_fInitialized;
  151. int m_idBitmap;
  152. int m_nBitmapHeight;
  153. int m_nBitmapWidth;
  154. int m_nBitmaps;
  155. };
  156. class COMDLL CRMCListBoxDrawStruct
  157. {
  158. /*++
  159. Class Description:
  160. Drawing information passed on to ODLBox
  161. Public Interface:
  162. CRMCListBoxDrawStruct : Constructor
  163. --*/
  164. public:
  165. CRMCListBoxDrawStruct(
  166. IN CDC * pDC,
  167. IN RECT * pRect,
  168. IN BOOL sel,
  169. IN DWORD_PTR item,
  170. IN int itemIndex,
  171. IN const CRMCListBoxResources * pres
  172. );
  173. public:
  174. const CRMCListBoxResources * m_pResources;
  175. int m_ItemIndex;
  176. CDC * m_pDC;
  177. CRect m_Rect;
  178. BOOL m_Sel;
  179. DWORD_PTR m_ItemData;
  180. };
  181. /* abstract */ class COMDLL CODLBox
  182. /*++
  183. Class Description:
  184. abstract base class for owner-draw listbox and combobox
  185. Public Interface:
  186. AttachResources : Attach the resource structure to the list/combo box
  187. ChangeFont : Change the font
  188. NumTabs : Get the number of tabs currently set
  189. AddTab : Add tab
  190. AddTabFromHeaders : Add tab computed from the difference in left coordinate
  191. of two controls.
  192. InsertTab : Insert a tab
  193. RemoveTab : Remove a tab
  194. RemoveAllTabs : Remove all tabs
  195. SetTab : Set tab value
  196. GetTab : Get tab value
  197. TextHeight : Get the text height of the current font
  198. __GetCount : Pure virtual function to get the number of items in the
  199. list/combo box
  200. __SetItemHeight : Pure virtual function to set the text height of the font
  201. --*/
  202. {
  203. //
  204. // Operations
  205. //
  206. public:
  207. void AttachResources(
  208. IN const CRMCListBoxResources * pResources
  209. );
  210. BOOL ChangeFont(
  211. CFont * pNewFont
  212. );
  213. int NumTabs() const;
  214. int AddTab(
  215. IN UINT uTab
  216. );
  217. int AddTabFromHeaders(
  218. IN CWnd & wndLeft,
  219. IN CWnd & wndRight
  220. );
  221. int AddTabFromHeaders(
  222. IN UINT idLeft,
  223. IN UINT idRight
  224. );
  225. void InsertTab(
  226. IN int nIndex,
  227. IN UINT uTab
  228. );
  229. void RemoveTab(
  230. IN int nIndex,
  231. IN int nCount = 1
  232. );
  233. void RemoveAllTabs();
  234. void SetTab(
  235. IN int nIndex,
  236. IN UINT uTab
  237. );
  238. UINT GetTab(
  239. IN int nIndex
  240. ) const;
  241. int TextHeight() const;
  242. /* pure */ virtual int __GetCount() const = 0;
  243. /* pure */ virtual int __SetItemHeight(
  244. IN int nIndex,
  245. IN UINT cyItemHeight
  246. ) = 0;
  247. protected:
  248. CODLBox();
  249. ~CODLBox();
  250. protected:
  251. //
  252. // Determine required display width of the string
  253. //
  254. static int GetRequiredWidth(
  255. IN CDC * pDC,
  256. IN const CRect & rc,
  257. IN LPCTSTR lpstr,
  258. IN int nLength
  259. );
  260. //
  261. // Helper function to display text in a limited rectangle
  262. //
  263. static BOOL ColumnText(
  264. IN CDC * pDC,
  265. IN int left,
  266. IN int top,
  267. IN int right,
  268. IN int bottom,
  269. IN LPCTSTR str
  270. );
  271. protected:
  272. //
  273. // Helper functions for displaying bitmaps and text
  274. //
  275. BOOL DrawBitmap(
  276. IN CRMCListBoxDrawStruct & ds,
  277. IN int nCol,
  278. IN int nID
  279. );
  280. BOOL ColumnText(
  281. IN CRMCListBoxDrawStruct & ds,
  282. IN int nCol,
  283. IN BOOL fSkipBitmap,
  284. IN LPCTSTR lpstr
  285. );
  286. void ComputeMargins(
  287. IN CRMCListBoxDrawStruct & ds,
  288. IN int nCol,
  289. OUT int & nLeft,
  290. OUT int & nRight
  291. );
  292. protected:
  293. void CalculateTextHeight(
  294. IN CFont * pFont
  295. );
  296. void AttachWindow(
  297. IN CWnd * pWnd
  298. );
  299. protected:
  300. //
  301. // must override this to provide drawing of item
  302. //
  303. /* pure */ virtual void DrawItemEx(
  304. IN CRMCListBoxDrawStruct & dw
  305. ) = 0;
  306. void __MeasureItem(
  307. IN OUT LPMEASUREITEMSTRUCT lpMIS
  308. );
  309. void __DrawItem(
  310. IN LPDRAWITEMSTRUCT lpDIS
  311. );
  312. virtual BOOL Initialize();
  313. protected:
  314. int m_lfHeight;
  315. const CRMCListBoxResources* m_pResources;
  316. private:
  317. //
  318. // Window handle -- to be attached by derived class
  319. //
  320. CWnd * m_pWnd;
  321. CUIntArray m_auTabs;
  322. };
  323. //
  324. // Forward decleration
  325. //
  326. class CHeaderListBox;
  327. //
  328. // Styles for listbox headers
  329. //
  330. #define HLS_STRETCH (0x00000001)
  331. #define HLS_BUTTONS (0x00000002)
  332. #define HLS_DEFAULT (HLS_STRETCH | HLS_BUTTONS)
  333. class COMDLL CRMCListBoxHeader : public CStatic
  334. /*++
  335. Class Description:
  336. Header object to be used in conjunction with listbox
  337. Public Interface:
  338. CRMCListBoxHeader : Constructor
  339. ~CRMCListBoxHeader : Destructor
  340. Create : Create control
  341. GetItemCount : Get the number of items in the header control
  342. GetColumnWidth : Get column width of a specific column
  343. QueryNumColumns : Get the number of columns in the listbox
  344. SetColumnWidth : Set the width of specified column
  345. GetItem : Get header item information about specific
  346. column
  347. SetItem : Set header item information about specific
  348. column
  349. InsertItem : Insert header item
  350. DeleteItem : Delete header item
  351. RespondToColumnWidthChanges : Set response flagg
  352. --*/
  353. {
  354. DECLARE_DYNAMIC(CRMCListBoxHeader)
  355. public:
  356. //
  357. // Constructor
  358. //
  359. CRMCListBoxHeader(
  360. IN DWORD dwStyle = HLS_DEFAULT
  361. );
  362. ~CRMCListBoxHeader();
  363. //
  364. // Create control
  365. //
  366. BOOL Create(
  367. IN DWORD dwStyle,
  368. IN const RECT & rect,
  369. IN CWnd * pParentWnd,
  370. IN CHeaderListBox * pListBox,
  371. IN UINT nID
  372. );
  373. //
  374. // Header control stuff
  375. //
  376. public:
  377. int GetItemCount() const;
  378. int GetColumnWidth(
  379. IN int nPos
  380. ) const;
  381. BOOL GetItem(
  382. IN int nPos,
  383. IN HD_ITEM * pHeaderItem
  384. ) const;
  385. BOOL SetItem(
  386. IN int nPos,
  387. IN HD_ITEM * pHeaderItem
  388. );
  389. int InsertItem(
  390. IN int nPos,
  391. IN HD_ITEM * phdi
  392. );
  393. BOOL DeleteItem(
  394. IN int nPos
  395. );
  396. void SetColumnWidth(
  397. IN int nCol,
  398. IN int nWidth
  399. );
  400. BOOL DoesRespondToColumnWidthChanges() const;
  401. void RespondToColumnWidthChanges(
  402. IN BOOL fRespond = TRUE
  403. );
  404. int QueryNumColumns() const;
  405. protected:
  406. //{{AFX_MSG(CRMCListBoxHeader)
  407. afx_msg void OnDestroy();
  408. //}}AFX_MSG
  409. afx_msg void OnHeaderItemChanged(UINT nId, NMHDR * n, LRESULT * l);
  410. afx_msg void OnHeaderEndTrack(UINT nId, NMHDR * n, LRESULT * l);
  411. afx_msg void OnHeaderItemClick(UINT nId, NMHDR * n, LRESULT * l);
  412. afx_msg void OnSetFocus(CWnd * pWnd);
  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. IN HINSTANCE hResInst
  610. );
  611. void ConvertColumnWidth(
  612. IN int nCol,
  613. IN int nTotalWeight,
  614. IN int nTotalWidth
  615. );
  616. BOOL SetWidthsFromReg();
  617. void DistributeColumns();
  618. protected:
  619. //{{AFX_MSG(CHeaderListBox)
  620. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  621. afx_msg void OnDestroy();
  622. //}}AFX_MSG
  623. DECLARE_MESSAGE_MAP()
  624. private:
  625. BOOL m_fInitialized;
  626. CString m_strRegKey;
  627. CRMCListBoxHeader * m_pHeader;
  628. };
  629. class COMDLL CRMCComboBox : public CComboBox, public CODLBox
  630. /*++
  631. Class Description:
  632. Super combo box class
  633. Public Interface:
  634. CRMCComboBox : Constructor
  635. ~CRMCComboBox : Destructor
  636. Initialize : Initialize the control
  637. __GetCount : Get the count of items in the combobox
  638. __SetItemHeight : Set the item height in the combobox
  639. InvalidateSelection : Invalidate selection
  640. --*/
  641. {
  642. DECLARE_DYNAMIC(CRMCComboBox)
  643. //
  644. // Construction
  645. //
  646. public:
  647. CRMCComboBox();
  648. virtual BOOL Initialize();
  649. //
  650. // Implementation
  651. //
  652. public:
  653. virtual ~CRMCComboBox();
  654. virtual int __GetCount() const;
  655. virtual int __SetItemHeight(
  656. IN int nIndex,
  657. IN UINT cyItemHeight
  658. );
  659. void InvalidateSelection(
  660. IN int nSel
  661. );
  662. protected:
  663. //
  664. // Do-nothing drawitemex for non-owner draw comboboxes.
  665. //
  666. virtual void DrawItemEx(
  667. IN CRMCListBoxDrawStruct & dw
  668. );
  669. virtual void MeasureItem(
  670. IN OUT LPMEASUREITEMSTRUCT lpMIS
  671. );
  672. virtual void DrawItem(
  673. IN LPDRAWITEMSTRUCT lpDIS
  674. );
  675. protected:
  676. //{{AFX_MSG(CRMCComboBox)
  677. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  678. //}}AFX_MSG
  679. DECLARE_MESSAGE_MAP()
  680. private:
  681. BOOL m_fInitialized;
  682. };
  683. //
  684. // Inline Expansion
  685. //
  686. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  687. inline CMappedBitmapButton::CMappedBitmapButton()
  688. {
  689. };
  690. inline CUpButton::CUpButton()
  691. {
  692. LoadMappedBitmaps(IDB_UP, IDB_UPINV, IDB_UPFOC, IDB_UPDIS);
  693. }
  694. inline CDownButton::CDownButton()
  695. {
  696. LoadMappedBitmaps(IDB_DOWN, IDB_DOWNINV, IDB_DOWNFOC, IDB_DOWNDIS);
  697. }
  698. inline const CDC & CRMCListBoxResources::dcBitMap() const
  699. {
  700. return m_dcFinal;
  701. }
  702. inline int CRMCListBoxResources::BitmapHeight() const
  703. {
  704. return m_nBitmapHeight;
  705. }
  706. inline int CRMCListBoxResources::BitmapWidth() const
  707. {
  708. return m_nBitmapWidth;
  709. }
  710. inline COLORREF CRMCListBoxResources::ColorWindow() const
  711. {
  712. return m_rgbColorWindow;
  713. }
  714. inline COLORREF CRMCListBoxResources::ColorHighlight() const
  715. {
  716. return m_rgbColorHighlight;
  717. }
  718. inline COLORREF CRMCListBoxResources::ColorWindowText() const
  719. {
  720. return m_rgbColorWindowText;
  721. }
  722. inline COLORREF CRMCListBoxResources::ColorHighlightText() const
  723. {
  724. return m_rgbColorHighlightText;
  725. }
  726. inline int CODLBox::NumTabs() const
  727. {
  728. return (int)m_auTabs.GetSize();
  729. }
  730. inline void CODLBox::SetTab(
  731. IN int nIndex,
  732. IN UINT uTab
  733. )
  734. {
  735. ASSERT(nIndex >= 0 && nIndex < NumTabs());
  736. m_auTabs[nIndex] = uTab;
  737. }
  738. inline UINT CODLBox::GetTab(
  739. IN int nIndex
  740. ) const
  741. {
  742. ASSERT(nIndex >= 0 && nIndex < NumTabs());
  743. return m_auTabs[nIndex];
  744. }
  745. inline int CODLBox::TextHeight() const
  746. {
  747. return m_lfHeight;
  748. }
  749. inline void CODLBox::AttachWindow(
  750. IN CWnd * pWnd
  751. )
  752. {
  753. m_pWnd = pWnd;
  754. }
  755. inline BOOL CRMCListBoxHeader::DoesRespondToColumnWidthChanges() const
  756. {
  757. return m_fRespondToColumnWidthChanges;
  758. }
  759. inline void CRMCListBoxHeader::RespondToColumnWidthChanges(
  760. IN BOOL fRespond
  761. )
  762. {
  763. m_fRespondToColumnWidthChanges = fRespond;
  764. }
  765. inline int CRMCListBoxHeader::QueryNumColumns() const
  766. {
  767. return GetItemCount();
  768. }
  769. inline BOOL CRMCListBoxHeader::UseStretch() const
  770. {
  771. return (m_dwStyle & HLS_STRETCH) != 0L;
  772. }
  773. inline BOOL CRMCListBoxHeader::UseButtons() const
  774. {
  775. return (m_dwStyle & HLS_BUTTONS) != 0L;
  776. }
  777. inline int CHeaderListBox::QueryNumColumns() const
  778. {
  779. return GetHeaderItemCount();
  780. }
  781. inline int CHeaderListBox::GetHeaderItemCount() const
  782. {
  783. ASSERT_PTR(m_pHeader);
  784. return m_pHeader->GetItemCount();
  785. }
  786. inline BOOL CHeaderListBox::GetHeaderItem(
  787. IN int nPos,
  788. IN HD_ITEM * pHeaderItem
  789. ) const
  790. {
  791. ASSERT_PTR(m_pHeader);
  792. return m_pHeader->GetItem(nPos, pHeaderItem);
  793. }
  794. inline BOOL CHeaderListBox::SetHeaderItem(
  795. IN int nPos,
  796. IN HD_ITEM * pHeaderItem
  797. )
  798. {
  799. ASSERT_PTR(m_pHeader);
  800. return m_pHeader->SetItem(nPos, pHeaderItem);
  801. }
  802. inline int CHeaderListBox::InsertHeaderItem(
  803. IN int nPos,
  804. IN HD_ITEM * phdi
  805. )
  806. {
  807. ASSERT_PTR(m_pHeader);
  808. return m_pHeader->InsertItem(nPos, phdi);
  809. }
  810. inline BOOL CHeaderListBox::DeleteHeaderItem(
  811. IN int nPos
  812. )
  813. {
  814. ASSERT_PTR(m_pHeader);
  815. return m_pHeader->DeleteItem(nPos);
  816. }
  817. inline CRMCListBoxHeader * CHeaderListBox::GetHeader()
  818. {
  819. return m_pHeader;
  820. }
  821. inline BOOL CRMCListBox::IsMultiSelect() const
  822. {
  823. ASSERT(m_fInitialized);
  824. return m_fMultiSelect;
  825. }
  826. #endif // _ODLBOX_H_