OLD | NEW |
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 #include "xfa/fwl/core/cfwl_combobox.h" | 7 #include "xfa/fwl/core/cfwl_combobox.h" |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 int32_t CFWL_ComboBox::GetCurSel() { | 85 int32_t CFWL_ComboBox::GetCurSel() { |
86 return GetWidget() ? ToComboBox(GetWidget())->GetCurSel() : -1; | 86 return GetWidget() ? ToComboBox(GetWidget())->GetCurSel() : -1; |
87 } | 87 } |
88 | 88 |
89 FWL_Error CFWL_ComboBox::SetCurSel(int32_t iSel) { | 89 FWL_Error CFWL_ComboBox::SetCurSel(int32_t iSel) { |
90 return GetWidget() ? ToComboBox(GetWidget())->SetCurSel(iSel) | 90 return GetWidget() ? ToComboBox(GetWidget())->SetCurSel(iSel) |
91 : FWL_Error::Indefinite; | 91 : FWL_Error::Indefinite; |
92 } | 92 } |
93 | 93 |
94 FWL_Error CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { | 94 void CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { |
95 return GetWidget() ? ToComboBox(GetWidget())->SetEditText(wsText) | 95 if (GetWidget()) |
96 : FWL_Error::Indefinite; | 96 ToComboBox(GetWidget())->SetEditText(wsText); |
97 } | 97 } |
98 | 98 |
99 int32_t CFWL_ComboBox::GetEditTextLength() const { | 99 int32_t CFWL_ComboBox::GetEditTextLength() const { |
100 return GetWidget() ? ToComboBox(GetWidget())->GetEditTextLength() : 0; | 100 return GetWidget() ? ToComboBox(GetWidget())->GetEditTextLength() : 0; |
101 } | 101 } |
102 | 102 |
103 FWL_Error CFWL_ComboBox::GetEditText(CFX_WideString& wsText, | 103 FWL_Error CFWL_ComboBox::GetEditText(CFX_WideString& wsText, |
104 int32_t nStart, | 104 int32_t nStart, |
105 int32_t nCount) const { | 105 int32_t nCount) const { |
106 return GetWidget() | 106 return GetWidget() |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 pItem->m_pData = pData; | 153 pItem->m_pData = pData; |
154 return FWL_Error::Succeeded; | 154 return FWL_Error::Succeeded; |
155 } | 155 } |
156 | 156 |
157 void* CFWL_ComboBox::GetItemData(int32_t iIndex) { | 157 void* CFWL_ComboBox::GetItemData(int32_t iIndex) { |
158 CFWL_ListItem* pItem = | 158 CFWL_ListItem* pItem = |
159 static_cast<CFWL_ListItem*>(GetItem(m_pIface.get(), iIndex)); | 159 static_cast<CFWL_ListItem*>(GetItem(m_pIface.get(), iIndex)); |
160 return pItem ? pItem->m_pData : nullptr; | 160 return pItem ? pItem->m_pData : nullptr; |
161 } | 161 } |
162 | 162 |
163 FWL_Error CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { | 163 void CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { |
164 return ToComboBox(GetWidget())->GetListBoxt()->SetThemeProvider(pTheme); | 164 ToComboBox(GetWidget())->GetListBoxt()->SetThemeProvider(pTheme); |
165 } | 165 } |
166 | 166 |
167 bool CFWL_ComboBox::AfterFocusShowDropList() { | 167 bool CFWL_ComboBox::AfterFocusShowDropList() { |
168 return ToComboBox(GetWidget())->AfterFocusShowDropList(); | 168 return ToComboBox(GetWidget())->AfterFocusShowDropList(); |
169 } | 169 } |
170 | 170 |
171 FWL_Error CFWL_ComboBox::OpenDropDownList(bool bActivate) { | 171 FWL_Error CFWL_ComboBox::OpenDropDownList(bool bActivate) { |
172 return ToComboBox(GetWidget())->OpenDropDownList(bActivate); | 172 return ToComboBox(GetWidget())->OpenDropDownList(bActivate); |
173 } | 173 } |
174 | 174 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 bool CFWL_ComboBox::EditDeSelect() { | 223 bool CFWL_ComboBox::EditDeSelect() { |
224 return GetWidget() ? ToComboBox(GetWidget())->EditDeSelect() : false; | 224 return GetWidget() ? ToComboBox(GetWidget())->EditDeSelect() : false; |
225 } | 225 } |
226 | 226 |
227 FWL_Error CFWL_ComboBox::GetBBox(CFX_RectF& rect) { | 227 FWL_Error CFWL_ComboBox::GetBBox(CFX_RectF& rect) { |
228 return GetWidget() ? ToComboBox(GetWidget())->GetBBox(rect) | 228 return GetWidget() ? ToComboBox(GetWidget())->GetBBox(rect) |
229 : FWL_Error::Indefinite; | 229 : FWL_Error::Indefinite; |
230 } | 230 } |
231 | 231 |
232 FWL_Error CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, | 232 void CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, |
233 uint32_t dwStylesExRemoved) { | 233 uint32_t dwStylesExRemoved) { |
234 return GetWidget() | 234 if (GetWidget()) { |
235 ? ToComboBox(GetWidget()) | 235 ToComboBox(GetWidget()) |
236 ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved) | 236 ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
237 : FWL_Error::Indefinite; | 237 } |
238 } | 238 } |
239 | 239 |
240 FWL_Error CFWL_ComboBox::GetCaption(IFWL_Widget* pWidget, | 240 FWL_Error CFWL_ComboBox::GetCaption(IFWL_Widget* pWidget, |
241 CFX_WideString& wsCaption) { | 241 CFX_WideString& wsCaption) { |
242 return FWL_Error::Succeeded; | 242 return FWL_Error::Succeeded; |
243 } | 243 } |
244 | 244 |
245 int32_t CFWL_ComboBox::CountItems(const IFWL_Widget* pWidget) { | 245 int32_t CFWL_ComboBox::CountItems(const IFWL_Widget* pWidget) { |
246 return m_ItemArray.size(); | 246 return m_ItemArray.size(); |
247 } | 247 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 FWL_Error CFWL_ComboBox::SetItemCheckState(IFWL_Widget* pWidget, | 363 FWL_Error CFWL_ComboBox::SetItemCheckState(IFWL_Widget* pWidget, |
364 CFWL_ListItem* pItem, | 364 CFWL_ListItem* pItem, |
365 uint32_t dwCheckState) { | 365 uint32_t dwCheckState) { |
366 static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState; | 366 static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState; |
367 return FWL_Error::Succeeded; | 367 return FWL_Error::Succeeded; |
368 } | 368 } |
369 | 369 |
370 FX_FLOAT CFWL_ComboBox::GetListHeight(IFWL_Widget* pWidget) { | 370 FX_FLOAT CFWL_ComboBox::GetListHeight(IFWL_Widget* pWidget) { |
371 return m_fMaxListHeight; | 371 return m_fMaxListHeight; |
372 } | 372 } |
OLD | NEW |