Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: xfa/fwl/core/ifwl_listbox.h

Issue 2494743002: IFWL cleanup in the Combo classes (Closed)
Patch Set: Review feedback Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/ifwl_combolist.h ('k') | xfa/fwl/core/ifwl_widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef XFA_FWL_CORE_IFWL_LISTBOX_H_ 7 #ifndef XFA_FWL_CORE_IFWL_LISTBOX_H_
8 #define XFA_FWL_CORE_IFWL_LISTBOX_H_ 8 #define XFA_FWL_CORE_IFWL_LISTBOX_H_
9 9
10 #include <memory> 10 #include <memory>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 FWL_EVENT_DEF(CFWL_EvtLtbDrawItem, 45 FWL_EVENT_DEF(CFWL_EvtLtbDrawItem,
46 CFWL_EventType::DrawItem, 46 CFWL_EventType::DrawItem,
47 CFX_Graphics* m_pGraphics; 47 CFX_Graphics* m_pGraphics;
48 CFX_Matrix m_matrix; 48 CFX_Matrix m_matrix;
49 int32_t m_index; 49 int32_t m_index;
50 CFX_RectF m_rect;) 50 CFX_RectF m_rect;)
51 51
52 class IFWL_ListBoxDP : public IFWL_DataProvider { 52 class IFWL_ListBoxDP : public IFWL_DataProvider {
53 public: 53 public:
54 virtual int32_t CountItems(const IFWL_Widget* pWidget) = 0; 54 virtual int32_t CountItems(const IFWL_Widget* pWidget) const = 0;
55 virtual CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, 55 virtual CFWL_ListItem* GetItem(const IFWL_Widget* pWidget,
56 int32_t nIndex) = 0; 56 int32_t nIndex) const = 0;
57 virtual int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) = 0; 57 virtual int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) = 0;
58 virtual bool SetItemIndex(IFWL_Widget* pWidget, 58 virtual bool SetItemIndex(IFWL_Widget* pWidget,
59 CFWL_ListItem* pItem, 59 CFWL_ListItem* pItem,
60 int32_t nIndex) = 0; 60 int32_t nIndex) = 0;
61 virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, 61 virtual uint32_t GetItemStyles(IFWL_Widget* pWidget,
62 CFWL_ListItem* pItem) = 0; 62 CFWL_ListItem* pItem) = 0;
63 virtual void GetItemText(IFWL_Widget* pWidget, 63 virtual void GetItemText(IFWL_Widget* pWidget,
64 CFWL_ListItem* pItem, 64 CFWL_ListItem* pItem,
65 CFX_WideString& wsText) = 0; 65 CFX_WideString& wsText) = 0;
66 virtual void GetItemRect(IFWL_Widget* pWidget, 66 virtual void GetItemRect(IFWL_Widget* pWidget,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 void OnDrawWidget(CFX_Graphics* pGraphics, 112 void OnDrawWidget(CFX_Graphics* pGraphics,
113 const CFX_Matrix* pMatrix) override; 113 const CFX_Matrix* pMatrix) override;
114 114
115 int32_t CountSelItems(); 115 int32_t CountSelItems();
116 CFWL_ListItem* GetSelItem(int32_t nIndexSel); 116 CFWL_ListItem* GetSelItem(int32_t nIndexSel);
117 int32_t GetSelIndex(int32_t nIndex); 117 int32_t GetSelIndex(int32_t nIndex);
118 void SetSelItem(CFWL_ListItem* hItem, bool bSelect = true); 118 void SetSelItem(CFWL_ListItem* hItem, bool bSelect = true);
119 void GetItemText(CFWL_ListItem* hItem, CFX_WideString& wsText); 119 void GetItemText(CFWL_ListItem* hItem, CFX_WideString& wsText);
120 void GetScrollPos(FX_FLOAT& fPos, bool bVert = true); 120 void GetScrollPos(FX_FLOAT& fPos, bool bVert = true);
121 121
122 FX_FLOAT GetItemHeight() const { return m_fItemHeight; }
123 FX_FLOAT CalcItemHeight();
124
122 protected: 125 protected:
123 CFWL_ListItem* GetItem(CFWL_ListItem* hItem, uint32_t dwKeyCode); 126 CFWL_ListItem* GetItem(CFWL_ListItem* hItem, uint32_t dwKeyCode);
124 void SetSelection(CFWL_ListItem* hStart, CFWL_ListItem* hEnd, bool bSelected); 127 void SetSelection(CFWL_ListItem* hStart, CFWL_ListItem* hEnd, bool bSelected);
125 CFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); 128 CFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy);
126 bool ScrollToVisible(CFWL_ListItem* hItem); 129 bool ScrollToVisible(CFWL_ListItem* hItem);
127 FX_FLOAT CalcItemHeight();
128 void InitScrollBar(bool bVert = true); 130 void InitScrollBar(bool bVert = true);
129 bool IsShowScrollBar(bool bVert); 131 bool IsShowScrollBar(bool bVert);
130 FX_FLOAT GetItemHeight() const { return m_fItemHeight; }
131 IFWL_ScrollBar* GetVertScrollBar() const { return m_pVertScrollBar.get(); } 132 IFWL_ScrollBar* GetVertScrollBar() const { return m_pVertScrollBar.get(); }
132 const CFX_RectF& GetRTClient() const { return m_rtClient; } 133 const CFX_RectF& GetRTClient() const { return m_rtClient; }
133 134
134 private: 135 private:
135 void SetSelectionDirect(CFWL_ListItem* hItem, bool bSelect); 136 void SetSelectionDirect(CFWL_ListItem* hItem, bool bSelect);
136 bool IsItemSelected(CFWL_ListItem* hItem); 137 bool IsItemSelected(CFWL_ListItem* hItem);
137 void ClearSelection(); 138 void ClearSelection();
138 void SelectAll(); 139 void SelectAll();
139 CFWL_ListItem* GetFocusedItem(); 140 CFWL_ListItem* GetFocusedItem();
140 void SetFocusItem(CFWL_ListItem* hItem); 141 void SetFocusItem(CFWL_ListItem* hItem);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 uint32_t m_dwTTOStyles; 181 uint32_t m_dwTTOStyles;
181 int32_t m_iTTOAligns; 182 int32_t m_iTTOAligns;
182 CFWL_ListItem* m_hAnchor; 183 CFWL_ListItem* m_hAnchor;
183 FX_FLOAT m_fItemHeight; 184 FX_FLOAT m_fItemHeight;
184 FX_FLOAT m_fScorllBarWidth; 185 FX_FLOAT m_fScorllBarWidth;
185 bool m_bLButtonDown; 186 bool m_bLButtonDown;
186 IFWL_ThemeProvider* m_pScrollBarTP; 187 IFWL_ThemeProvider* m_pScrollBarTP;
187 }; 188 };
188 189
189 #endif // XFA_FWL_CORE_IFWL_LISTBOX_H_ 190 #endif // XFA_FWL_CORE_IFWL_LISTBOX_H_
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_combolist.h ('k') | xfa/fwl/core/ifwl_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698