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

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

Issue 2487943003: Rename IFWL_ListItem to CFWL_ListItem (Closed)
Patch Set: cleanup 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.cpp ('k') | xfa/fwl/core/ifwl_listbox.cpp » ('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>
11 11
12 #include "xfa/fwl/core/cfwl_event.h" 12 #include "xfa/fwl/core/cfwl_event.h"
13 #include "xfa/fwl/core/cfwl_listitem.h"
13 #include "xfa/fwl/core/cfwl_widgetproperties.h" 14 #include "xfa/fwl/core/cfwl_widgetproperties.h"
14 #include "xfa/fwl/core/ifwl_dataprovider.h" 15 #include "xfa/fwl/core/ifwl_dataprovider.h"
15 #include "xfa/fwl/core/ifwl_edit.h" 16 #include "xfa/fwl/core/ifwl_edit.h"
16 #include "xfa/fwl/core/ifwl_listbox.h" 17 #include "xfa/fwl/core/ifwl_listbox.h"
17 #include "xfa/fwl/core/ifwl_widget.h" 18 #include "xfa/fwl/core/ifwl_widget.h"
18 19
19 #define FWL_STYLEEXT_LTB_MultiSelection (1L << 0) 20 #define FWL_STYLEEXT_LTB_MultiSelection (1L << 0)
20 #define FWL_STYLEEXT_LTB_ShowScrollBarAlaways (1L << 2) 21 #define FWL_STYLEEXT_LTB_ShowScrollBarAlaways (1L << 2)
21 #define FWL_STYLEEXT_LTB_MultiColumn (1L << 3) 22 #define FWL_STYLEEXT_LTB_MultiColumn (1L << 3)
22 #define FWL_STYLEEXT_LTB_LeftAlign (0L << 4) 23 #define FWL_STYLEEXT_LTB_LeftAlign (0L << 4)
(...skipping 18 matching lines...) Expand all
41 CFWL_EventType::SelectChanged, 42 CFWL_EventType::SelectChanged,
42 CFX_Int32Array iarraySels;) 43 CFX_Int32Array iarraySels;)
43 44
44 FWL_EVENT_DEF(CFWL_EvtLtbDrawItem, 45 FWL_EVENT_DEF(CFWL_EvtLtbDrawItem,
45 CFWL_EventType::DrawItem, 46 CFWL_EventType::DrawItem,
46 CFX_Graphics* m_pGraphics; 47 CFX_Graphics* m_pGraphics;
47 CFX_Matrix m_matrix; 48 CFX_Matrix m_matrix;
48 int32_t m_index; 49 int32_t m_index;
49 CFX_RectF m_rect;) 50 CFX_RectF m_rect;)
50 51
51 class IFWL_ListItem {};
52
53 class IFWL_ListBoxDP : public IFWL_DataProvider { 52 class IFWL_ListBoxDP : public IFWL_DataProvider {
54 public: 53 public:
55 virtual int32_t CountItems(const IFWL_Widget* pWidget) = 0; 54 virtual int32_t CountItems(const IFWL_Widget* pWidget) = 0;
56 virtual IFWL_ListItem* GetItem(const IFWL_Widget* pWidget, 55 virtual CFWL_ListItem* GetItem(const IFWL_Widget* pWidget,
57 int32_t nIndex) = 0; 56 int32_t nIndex) = 0;
58 virtual int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) = 0; 57 virtual int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) = 0;
59 virtual bool SetItemIndex(IFWL_Widget* pWidget, 58 virtual bool SetItemIndex(IFWL_Widget* pWidget,
60 IFWL_ListItem* pItem, 59 CFWL_ListItem* pItem,
61 int32_t nIndex) = 0; 60 int32_t nIndex) = 0;
62 virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, 61 virtual uint32_t GetItemStyles(IFWL_Widget* pWidget,
63 IFWL_ListItem* pItem) = 0; 62 CFWL_ListItem* pItem) = 0;
64 virtual FWL_Error GetItemText(IFWL_Widget* pWidget, 63 virtual FWL_Error GetItemText(IFWL_Widget* pWidget,
65 IFWL_ListItem* pItem, 64 CFWL_ListItem* pItem,
66 CFX_WideString& wsText) = 0; 65 CFX_WideString& wsText) = 0;
67 virtual FWL_Error GetItemRect(IFWL_Widget* pWidget, 66 virtual FWL_Error GetItemRect(IFWL_Widget* pWidget,
68 IFWL_ListItem* pItem, 67 CFWL_ListItem* pItem,
69 CFX_RectF& rtItem) = 0; 68 CFX_RectF& rtItem) = 0;
70 virtual void* GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) = 0; 69 virtual void* GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) = 0;
71 virtual FWL_Error SetItemStyles(IFWL_Widget* pWidget, 70 virtual FWL_Error SetItemStyles(IFWL_Widget* pWidget,
72 IFWL_ListItem* pItem, 71 CFWL_ListItem* pItem,
73 uint32_t dwStyle) = 0; 72 uint32_t dwStyle) = 0;
74 virtual FWL_Error SetItemText(IFWL_Widget* pWidget, 73 virtual FWL_Error SetItemText(IFWL_Widget* pWidget,
75 IFWL_ListItem* pItem, 74 CFWL_ListItem* pItem,
76 const FX_WCHAR* pszText) = 0; 75 const FX_WCHAR* pszText) = 0;
77 virtual FWL_Error SetItemRect(IFWL_Widget* pWidget, 76 virtual FWL_Error SetItemRect(IFWL_Widget* pWidget,
78 IFWL_ListItem* pItem, 77 CFWL_ListItem* pItem,
79 const CFX_RectF& rtItem) = 0; 78 const CFX_RectF& rtItem) = 0;
80 virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) = 0; 79 virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) = 0;
81 virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, 80 virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
82 IFWL_ListItem* pItem) = 0; 81 CFWL_ListItem* pItem) = 0;
83 virtual FWL_Error GetItemCheckRect(IFWL_Widget* pWidget, 82 virtual FWL_Error GetItemCheckRect(IFWL_Widget* pWidget,
84 IFWL_ListItem* pItem, 83 CFWL_ListItem* pItem,
85 CFX_RectF& rtCheck) = 0; 84 CFX_RectF& rtCheck) = 0;
86 virtual FWL_Error SetItemCheckRect(IFWL_Widget* pWidget, 85 virtual FWL_Error SetItemCheckRect(IFWL_Widget* pWidget,
87 IFWL_ListItem* pItem, 86 CFWL_ListItem* pItem,
88 const CFX_RectF& rtCheck) = 0; 87 const CFX_RectF& rtCheck) = 0;
89 virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget, 88 virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget,
90 IFWL_ListItem* pItem) = 0; 89 CFWL_ListItem* pItem) = 0;
91 virtual FWL_Error SetItemCheckState(IFWL_Widget* pWidget, 90 virtual FWL_Error SetItemCheckState(IFWL_Widget* pWidget,
92 IFWL_ListItem* pItem, 91 CFWL_ListItem* pItem,
93 uint32_t dwCheckState) = 0; 92 uint32_t dwCheckState) = 0;
94 }; 93 };
95 94
96 class IFWL_ListBoxCompare { 95 class IFWL_ListBoxCompare {
97 public: 96 public:
98 virtual ~IFWL_ListBoxCompare() {} 97 virtual ~IFWL_ListBoxCompare() {}
99 virtual int32_t Compare(IFWL_ListItem* hLeft, IFWL_ListItem* hRight) = 0; 98 virtual int32_t Compare(CFWL_ListItem* hLeft, CFWL_ListItem* hRight) = 0;
100 }; 99 };
101 100
102 class IFWL_ListBox : public IFWL_Widget { 101 class IFWL_ListBox : public IFWL_Widget {
103 public: 102 public:
104 IFWL_ListBox(const IFWL_App* app, 103 IFWL_ListBox(const IFWL_App* app,
105 std::unique_ptr<CFWL_WidgetProperties> properties, 104 std::unique_ptr<CFWL_WidgetProperties> properties,
106 IFWL_Widget* pOuter); 105 IFWL_Widget* pOuter);
107 ~IFWL_ListBox() override; 106 ~IFWL_ListBox() override;
108 107
109 // IFWL_Widget 108 // IFWL_Widget
110 FWL_Type GetClassID() const override; 109 FWL_Type GetClassID() const override;
111 FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; 110 FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override;
112 FWL_Error Update() override; 111 FWL_Error Update() override;
113 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; 112 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
114 FWL_Error DrawWidget(CFX_Graphics* pGraphics, 113 FWL_Error DrawWidget(CFX_Graphics* pGraphics,
115 const CFX_Matrix* pMatrix = nullptr) override; 114 const CFX_Matrix* pMatrix = nullptr) override;
116 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; 115 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override;
117 void OnProcessMessage(CFWL_Message* pMessage) override; 116 void OnProcessMessage(CFWL_Message* pMessage) override;
118 void OnProcessEvent(CFWL_Event* pEvent) override; 117 void OnProcessEvent(CFWL_Event* pEvent) override;
119 void OnDrawWidget(CFX_Graphics* pGraphics, 118 void OnDrawWidget(CFX_Graphics* pGraphics,
120 const CFX_Matrix* pMatrix) override; 119 const CFX_Matrix* pMatrix) override;
121 120
122 int32_t CountSelItems(); 121 int32_t CountSelItems();
123 IFWL_ListItem* GetSelItem(int32_t nIndexSel); 122 CFWL_ListItem* GetSelItem(int32_t nIndexSel);
124 int32_t GetSelIndex(int32_t nIndex); 123 int32_t GetSelIndex(int32_t nIndex);
125 FWL_Error SetSelItem(IFWL_ListItem* hItem, bool bSelect = true); 124 FWL_Error SetSelItem(CFWL_ListItem* hItem, bool bSelect = true);
126 FWL_Error GetItemText(IFWL_ListItem* hItem, CFX_WideString& wsText); 125 FWL_Error GetItemText(CFWL_ListItem* hItem, CFX_WideString& wsText);
127 FWL_Error GetScrollPos(FX_FLOAT& fPos, bool bVert = true); 126 FWL_Error GetScrollPos(FX_FLOAT& fPos, bool bVert = true);
128 FWL_Error* Sort(IFWL_ListBoxCompare* pCom); 127 FWL_Error* Sort(IFWL_ListBoxCompare* pCom);
129 128
130 protected: 129 protected:
131 friend class CFWL_ListBoxImpDelegate; 130 friend class CFWL_ListBoxImpDelegate;
132 131
133 IFWL_ListItem* GetItem(IFWL_ListItem* hItem, uint32_t dwKeyCode); 132 CFWL_ListItem* GetItem(CFWL_ListItem* hItem, uint32_t dwKeyCode);
134 void SetSelection(IFWL_ListItem* hStart, IFWL_ListItem* hEnd, bool bSelected); 133 void SetSelection(CFWL_ListItem* hStart, CFWL_ListItem* hEnd, bool bSelected);
135 void SetSelectionDirect(IFWL_ListItem* hItem, bool bSelect); 134 void SetSelectionDirect(CFWL_ListItem* hItem, bool bSelect);
136 bool IsItemSelected(IFWL_ListItem* hItem); 135 bool IsItemSelected(CFWL_ListItem* hItem);
137 void ClearSelection(); 136 void ClearSelection();
138 void SelectAll(); 137 void SelectAll();
139 IFWL_ListItem* GetFocusedItem(); 138 CFWL_ListItem* GetFocusedItem();
140 void SetFocusItem(IFWL_ListItem* hItem); 139 void SetFocusItem(CFWL_ListItem* hItem);
141 IFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); 140 CFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy);
142 bool GetItemCheckRect(IFWL_ListItem* hItem, CFX_RectF& rtCheck); 141 bool GetItemCheckRect(CFWL_ListItem* hItem, CFX_RectF& rtCheck);
143 bool SetItemChecked(IFWL_ListItem* hItem, bool bChecked); 142 bool SetItemChecked(CFWL_ListItem* hItem, bool bChecked);
144 bool GetItemChecked(IFWL_ListItem* hItem); 143 bool GetItemChecked(CFWL_ListItem* hItem);
145 bool ScrollToVisible(IFWL_ListItem* hItem); 144 bool ScrollToVisible(CFWL_ListItem* hItem);
146 void DrawBkground(CFX_Graphics* pGraphics, 145 void DrawBkground(CFX_Graphics* pGraphics,
147 IFWL_ThemeProvider* pTheme, 146 IFWL_ThemeProvider* pTheme,
148 const CFX_Matrix* pMatrix = nullptr); 147 const CFX_Matrix* pMatrix = nullptr);
149 void DrawItems(CFX_Graphics* pGraphics, 148 void DrawItems(CFX_Graphics* pGraphics,
150 IFWL_ThemeProvider* pTheme, 149 IFWL_ThemeProvider* pTheme,
151 const CFX_Matrix* pMatrix = nullptr); 150 const CFX_Matrix* pMatrix = nullptr);
152 void DrawItem(CFX_Graphics* pGraphics, 151 void DrawItem(CFX_Graphics* pGraphics,
153 IFWL_ThemeProvider* pTheme, 152 IFWL_ThemeProvider* pTheme,
154 IFWL_ListItem* hItem, 153 CFWL_ListItem* hItem,
155 int32_t Index, 154 int32_t Index,
156 const CFX_RectF& rtItem, 155 const CFX_RectF& rtItem,
157 const CFX_Matrix* pMatrix = nullptr); 156 const CFX_Matrix* pMatrix = nullptr);
158 void DrawStatic(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme); 157 void DrawStatic(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme);
159 CFX_SizeF CalcSize(bool bAutoSize = false); 158 CFX_SizeF CalcSize(bool bAutoSize = false);
160 void GetItemSize(CFX_SizeF& size, 159 void GetItemSize(CFX_SizeF& size,
161 IFWL_ListItem* hItem, 160 CFWL_ListItem* hItem,
162 FX_FLOAT fWidth, 161 FX_FLOAT fWidth,
163 FX_FLOAT fHeight, 162 FX_FLOAT fHeight,
164 bool bAutoSize = false); 163 bool bAutoSize = false);
165 FX_FLOAT GetMaxTextWidth(); 164 FX_FLOAT GetMaxTextWidth();
166 FX_FLOAT GetScrollWidth(); 165 FX_FLOAT GetScrollWidth();
167 FX_FLOAT GetItemHeigt(); 166 FX_FLOAT GetItemHeigt();
168 void InitScrollBar(bool bVert = true); 167 void InitScrollBar(bool bVert = true);
169 bool IsShowScrollBar(bool bVert); 168 bool IsShowScrollBar(bool bVert);
170 void ProcessSelChanged(); 169 void ProcessSelChanged();
171 170
172 CFX_RectF m_rtClient; 171 CFX_RectF m_rtClient;
173 CFX_RectF m_rtStatic; 172 CFX_RectF m_rtStatic;
174 CFX_RectF m_rtConent; 173 CFX_RectF m_rtConent;
175 std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar; 174 std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar;
176 std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar; 175 std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar;
177 uint32_t m_dwTTOStyles; 176 uint32_t m_dwTTOStyles;
178 int32_t m_iTTOAligns; 177 int32_t m_iTTOAligns;
179 IFWL_ListItem* m_hAnchor; 178 CFWL_ListItem* m_hAnchor;
180 FX_FLOAT m_fItemHeight; 179 FX_FLOAT m_fItemHeight;
181 FX_FLOAT m_fScorllBarWidth; 180 FX_FLOAT m_fScorllBarWidth;
182 bool m_bLButtonDown; 181 bool m_bLButtonDown;
183 IFWL_ThemeProvider* m_pScrollBarTP; 182 IFWL_ThemeProvider* m_pScrollBarTP;
184 183
185 private: 184 private:
186 void OnFocusChanged(CFWL_Message* pMsg, bool bSet = true); 185 void OnFocusChanged(CFWL_Message* pMsg, bool bSet = true);
187 void OnLButtonDown(CFWL_MsgMouse* pMsg); 186 void OnLButtonDown(CFWL_MsgMouse* pMsg);
188 void OnLButtonUp(CFWL_MsgMouse* pMsg); 187 void OnLButtonUp(CFWL_MsgMouse* pMsg);
189 void OnMouseWheel(CFWL_MsgMouseWheel* pMsg); 188 void OnMouseWheel(CFWL_MsgMouseWheel* pMsg);
190 void OnKeyDown(CFWL_MsgKey* pMsg); 189 void OnKeyDown(CFWL_MsgKey* pMsg);
191 void OnVK(IFWL_ListItem* hItem, bool bShift, bool bCtrl); 190 void OnVK(CFWL_ListItem* hItem, bool bShift, bool bCtrl);
192 bool OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); 191 bool OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos);
193 void DispatchSelChangedEv(); 192 void DispatchSelChangedEv();
194 }; 193 };
195 194
196 #endif // XFA_FWL_CORE_IFWL_LISTBOX_H_ 195 #endif // XFA_FWL_CORE_IFWL_LISTBOX_H_
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_combolist.cpp ('k') | xfa/fwl/core/ifwl_listbox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698