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

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

Issue 2480233003: Fold DataProviders into parent 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/cfwl_checkbox.cpp ('k') | xfa/fwl/core/cfwl_combobox.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_CFWL_COMBOBOX_H_ 7 #ifndef XFA_FWL_CORE_CFWL_COMBOBOX_H_
8 #define XFA_FWL_CORE_CFWL_COMBOBOX_H_ 8 #define XFA_FWL_CORE_CFWL_COMBOBOX_H_
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "xfa/fwl/core/cfwl_widget.h" 13 #include "xfa/fwl/core/cfwl_widget.h"
14 #include "xfa/fwl/core/ifwl_combobox.h" 14 #include "xfa/fwl/core/ifwl_combobox.h"
15 15
16 class IFWL_ComboBoxDP; 16 class CFWL_ComboBoxItem : public IFWL_ListItem {
17 class CFWL_ComboBoxDP; 17 public:
18 class CFWL_ComboBoxItem; 18 CFWL_ComboBoxItem();
19 ~CFWL_ComboBoxItem();
19 20
20 class CFWL_ComboBox : public CFWL_Widget { 21 CFX_RectF m_rtItem;
22 uint32_t m_dwStyles;
23 CFX_WideString m_wsText;
24 CFX_DIBitmap* m_pDIB;
25 uint32_t m_dwCheckState;
26 CFX_RectF m_rtCheckBox;
27 void* m_pData;
28 };
29
30 class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP {
21 public: 31 public:
22 CFWL_ComboBox(const IFWL_App*); 32 CFWL_ComboBox(const IFWL_App*);
23 ~CFWL_ComboBox() override; 33 ~CFWL_ComboBox() override;
24 34
25 void Initialize(); 35 void Initialize();
26 36
27 int32_t AddString(const CFX_WideStringC& wsText); 37 int32_t AddString(const CFX_WideStringC& wsText);
28 int32_t AddString(const CFX_WideStringC& wsText, CFX_DIBitmap* pIcon); 38 int32_t AddString(const CFX_WideStringC& wsText, CFX_DIBitmap* pIcon);
29 bool RemoveAt(int32_t iIndex); // Returns false iff |iIndex| out of range. 39 bool RemoveAt(int32_t iIndex); // Returns false iff |iIndex| out of range.
30 void RemoveAll(); 40 void RemoveAll();
(...skipping 30 matching lines...) Expand all
61 bool EditCopy(CFX_WideString& wsCopy); 71 bool EditCopy(CFX_WideString& wsCopy);
62 bool EditCut(CFX_WideString& wsCut); 72 bool EditCut(CFX_WideString& wsCut);
63 bool EditPaste(const CFX_WideString& wsPaste); 73 bool EditPaste(const CFX_WideString& wsPaste);
64 bool EditSelectAll(); 74 bool EditSelectAll();
65 bool EditDelete(); 75 bool EditDelete();
66 bool EditDeSelect(); 76 bool EditDeSelect();
67 FWL_Error GetBBox(CFX_RectF& rect); 77 FWL_Error GetBBox(CFX_RectF& rect);
68 FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, 78 FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded,
69 uint32_t dwStylesExRemoved); 79 uint32_t dwStylesExRemoved);
70 80
71 protected: 81 // IFWL_DataProvider
72 class CFWL_ComboBoxDP : public IFWL_ComboBoxDP { 82 FWL_Error GetCaption(IFWL_Widget* pWidget,
73 public: 83 CFX_WideString& wsCaption) override;
74 CFWL_ComboBoxDP();
75 ~CFWL_ComboBoxDP() override;
76 84
77 // IFWL_DataProvider 85 // IFWL_ListBoxDP
78 FWL_Error GetCaption(IFWL_Widget* pWidget, 86 int32_t CountItems(const IFWL_Widget* pWidget) override;
79 CFX_WideString& wsCaption) override; 87 IFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override;
88 int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
89 bool SetItemIndex(IFWL_Widget* pWidget,
90 IFWL_ListItem* pItem,
91 int32_t nIndex) override;
80 92
81 // IFWL_ListBoxDP 93 uint32_t GetItemStyles(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
82 int32_t CountItems(const IFWL_Widget* pWidget) override; 94 FWL_Error GetItemText(IFWL_Widget* pWidget,
83 IFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override; 95 IFWL_ListItem* pItem,
84 int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; 96 CFX_WideString& wsText) override;
85 bool SetItemIndex(IFWL_Widget* pWidget, 97 FWL_Error GetItemRect(IFWL_Widget* pWidget,
86 IFWL_ListItem* pItem, 98 IFWL_ListItem* pItem,
87 int32_t nIndex) override; 99 CFX_RectF& rtItem) override;
100 void* GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
101 FWL_Error SetItemStyles(IFWL_Widget* pWidget,
102 IFWL_ListItem* pItem,
103 uint32_t dwStyle) override;
104 FWL_Error SetItemText(IFWL_Widget* pWidget,
105 IFWL_ListItem* pItem,
106 const FX_WCHAR* pszText) override;
107 FWL_Error SetItemRect(IFWL_Widget* pWidget,
108 IFWL_ListItem* pItem,
109 const CFX_RectF& rtItem) override;
110 FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override;
111 CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
112 IFWL_ListItem* pItem) override;
113 FWL_Error GetItemCheckRect(IFWL_Widget* pWidget,
114 IFWL_ListItem* pItem,
115 CFX_RectF& rtCheck) override;
116 FWL_Error SetItemCheckRect(IFWL_Widget* pWidget,
117 IFWL_ListItem* pItem,
118 const CFX_RectF& rtCheck) override;
119 uint32_t GetItemCheckState(IFWL_Widget* pWidget,
120 IFWL_ListItem* pItem) override;
121 FWL_Error SetItemCheckState(IFWL_Widget* pWidget,
122 IFWL_ListItem* pItem,
123 uint32_t dwCheckState) override;
88 124
89 uint32_t GetItemStyles(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; 125 // IFWL_ComboBoxDP
90 FWL_Error GetItemText(IFWL_Widget* pWidget, 126 FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override;
91 IFWL_ListItem* pItem,
92 CFX_WideString& wsText) override;
93 FWL_Error GetItemRect(IFWL_Widget* pWidget,
94 IFWL_ListItem* pItem,
95 CFX_RectF& rtItem) override;
96 void* GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
97 FWL_Error SetItemStyles(IFWL_Widget* pWidget,
98 IFWL_ListItem* pItem,
99 uint32_t dwStyle) override;
100 FWL_Error SetItemText(IFWL_Widget* pWidget,
101 IFWL_ListItem* pItem,
102 const FX_WCHAR* pszText) override;
103 FWL_Error SetItemRect(IFWL_Widget* pWidget,
104 IFWL_ListItem* pItem,
105 const CFX_RectF& rtItem) override;
106 FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override;
107 CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
108 IFWL_ListItem* pItem) override;
109 FWL_Error GetItemCheckRect(IFWL_Widget* pWidget,
110 IFWL_ListItem* pItem,
111 CFX_RectF& rtCheck) override;
112 FWL_Error SetItemCheckRect(IFWL_Widget* pWidget,
113 IFWL_ListItem* pItem,
114 const CFX_RectF& rtCheck) override;
115 uint32_t GetItemCheckState(IFWL_Widget* pWidget,
116 IFWL_ListItem* pItem) override;
117 FWL_Error SetItemCheckState(IFWL_Widget* pWidget,
118 IFWL_ListItem* pItem,
119 uint32_t dwCheckState) override;
120 127
121 // IFWL_ComboBoxDP 128 private:
122 FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override; 129 std::vector<std::unique_ptr<CFWL_ComboBoxItem>> m_ItemArray;
123 130 FX_FLOAT m_fMaxListHeight;
124 std::vector<std::unique_ptr<CFWL_ComboBoxItem>> m_ItemArray; 131 FX_FLOAT m_fItemHeight;
125 FX_FLOAT m_fMaxListHeight;
126 FX_FLOAT m_fItemHeight;
127 };
128 CFWL_ComboBoxDP m_comboBoxData;
129 };
130
131 class CFWL_ComboBoxItem : public IFWL_ListItem {
132 public:
133 CFWL_ComboBoxItem();
134 ~CFWL_ComboBoxItem();
135
136 CFX_RectF m_rtItem;
137 uint32_t m_dwStyles;
138 CFX_WideString m_wsText;
139 CFX_DIBitmap* m_pDIB;
140 uint32_t m_dwCheckState;
141 CFX_RectF m_rtCheckBox;
142 void* m_pData;
143 }; 132 };
144 133
145 #endif // XFA_FWL_CORE_CFWL_COMBOBOX_H_ 134 #endif // XFA_FWL_CORE_CFWL_COMBOBOX_H_
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_checkbox.cpp ('k') | xfa/fwl/core/cfwl_combobox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698