| 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/fxfa/app/xfa_fwltheme.h" | 7 #include "xfa/fxfa/app/xfa_fwltheme.h" |
| 8 | 8 |
| 9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
| 10 #include "xfa/fgas/crt/fgas_codepage.h" | 10 #include "xfa/fgas/crt/fgas_codepage.h" |
| 11 #include "xfa/fgas/font/cfgas_gefont.h" | 11 #include "xfa/fgas/font/cfgas_gefont.h" |
| 12 #include "xfa/fwl/core/cfwl_barcode.h" |
| 12 #include "xfa/fwl/core/cfwl_caret.h" | 13 #include "xfa/fwl/core/cfwl_caret.h" |
| 14 #include "xfa/fwl/core/cfwl_checkbox.h" |
| 15 #include "xfa/fwl/core/cfwl_combobox.h" |
| 16 #include "xfa/fwl/core/cfwl_datetimepicker.h" |
| 17 #include "xfa/fwl/core/cfwl_edit.h" |
| 18 #include "xfa/fwl/core/cfwl_listbox.h" |
| 13 #include "xfa/fwl/core/cfwl_monthcalendar.h" | 19 #include "xfa/fwl/core/cfwl_monthcalendar.h" |
| 20 #include "xfa/fwl/core/cfwl_picturebox.h" |
| 21 #include "xfa/fwl/core/cfwl_pushbutton.h" |
| 14 #include "xfa/fwl/core/cfwl_scrollbar.h" | 22 #include "xfa/fwl/core/cfwl_scrollbar.h" |
| 15 #include "xfa/fwl/core/cfwl_themebackground.h" | 23 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 16 #include "xfa/fwl/core/cfwl_themetext.h" | 24 #include "xfa/fwl/core/cfwl_themetext.h" |
| 17 #include "xfa/fwl/core/ifwl_barcode.h" | |
| 18 #include "xfa/fwl/core/ifwl_checkbox.h" | |
| 19 #include "xfa/fwl/core/ifwl_combobox.h" | |
| 20 #include "xfa/fwl/core/ifwl_datetimepicker.h" | |
| 21 #include "xfa/fwl/core/ifwl_edit.h" | |
| 22 #include "xfa/fwl/core/ifwl_listbox.h" | |
| 23 #include "xfa/fwl/core/ifwl_picturebox.h" | |
| 24 #include "xfa/fwl/core/ifwl_pushbutton.h" | |
| 25 #include "xfa/fxfa/xfa_ffapp.h" | 25 #include "xfa/fxfa/xfa_ffapp.h" |
| 26 #include "xfa/fxfa/xfa_ffwidget.h" | 26 #include "xfa/fxfa/xfa_ffwidget.h" |
| 27 #include "xfa/fxgraphics/cfx_color.h" | 27 #include "xfa/fxgraphics/cfx_color.h" |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 const FX_WCHAR* const g_FWLTheme_CalFonts[] = { | 31 const FX_WCHAR* const g_FWLTheme_CalFonts[] = { |
| 32 L"Arial", L"Courier New", L"DejaVu Sans", | 32 L"Arial", L"Courier New", L"DejaVu Sans", |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 CXFA_FFWidget* XFA_ThemeGetOuterWidget(IFWL_Widget* pWidget) { | 37 CXFA_FFWidget* XFA_ThemeGetOuterWidget(CFWL_Widget* pWidget) { |
| 38 IFWL_Widget* pOuter = pWidget; | 38 CFWL_Widget* pOuter = pWidget; |
| 39 while (pOuter && pOuter->GetOuter()) | 39 while (pOuter && pOuter->GetOuter()) |
| 40 pOuter = pOuter->GetOuter(); | 40 pOuter = pOuter->GetOuter(); |
| 41 | 41 |
| 42 return pOuter ? static_cast<CXFA_FFWidget*>(pOuter->GetLayoutItem()) | 42 return pOuter ? static_cast<CXFA_FFWidget*>(pOuter->GetLayoutItem()) |
| 43 : nullptr; | 43 : nullptr; |
| 44 } | 44 } |
| 45 | 45 |
| 46 CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp) | 46 CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp) |
| 47 : m_pCheckBoxTP(new CFWL_CheckBoxTP), | 47 : m_pCheckBoxTP(new CFWL_CheckBoxTP), |
| 48 m_pListBoxTP(new CFWL_ListBoxTP), | 48 m_pListBoxTP(new CFWL_ListBoxTP), |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 m_pTextOut->SetTextColor(pAcc->GetTextColor()); | 335 m_pTextOut->SetTextColor(pAcc->GetTextColor()); |
| 336 if (!pParams) | 336 if (!pParams) |
| 337 return; | 337 return; |
| 338 | 338 |
| 339 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); | 339 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); |
| 340 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); | 340 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); |
| 341 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), | 341 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), |
| 342 pParams->m_wsText.GetLength(), rect); | 342 pParams->m_wsText.GetLength(), rect); |
| 343 } | 343 } |
| 344 | 344 |
| 345 CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { | 345 CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(CFWL_Widget* pWidget) { |
| 346 switch (pWidget->GetClassID()) { | 346 switch (pWidget->GetClassID()) { |
| 347 case FWL_Type::CheckBox: | 347 case FWL_Type::CheckBox: |
| 348 return m_pCheckBoxTP.get(); | 348 return m_pCheckBoxTP.get(); |
| 349 case FWL_Type::ListBox: | 349 case FWL_Type::ListBox: |
| 350 return m_pListBoxTP.get(); | 350 return m_pListBoxTP.get(); |
| 351 case FWL_Type::PictureBox: | 351 case FWL_Type::PictureBox: |
| 352 return m_pPictureBoxTP.get(); | 352 return m_pPictureBoxTP.get(); |
| 353 case FWL_Type::ScrollBar: | 353 case FWL_Type::ScrollBar: |
| 354 return m_pSrollBarTP.get(); | 354 return m_pSrollBarTP.get(); |
| 355 case FWL_Type::Edit: | 355 case FWL_Type::Edit: |
| 356 return m_pEditTP.get(); | 356 return m_pEditTP.get(); |
| 357 case FWL_Type::ComboBox: | 357 case FWL_Type::ComboBox: |
| 358 return m_pComboBoxTP.get(); | 358 return m_pComboBoxTP.get(); |
| 359 case FWL_Type::MonthCalendar: | 359 case FWL_Type::MonthCalendar: |
| 360 return m_pMonthCalendarTP.get(); | 360 return m_pMonthCalendarTP.get(); |
| 361 case FWL_Type::DateTimePicker: | 361 case FWL_Type::DateTimePicker: |
| 362 return m_pDateTimePickerTP.get(); | 362 return m_pDateTimePickerTP.get(); |
| 363 case FWL_Type::PushButton: | 363 case FWL_Type::PushButton: |
| 364 return m_pPushButtonTP.get(); | 364 return m_pPushButtonTP.get(); |
| 365 case FWL_Type::Caret: | 365 case FWL_Type::Caret: |
| 366 return m_pCaretTP.get(); | 366 return m_pCaretTP.get(); |
| 367 case FWL_Type::Barcode: | 367 case FWL_Type::Barcode: |
| 368 return m_pBarcodeTP.get(); | 368 return m_pBarcodeTP.get(); |
| 369 default: | 369 default: |
| 370 return nullptr; | 370 return nullptr; |
| 371 } | 371 } |
| 372 } | 372 } |
| OLD | NEW |