diff options
Diffstat (limited to 'xfa')
26 files changed, 29 insertions, 434 deletions
diff --git a/xfa/fwl/basewidget/ifwl_checkbox.h b/xfa/fwl/basewidget/ifwl_checkbox.h index 3b634553d0..355121ac1e 100644 --- a/xfa/fwl/basewidget/ifwl_checkbox.h +++ b/xfa/fwl/basewidget/ifwl_checkbox.h @@ -59,7 +59,8 @@ #define FWL_PARTSTATE_CKB_Focused (1L << 4) #define FWL_PARTSTATE_CKB_Mask1 (3L << 0) #define FWL_PARTSTATE_CKB_Mask2 (3L << 2) -#define FWL_EVT_CKB_CheckStateChanged L"FWL_EVENT_CKB_CheckStateChanged" + +// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 #define FWL_EVTHASH_CKB_CheckStateChanged 2503252963 BEGIN_FWL_EVENT_DEF(CFWL_EvtCkbCheckStateChanged, diff --git a/xfa/fwl/basewidget/ifwl_combobox.h b/xfa/fwl/basewidget/ifwl_combobox.h index 98a6750278..c5a30cf115 100644 --- a/xfa/fwl/basewidget/ifwl_combobox.h +++ b/xfa/fwl/basewidget/ifwl_combobox.h @@ -50,13 +50,7 @@ class IFWL_ComboBox; #define FWL_PARTSTATE_CMB_Disabled (3L << 0) #define FWL_PARTSTATE_CMB_Selected (1L << 2) #define FWL_WGTCAPACITY_CMB_ComboFormHandler (FWL_WGTCAPACITY_MAX + 7) -#define FWL_EVT_CMB_DropDown L"FWL_EVENT_CMB_PreDropDown" -#define FWL_EVT_CMB_PostDropDown L"FWL_EVENT_CMB_PostDropDown" -#define FWL_EVT_CMB_CloseUp L"FWL_EVENT_CMB_CloseUp" -#define FWL_EVT_CMB_EditChanged L"FWL_EVENT_CMB_EditChanged" -#define FWL_EVT_CMB_SelChanged L"FWL_EVENT_CMB_SelChanged" -#define FWL_EVT_CMB_HoverChanged L"FWL_EVENT_CMB_HoverChanged" -#define FWL_EVT_CMB_DrawItem L"FWL_EVENT_CMB_DrawItem" +// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 #define FWL_EVTHASH_CMB_PreDropDown 1357646798 #define FWL_EVTHASH_CMB_PostDropDown 3677010285 #define FWL_EVTHASH_CMB_CloseUp 2871271190 @@ -65,12 +59,6 @@ class IFWL_ComboBox; #define FWL_EVTHASH_CMB_HoverChanged 944325448 #define FWL_EVTHASH_CMB_DrawItem 917354551 -enum FWL_CMB_TEXTCHANGED { - FWL_CMB_TEXTCHANGED_Insert = 0, - FWL_CMB_TEXTCHANGED_Delete, - FWL_CMB_TEXTCHANGED_Replace, -}; - BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbPreDropDown, FWL_EVTHASH_CMB_PreDropDown) END_FWL_EVENT_DEF diff --git a/xfa/fwl/basewidget/ifwl_datetimepicker.h b/xfa/fwl/basewidget/ifwl_datetimepicker.h index f2a91aba64..f73aa73490 100644 --- a/xfa/fwl/basewidget/ifwl_datetimepicker.h +++ b/xfa/fwl/basewidget/ifwl_datetimepicker.h @@ -38,15 +38,11 @@ #define FWL_PARTSTATE_DTP_Hovered (1L << 0) #define FWL_PARTSTATE_DTP_Pressed (2L << 0) #define FWL_PARTSTATE_DTP_Disabled (3L << 0) -#define FWL_EVT_DTP_DropDown L"FWL_EVENT_DTP_DropDown" +// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 #define FWL_EVTHASH_DTP_DropDown 264728733 -#define FWL_EVT_DTP_CloseUp L"FWL_EVENT_DTP_CloseUp" #define FWL_EVTHASH_DTP_CloseUp 4280973803 -#define FWL_EVT_DTP_EditChanged L"FWL_EVENT_DTP_EditChanged" #define FWL_EVTHASH_DTP_EditChanged 4009610944 -#define FWL_EVT_DTP_HoverChanged L"FWL_EVENT_DTP_HoverChanged" #define FWL_EVTHASH_DTP_HoverChanged 686674750 -#define FWL_EVT_DTP_SelectChanged L"FWL_EVENT_DTP_SelectChanged" #define FWL_EVTHASH_DTP_SelectChanged 1589616858 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpDropDown, FWL_EVTHASH_DTP_DropDown) diff --git a/xfa/fwl/basewidget/ifwl_edit.h b/xfa/fwl/basewidget/ifwl_edit.h index b27f8b4898..90df9d959c 100644 --- a/xfa/fwl/basewidget/ifwl_edit.h +++ b/xfa/fwl/basewidget/ifwl_edit.h @@ -57,17 +57,12 @@ #define FWL_PARTSTATE_EDT_Normal (0L << 0) #define FWL_PARTSTATE_EDT_ReadOnly (1L << 0) #define FWL_PARTSTATE_EDT_Disable (2L << 0) -#define FWL_EVT_EDT_TextChanged L"FWL_EVENT_EDT_TextChanged" +// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 #define FWL_EVTHASH_EDT_TextChanged 1064022132 -#define FWL_EVT_EDT_PreSelfAdaption L"FWL_EVENT_PreSelfAdaption" #define FWL_EVTHASH_EDT_PreSelfAdaption 1001979178 -#define FWL_EVT_EDT_Validate L"FWL_EVTHASH_EDT_Validate" #define FWL_EVTHASH_EDT_Validate 3373308608 -#define FWL_EVT_EDT_CheckWord L"FWL_EVTHASH_EDT_CheckWord" #define FWL_EVTHASH_EDT_CheckWord 2897181520 -#define FWL_EVT_EDT_GetSuggestWords L"FWL_EVTHASH_EDT_GetSuggestWords" #define FWL_EVTHASH_EDT_GetSuggestWords 315782791 -#define FWL_EVT_EDT_TextFull L"FWL_EVTHASH_EDT_TextFull" #define FWL_EVTHASH_EDT_TextFull 2158580174 #define FWL_EDT_FIND_FLAGS_Prev (0L << 0) #define FWL_EDT_FIND_FLAGS_Next (1L << 0) diff --git a/xfa/fwl/basewidget/ifwl_listbox.h b/xfa/fwl/basewidget/ifwl_listbox.h index 1225eafcba..d73ca0f38d 100644 --- a/xfa/fwl/basewidget/ifwl_listbox.h +++ b/xfa/fwl/basewidget/ifwl_listbox.h @@ -46,8 +46,7 @@ #define FWL_WGTHITTEST_LTB_Item FWL_WGTHITTEST_MAX + 1 #define FWL_WGTHITTEST_LTB_HScrollBar FWL_WGTHITTEST_MAX + 2 #define FWL_WGTHITTEST_LTB_VScrollBar FWL_WGTHITTEST_MAX + 3 -#define FWL_EVT_LTB_SelChanged L"FWL_EVENT_LTB_SelChanged" -#define FWL_EVT_LTB_DrawItem L"FWL_EVENT_LTB_DrawItem" +// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 #define FWL_EVTHASH_LTB_SelChanged 1701781688 #define FWL_EVTHASH_LTB_DrawItem 1050853991 diff --git a/xfa/fwl/basewidget/ifwl_monthcalendar.h b/xfa/fwl/basewidget/ifwl_monthcalendar.h index 8f9ab9ae3e..8ac9c36f4d 100644 --- a/xfa/fwl/basewidget/ifwl_monthcalendar.h +++ b/xfa/fwl/basewidget/ifwl_monthcalendar.h @@ -97,8 +97,8 @@ #define FWL_MCCAPACITY_December FWL_WGTCAPACITY_MAX + 23 #define FWL_MCCAPACITY_Today FWL_WGTCAPACITY_MAX + 24 #define FWL_EVENT_MCD_DATESELECTED L"FWL_EVENT_MCD_DateSelected" -#define FWL_EVT_MCD_DateChanged L"FWL_EVENT_MCD_DateChanged" #define FWL_NOTEHASH_MCD_DATASELECTED 1085596932 +// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 #define FWL_EVTHASH_MCD_DateChanged 54212227 BEGIN_FWL_EVENT_DEF(CFWL_Event_McdDateSelected, FWL_NOTEHASH_MCD_DATASELECTED) diff --git a/xfa/fwl/basewidget/ifwl_spinbutton.h b/xfa/fwl/basewidget/ifwl_spinbutton.h index f68ab0f251..87f38b4d5f 100644 --- a/xfa/fwl/basewidget/ifwl_spinbutton.h +++ b/xfa/fwl/basewidget/ifwl_spinbutton.h @@ -22,7 +22,7 @@ #define FWL_PARTSTATE_SPB_Disabled (3L << 0) #define FWL_WGTHITTEST_SPB_UpButton (FWL_WGTHITTEST_MAX + 1) #define FWL_WGTHITTEST_SPB_DownButton (FWL_WGTHITTEST_MAX + 2) -#define FWL_EVT_SPB_Click L"FWL_EVENT_SPB_Click" +// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 #define FWL_EVTHASH_SPB_Click 2927651187 BEGIN_FWL_EVENT_DEF(CFWL_EvtSpbClick, FWL_EVTHASH_SPB_Click) diff --git a/xfa/fwl/core/cfwl_event.h b/xfa/fwl/core/cfwl_event.h index 5f7a135372..b2f88802f9 100644 --- a/xfa/fwl/core/cfwl_event.h +++ b/xfa/fwl/core/cfwl_event.h @@ -13,19 +13,7 @@ #include "xfa/fwl/core/cfwl_note.h" #include "xfa/fwl/core/fwl_error.h" -#define FWL_EVT_Mouse L"FWL_EVENT_Mouse" -#define FWL_EVT_MouseWheel L"FWL_EVENT_MouseWheel" -#define FWL_EVT_Key L"FWL_EVENT_Key" -#define FWL_EVT_SetFocus L"FWL_EVENT_SetFocus" -#define FWL_EVT_KillFocus L"FWL_EVENT_KillFocus" -#define FWL_EVT_Click L"FWL_EVENT_Click" -#define FWL_EVT_Draw L"FWL_EVENT_Draw" -#define FWL_EVT_Scroll L"FWL_EVENT_Scroll" -#define FWL_EVT_Close L"FWL_EVENT_Close" -#define FWL_EVT_ContextMenu L"FWL_EVENT_ContextMenu" -#define FWL_EVT_MenuCommand L"FWL_EVENT_MenuCommand" -#define FWL_EVT_SizeChanged L"FWL_EVENT_SizeChanged" - +// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 #define FWL_EVTHASH_Mouse 1765258002 #define FWL_EVTHASH_MouseWheel 3907114407 #define FWL_EVTHASH_Key 2408354450 diff --git a/xfa/fwl/core/fwl_formimp.h b/xfa/fwl/core/fwl_formimp.h index fbfdfae271..766cd85cbf 100644 --- a/xfa/fwl/core/fwl_formimp.h +++ b/xfa/fwl/core/fwl_formimp.h @@ -55,22 +55,17 @@ class CFWL_SysBtn { CFX_RectF m_rtBtn; uint32_t m_dwState; }; + enum FORM_RESIZETYPE { FORM_RESIZETYPE_None = 0, FORM_RESIZETYPE_Cap, - FORM_RESIZETYPE_Left, - FORM_RESIZETYPE_Top, - FORM_RESIZETYPE_Right, - FORM_RESIZETYPE_Bottom, - FORM_RESIZETYPE_LeftTop, - FORM_RESIZETYPE_LeftBottom, - FORM_RESIZETYPE_RightTop, - FORM_RESIZETYPE_RightBottom }; + typedef struct RestoreResizeInfo { CFX_PointF m_ptStart; CFX_SizeF m_szStart; } RestoreInfo; + class CFWL_FormImp : public CFWL_PanelImp { public: CFWL_FormImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); diff --git a/xfa/fwl/core/fwl_sdadapterimp.cpp b/xfa/fwl/core/fwl_sdadapterimp.cpp index 2e9d740e40..50246517cc 100644 --- a/xfa/fwl/core/fwl_sdadapterimp.cpp +++ b/xfa/fwl/core/fwl_sdadapterimp.cpp @@ -151,25 +151,11 @@ FX_BOOL CFWL_SDAdapterWidgetMgr::GetPopupPos(IFWL_Widget* pWidget, CFX_RectF& rtPopup) { return FWL_ERR_Succeeded; } + CFWL_SDAdapterThreadMgr::CFWL_SDAdapterThreadMgr() {} + CFWL_SDAdapterThreadMgr::~CFWL_SDAdapterThreadMgr() {} -FWL_ERR CFWL_SDAdapterThreadMgr::Start(IFWL_Thread* pThread, - FWL_HTHREAD& hThread, - FX_BOOL bSuspended) { - return FWL_ERR_Succeeded; -} -FWL_ERR CFWL_SDAdapterThreadMgr::Resume(FWL_HTHREAD hThread) { - return FWL_ERR_Succeeded; -} -FWL_ERR CFWL_SDAdapterThreadMgr::Suspend(FWL_HTHREAD hThread) { - return FWL_ERR_Succeeded; -} -FWL_ERR CFWL_SDAdapterThreadMgr::Kill(FWL_HTHREAD hThread, int32_t iExitCode) { - return FWL_ERR_Succeeded; -} -FWL_ERR CFWL_SDAdapterThreadMgr::Stop(FWL_HTHREAD hThread, int32_t iExitCode) { - return FWL_ERR_Succeeded; -} + IFWL_Thread* CFWL_SDAdapterThreadMgr::GetCurrentThread() { return FWL_GetApp(); } diff --git a/xfa/fwl/core/fwl_sdadapterimp.h b/xfa/fwl/core/fwl_sdadapterimp.h index 2bc69796fb..3968b22ab6 100644 --- a/xfa/fwl/core/fwl_sdadapterimp.h +++ b/xfa/fwl/core/fwl_sdadapterimp.h @@ -76,13 +76,6 @@ class CFWL_SDAdapterThreadMgr : public IFWL_AdapterThreadMgr { ~CFWL_SDAdapterThreadMgr(); public: - virtual FWL_ERR Start(IFWL_Thread* pThread, - FWL_HTHREAD& hThread, - FX_BOOL bSuspended = FALSE); - virtual FWL_ERR Resume(FWL_HTHREAD hThread); - virtual FWL_ERR Suspend(FWL_HTHREAD hThread); - virtual FWL_ERR Kill(FWL_HTHREAD hThread, int32_t iExitCode); - virtual FWL_ERR Stop(FWL_HTHREAD hThread, int32_t iExitCode); virtual IFWL_Thread* GetCurrentThread(); }; diff --git a/xfa/fwl/core/fwl_threadimp.cpp b/xfa/fwl/core/fwl_threadimp.cpp index 66c57ebee6..bc58a76f04 100644 --- a/xfa/fwl/core/fwl_threadimp.cpp +++ b/xfa/fwl/core/fwl_threadimp.cpp @@ -14,26 +14,18 @@ void IFWL_Thread::Release() { delete m_pImpl; } -FWL_ERR IFWL_Thread::Run(FWL_HTHREAD hThread) { - return m_pImpl->Run(hThread); -} + IFWL_NoteDriver* IFWL_NoteThread::GetNoteDriver() { return static_cast<CFWL_NoteThreadImp*>(GetImpl())->GetNoteDriver(); } -FWL_ERR CFWL_ThreadImp::Run(FWL_HTHREAD hThread) { - return FWL_ERR_Succeeded; -} CFWL_NoteThreadImp::CFWL_NoteThreadImp(IFWL_NoteThread* pIface) : CFWL_ThreadImp(pIface), m_pNoteDriver(new CFWL_NoteDriver) {} + CFWL_NoteThreadImp::~CFWL_NoteThreadImp() { delete m_pNoteDriver; } -FWL_ERR CFWL_NoteThreadImp::Run(FWL_HTHREAD hThread) { - if (!m_pNoteDriver) - return FWL_ERR_Indefinite; - return m_pNoteDriver->Run(); -} + IFWL_NoteDriver* CFWL_NoteThreadImp::GetNoteDriver() { return m_pNoteDriver; } diff --git a/xfa/fwl/core/fwl_threadimp.h b/xfa/fwl/core/fwl_threadimp.h index 3806f3ca4b..e1787d9d31 100644 --- a/xfa/fwl/core/fwl_threadimp.h +++ b/xfa/fwl/core/fwl_threadimp.h @@ -17,7 +17,6 @@ class CFWL_ThreadImp { public: virtual ~CFWL_ThreadImp() {} IFWL_Thread* GetInterface() const { return m_pIface; } - virtual FWL_ERR Run(FWL_HTHREAD hThread); protected: CFWL_ThreadImp(IFWL_Thread* pIface) : m_pIface(pIface) {} @@ -31,7 +30,6 @@ class CFWL_NoteThreadImp : public CFWL_ThreadImp { CFWL_NoteThreadImp(IFWL_NoteThread* pIface); virtual ~CFWL_NoteThreadImp(); - FWL_ERR Run(FWL_HTHREAD hThread) override; virtual IFWL_NoteDriver* GetNoteDriver(); protected: diff --git a/xfa/fwl/core/ifwl_adapterthreadmgr.h b/xfa/fwl/core/ifwl_adapterthreadmgr.h index 821ced3164..dec5010b49 100644 --- a/xfa/fwl/core/ifwl_adapterthreadmgr.h +++ b/xfa/fwl/core/ifwl_adapterthreadmgr.h @@ -14,13 +14,7 @@ class IFWL_AdapterThreadMgr { public: virtual ~IFWL_AdapterThreadMgr() {} - virtual FWL_ERR Start(IFWL_Thread* pThread, - FWL_HTHREAD& hThread, - FX_BOOL bSuspended = FALSE) = 0; - virtual FWL_ERR Resume(FWL_HTHREAD hThread) = 0; - virtual FWL_ERR Suspend(FWL_HTHREAD hThread) = 0; - virtual FWL_ERR Kill(FWL_HTHREAD hThread, int32_t iExitCode) = 0; - virtual FWL_ERR Stop(FWL_HTHREAD hThread, int32_t iExitCode) = 0; + virtual IFWL_Thread* GetCurrentThread() = 0; }; diff --git a/xfa/fwl/core/ifwl_form.h b/xfa/fwl/core/ifwl_form.h index b5cb72b181..0022759436 100644 --- a/xfa/fwl/core/ifwl_form.h +++ b/xfa/fwl/core/ifwl_form.h @@ -55,17 +55,6 @@ enum FWL_FORMSIZE { FWL_FORMSIZE_All, }; -enum FWL_COMMANDID { - FWL_COMMANDID_Close = 0, - FWL_COMMANDID_Ok, - FWL_COMMANDID_Cancel, - FWL_COMMANDID_Abort, - FWL_COMMANDID_Retry, - FWL_COMMANDID_Ignore, - FWL_COMMANDID_Yes, - FWL_COMMANDID_No, -}; - class CFX_DIBitmap; class CFX_WideString; class CFX_Path; diff --git a/xfa/fwl/core/ifwl_thread.h b/xfa/fwl/core/ifwl_thread.h index c6f0c445d1..d05aa6da0c 100644 --- a/xfa/fwl/core/ifwl_thread.h +++ b/xfa/fwl/core/ifwl_thread.h @@ -27,13 +27,10 @@ class CFWL_ThreadImp; class IFWL_NoteDriver; -typedef struct FWL_HTHREAD_ { void* pData; } * FWL_HTHREAD; - class IFWL_Thread { public: // These call into polymorphic methods in the impl; no need to override. void Release(); - FWL_ERR Run(FWL_HTHREAD hThread); CFWL_ThreadImp* GetImpl() const { return m_pImpl; } void SetImpl(CFWL_ThreadImp* pImpl) { m_pImpl = pImpl; } diff --git a/xfa/fwl/lightwidget/cfwl_caret.cpp b/xfa/fwl/lightwidget/cfwl_caret.cpp deleted file mode 100644 index 7fea4f9e77..0000000000 --- a/xfa/fwl/lightwidget/cfwl_caret.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fwl/lightwidget/cfwl_caret.h" - -#include <memory> - -#include "xfa/fwl/basewidget/ifwl_caret.h" -#include "xfa/fwl/core/fwl_targetimp.h" -#include "xfa/fxgraphics/cfx_color.h" -#include "xfa/fwl/lightwidget/cfwl_edit.h" - -CFWL_Caret* CFWL_Caret::Create() { - return new CFWL_Caret; -} - -FWL_ERR CFWL_Caret::Initialize(const CFWL_WidgetProperties* pProperties) { - if (m_pIface) - return FWL_ERR_Indefinite; - if (pProperties) { - *m_pProperties = *pProperties; - } - std::unique_ptr<IFWL_Caret> pCaret(IFWL_Caret::Create( - m_pProperties->MakeWidgetImpProperties(nullptr), nullptr)); - FWL_ERR ret = pCaret->Initialize(); - if (ret != FWL_ERR_Succeeded) { - return ret; - } - m_pIface = pCaret.release(); - CFWL_Widget::Initialize(); - return FWL_ERR_Succeeded; -} - -FWL_ERR CFWL_Caret::ShowCaret(FX_BOOL bFlag) { - return static_cast<IFWL_Caret*>(m_pIface)->ShowCaret(bFlag); -} - -FWL_ERR CFWL_Caret::GetFrequency(uint32_t& elapse) { - return static_cast<IFWL_Caret*>(m_pIface)->GetFrequency(elapse); -} - -FWL_ERR CFWL_Caret::SetFrequency(uint32_t elapse) { - return static_cast<IFWL_Caret*>(m_pIface)->SetFrequency(elapse); -} - -FWL_ERR CFWL_Caret::SetColor(CFX_Color crFill) { - return static_cast<IFWL_Caret*>(m_pIface)->SetColor(crFill); -} - -CFWL_Caret::CFWL_Caret() {} - -CFWL_Caret::~CFWL_Caret() {} diff --git a/xfa/fwl/lightwidget/cfwl_caret.h b/xfa/fwl/lightwidget/cfwl_caret.h deleted file mode 100644 index c806f2eb73..0000000000 --- a/xfa/fwl/lightwidget/cfwl_caret.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_LIGHTWIDGET_CFWL_CARET_H_ -#define XFA_FWL_LIGHTWIDGET_CFWL_CARET_H_ - -#include "xfa/fwl/core/fwl_error.h" -#include "xfa/fxgraphics/cfx_color.h" -#include "xfa/fwl/lightwidget/cfwl_widget.h" - -class CFWL_Caret : public CFWL_Widget { - public: - static CFWL_Caret* Create(); - FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); - FWL_ERR ShowCaret(FX_BOOL bFlag = TRUE); - FWL_ERR GetFrequency(uint32_t& elapse); - FWL_ERR SetFrequency(uint32_t elapse); - FWL_ERR SetColor(CFX_Color crFill); - - protected: - CFWL_Caret(); - virtual ~CFWL_Caret(); -}; - -#endif // XFA_FWL_LIGHTWIDGET_CFWL_CARET_H_ diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index 94f69a4389..39a19b7981 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -21,7 +21,6 @@ #define CHECKBOX_COLOR_BOXLT2 (ArgbEncode(255, 113, 111, 100)) #define CHECKBOX_COLOR_BOXRB1 (ArgbEncode(255, 241, 239, 226)) #define CHECKBOX_COLOR_BOXRB2 (ArgbEncode(255, 255, 255, 255)) -#define CHECKBOX_FXGE_CoordinatesAdjust CFWL_CheckBoxTP::CFWL_CheckBoxTP() : m_pCheckPath(NULL) { m_pThemeData = new CKBThemeData; @@ -134,20 +133,12 @@ void CFWL_CheckBoxTP::DrawBoxBk(IFWL_Widget* pWidget, pRect->height - CHECKBOX_SIZE_SIGNMARGIN * 2); } } else { -#ifdef CHECKBOX_FXGE_CoordinatesAdjust CFX_RectF rect(*pRect); rect.Deflate(0, 0, 1, 1); path.AddEllipse(rect); -#else - path.AddEllipse(*pRect); -#endif if (bClipSign) { fillMode = FXFILL_ALTERNATE; -#ifdef CHECKBOX_FXGE_CoordinatesAdjust CFX_RectF rtClip(rect); -#else - CFX_RectF rtClip(*pRect); -#endif rtClip.Deflate(CHECKBOX_SIZE_SIGNMARGIN - 1, CHECKBOX_SIZE_SIGNMARGIN - 1); path.AddEllipse(rtClip); diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp index 2c5a1c4ff4..b9dd7a0300 100644 --- a/xfa/fwl/theme/cfwl_comboboxtp.cpp +++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp @@ -90,7 +90,7 @@ void* CFWL_ComboBoxTP::GetCapacity(CFWL_ThemePart* pThemePart, } return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); } -#ifdef THEME_XPSimilar + void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, uint32_t dwStates, CFX_Matrix* pMatrix) { @@ -117,44 +117,3 @@ void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down, eState, &pParams->m_matrix); } -#else -void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, - uint32_t dwStates, - CFX_Matrix* pMatrix) { - FX_BOOL bPressed = ((pParams->m_dwStates & FWL_CMBPARTSTATE_Pressed) == - FWL_CMBPARTSTATE_Pressed); - FX_FLOAT fWidth = bPressed ? 1.0f : 2.0f; - FWLTHEME_EDGE eType = bPressed ? FWLTHEME_EDGE_Flat : FWLTHEME_EDGE_Raised; - Draw3DRect(pParams->m_pGraphics, eType, fWidth, &pParams->m_rtPart, - FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2, - FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix); - CFX_Path path; - path.Create(); - path.AddRectangle(pParams->m_rtPart.left + fWidth, - pParams->m_rtPart.top + fWidth, - pParams->m_rtPart.width - 2 * fWidth, - pParams->m_rtPart.height - 2 * fWidth); - pParams->m_pGraphics->SaveGraphState(); - CFX_Color crFill(FWLTHEME_COLOR_Background); - pParams->m_pGraphics->SetFillColor(&crFill); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); - pParams->m_pGraphics->RestoreGraphState(); - FX_ARGB argbFill = ArgbEncode(255, 77, 97, 133); - switch (pParams->m_dwStates & 0x03) { - case FWL_CMBPARTSTATE_Normal: { - } - case FWL_CMBPARTSTATE_Hovered: { - } - case FWL_CMBPARTSTATE_Pressed: { - argbFill = 0xFF000000; - break; - } - case FWL_CMBPARTSTATE_Disabled: { - argbFill = 0xFFF0F0F0; - break; - } - } - DrawArrow(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down, - argbFill, bPressed, &pParams->m_matrix); -} -#endif diff --git a/xfa/fwl/theme/cfwl_datetimepickedtp.cpp b/xfa/fwl/theme/cfwl_datetimepickedtp.cpp index 4e1d39a15a..899180faa0 100644 --- a/xfa/fwl/theme/cfwl_datetimepickedtp.cpp +++ b/xfa/fwl/theme/cfwl_datetimepickedtp.cpp @@ -42,7 +42,7 @@ FX_BOOL CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) { } return TRUE; } -#ifdef THEME_XPSimilar + void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { uint32_t dwStates = pParams->m_dwStates; @@ -70,46 +70,7 @@ void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down, eState, pMatrix); } -#else -void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { - FX_BOOL bPressed = ((pParams->m_dwStates & FWL_PARTSTATE_DTP_Pressed) == - FWL_PARTSTATE_DTP_Pressed); - FX_FLOAT fWidth = bPressed ? 1.0f : 2.0f; - FWLTHEME_EDGE eType = bPressed ? FWLTHEME_EDGE_Flat : FWLTHEME_EDGE_Raised; - Draw3DRect(pParams->m_pGraphics, eType, fWidth, &pParams->m_rtPart, - FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2, - FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix); - CFX_Path path; - path.Create(); - path.AddRectangle(pParams->m_rtPart.left + fWidth, - pParams->m_rtPart.top + fWidth, - pParams->m_rtPart.width - 2 * fWidth, - pParams->m_rtPart.height - 2 * fWidth); - pParams->m_pGraphics->SaveGraphState(); - CFX_Color crFill(FWLTHEME_COLOR_Background); - pParams->m_pGraphics->SetFillColor(&crFill); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pParams->m_pGraphics->RestoreGraphState(); - FX_ARGB argbFill = ArgbEncode(255, 77, 97, 133); - switch (pParams->m_dwStates & 0x03) { - case FWL_PARTSTATE_DTP_Normal: { - } - case FWL_PARTSTATE_DTP_Hovered: { - } - case FWL_PARTSTATE_DTP_Pressed: { - argbFill = 0xFF000000; - break; - } - case FWL_PARTSTATE_DTP_Disabled: { - argbFill = 0xFFF0F0F0; - break; - } - } - DrawArrow(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down, - argbFill, bPressed, pMatrix); -} -#endif + void CFWL_DateTimePickerTP::initThemeData() { uint32_t* pData = (uint32_t*)&m_pThemeData->BoxBkColor; *pData++ = 0; diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp index 2d53080b37..154a6bdcea 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp +++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp @@ -101,23 +101,15 @@ FX_BOOL CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) { break; } case FWL_PART_MCD_LBtn: { -#ifdef THEME_XPSimilar FWLTHEME_STATE eState = GetState(pParams->m_dwStates); DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Left, eState, &pParams->m_matrix); -#else - DrawLButton(pParams, &pParams->m_matrix); -#endif break; } case FWL_PART_MCD_RBtn: { -#ifdef THEME_XPSimilar FWLTHEME_STATE eState = GetState(pParams->m_dwStates); DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Right, eState, &pParams->m_matrix); -#else - DrawRButton(pParams, &pParams->m_matrix); -#endif break; } case FWL_PART_MCD_HSeparator: { diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp index c6a14f8e94..5db0559195 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.cpp +++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp @@ -97,7 +97,7 @@ FX_BOOL CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) { } return TRUE; } -#ifdef THEME_XPSimilar + void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics, const CFX_RectF* pRect, FX_BOOL bVert, @@ -266,75 +266,7 @@ void CFWL_ScrollBarTP::DrawMaxMinBtn(CFX_Graphics* pGraphics, rtArrowBtn.Deflate(1, 1, 1, 1); DrawArrowBtn(pGraphics, &rtArrowBtn, eDict, eState, pMatrix); } -#else -void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FX_BOOL bVert, - FWLTHEME_STATE eState, - FX_BOOL bPawButton, - CFX_Matrix* pMatrix) { - if (pRect->IsEmpty()) { - return; - } - CFX_RectF rtThumb(*pRect); - FX_FLOAT fWidth = 2; - Draw3DRect(pGraphics, FWLTHEME_EDGE_Raised, fWidth, pRect, - FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2, - FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix); - CFX_Path path; - path.Create(); - path.AddRectangle(pRect->left + fWidth, pRect->top + fWidth, - pRect->width - 2 * fWidth, pRect->height - 2 * fWidth); - pGraphics->SaveGraphState(); - CFX_Color crFill(FWLTHEME_COLOR_Background); - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pGraphics->RestoreGraphState(); -} -void CFWL_ScrollBarTP::DrawTrack(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FX_BOOL bVert, - FWLTHEME_STATE eState, - FX_BOOL bLowerTrack, - CFX_Matrix* pMatrix) { - if (pRect->IsEmpty()) { - return; - } - CFX_Path path; - path.Create(); - path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); - pGraphics->SaveGraphState(); - CFX_Color clrFill(0xFFF0F0F0); - pGraphics->SetFillColor(&clrFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pGraphics->RestoreGraphState(); -} -void CFWL_ScrollBarTP::DrawMaxMinBtn(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_DIRECTION eDict, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix) { - CFX_RectF rtThumb(*pRect); - FX_FLOAT fWidth = eState == FWLTHEME_STATE_Pressed ? 1.0f : 2.0f; - FWLTHEME_EDGE eType = eState == FWLTHEME_STATE_Pressed ? FWLTHEME_EDGE_Flat - : FWLTHEME_EDGE_Raised; - Draw3DRect(pGraphics, eType, fWidth, pRect, FWLTHEME_COLOR_EDGELT1, - FWLTHEME_COLOR_EDGELT2, FWLTHEME_COLOR_EDGERB1, - FWLTHEME_COLOR_EDGERB2, pMatrix); - CFX_Path path; - path.Create(); - path.AddRectangle(pRect->left + fWidth, pRect->top + fWidth, - pRect->width - 2 * fWidth, pRect->height - 2 * fWidth); - pGraphics->SaveGraphState(); - CFX_Color crFill(FWLTHEME_COLOR_Background); - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pGraphics->RestoreGraphState(); - DrawArrow(pGraphics, pRect, eDict, - eState == FWLTHEME_STATE_Disabale ? 0xFFA0A0A0 : 0xFF000000, - eState == FWLTHEME_STATE_Pressed, pMatrix); -} -#endif + void CFWL_ScrollBarTP::SetThemeData(uint32_t dwID) { m_pThemeData->clrPawColorLight[3] = ArgbEncode(0xff, 208, 223, 172); m_pThemeData->clrPawColorDark[3] = ArgbEncode(0xff, 140, 157, 115); diff --git a/xfa/fwl/theme/cfwl_utils.h b/xfa/fwl/theme/cfwl_utils.h index d530b7631b..f2aa381d63 100644 --- a/xfa/fwl/theme/cfwl_utils.h +++ b/xfa/fwl/theme/cfwl_utils.h @@ -9,46 +9,28 @@ #include "core/fxcrt/include/fx_system.h" -#define THEME_XPSimilar enum FWLTHEME_EDGE { FWLTHEME_EDGE_Flat = 0, FWLTHEME_EDGE_Raised, FWLTHEME_EDGE_Sunken }; + enum FWLTHEME_STATE { FWLTHEME_STATE_Normal = 1, FWLTHEME_STATE_Hover, FWLTHEME_STATE_Pressed, FWLTHEME_STATE_Disabale }; + enum FWLTHEME_DIRECTION { FWLTHEME_DIRECTION_Up = 0, FWLTHEME_DIRECTION_Down, FWLTHEME_DIRECTION_Left, FWLTHEME_DIRECTION_Right }; -struct FWLCOLOR { - union { - uint32_t color; - struct { - uint8_t b; - uint8_t g; - uint8_t r; - uint8_t a; - }; - }; - FWLCOLOR() : color(0) {} - FWLCOLOR(uint32_t c) : color(c) {} - FWLCOLOR(const FWLCOLOR& c) : color(c.color) {} - - bool operator==(const FWLCOLOR& frColor) { return color == frColor.color; } - operator uint32_t() { return color; } -}; #define FWLTHEME_BEZIER FX_BEZIER #define FWLTHEME_PI FX_PI -#define FWLTHEME_PI_2_1 (FX_PI / 2.0f) -#define FWLTHEME_PI_2_3 (3.0f * FX_PI / 2.0f) #define FWLTHEME_COLOR_EDGELT1 (ArgbEncode(255, 172, 168, 153)) #define FWLTHEME_COLOR_EDGELT2 (ArgbEncode(255, 113, 111, 100)) #define FWLTHEME_COLOR_EDGERB1 (ArgbEncode(255, 241, 239, 226)) @@ -56,11 +38,7 @@ struct FWLCOLOR { #define FWLTHEME_COLOR_Background (ArgbEncode(255, 236, 233, 216)) #define FWLTHEME_COLOR_BKSelected (ArgbEncode(255, 153, 193, 218)) #define FWLTHEME_COLOR_Green_BKSelected (ArgbEncode(255, 147, 160, 112)) -#ifdef THEME_XPSimilar #define FWLTHEME_CAPACITY_EdgeFlat 2.0f -#else -#define FWLTHEME_CAPACITY_EdgeFlat 0.0f -#endif #define FWLTHEME_CAPACITY_EdgeRaised 2.0f #define FWLTHEME_CAPACITY_EdgeSunken 2.0f #define FWLTHEME_CAPACITY_FontSize 12.0f diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index 05263f17fd..9635ae8c4f 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -220,7 +220,7 @@ FX_ERR CFWL_WidgetTP::FinalizeTTO() { } return FWL_ERR_Succeeded; } -#ifdef THEME_XPSimilar + void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics, uint32_t dwStyles, const CFX_RectF* pRect, @@ -247,34 +247,7 @@ void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics, pGraphics->StrokePath(&path, pMatrix); pGraphics->RestoreGraphState(); } -#else -void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics, - uint32_t dwStyles, - const CFX_RectF* pRect, - CFX_Matrix* pMatrix) { - if (!pGraphics) - return; - if (!pRect) - return; - FWLTHEME_EDGE eType; - FX_FLOAT fWidth; - switch (dwStyles & FWL_WGTSTYLE_EdgeMask) { - case FWL_WGTSTYLE_EdgeRaised: { - eType = FWLTHEME_EDGE_Raised, fWidth = FWLTHEME_CAPACITY_EdgeRaised; - break; - } - case FWL_WGTSTYLE_EdgeSunken: { - eType = FWLTHEME_EDGE_Sunken, fWidth = FWLTHEME_CAPACITY_EdgeSunken; - break; - } - case FWL_WGTSTYLE_EdgeFlat: - default: { return; } - } - Draw3DRect(pGraphics, eType, fWidth, pRect, FWLTHEME_COLOR_EDGELT1, - FWLTHEME_COLOR_EDGELT2, FWLTHEME_COLOR_EDGERB1, - FWLTHEME_COLOR_EDGERB2, pMatrix); -} -#endif + void CFWL_WidgetTP::Draw3DRect(CFX_Graphics* pGraphics, FWLTHEME_EDGE eType, FX_FLOAT fWidth, @@ -674,21 +647,6 @@ void CFWL_WidgetTP::DrawArrowBtn(CFX_Graphics* pGraphics, CFWL_ArrowData::GetInstance()->m_pColorData; DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix); } -FWLCOLOR CFWL_WidgetTP::BlendColor(FWLCOLOR srcColor, - FWLCOLOR renderColor, - uint8_t scale) { - FWLCOLOR dstColor; - uint8_t n = 255 - scale; - dstColor.a = (uint8_t)( - ((uint16_t)srcColor.a * n + (uint16_t)renderColor.a * scale) >> 8); - dstColor.r = (uint8_t)( - ((uint16_t)srcColor.r * n + (uint16_t)renderColor.r * scale) >> 8); - dstColor.g = (uint8_t)( - ((uint16_t)srcColor.g * n + (uint16_t)renderColor.g * scale) >> 8); - dstColor.b = (uint8_t)( - ((uint16_t)srcColor.b * n + (uint16_t)renderColor.b * scale) >> 8); - return dstColor; -} CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(NULL) { SetColorData(0); } @@ -779,9 +737,7 @@ uint32_t FWL_GetThemeLayout(uint32_t dwThemeID) { uint32_t FWL_GetThemeColor(uint32_t dwThemeID) { return 0x0000ffff & dwThemeID; } -uint32_t FWL_MakeThemeID(uint32_t dwLayout, uint32_t dwColor) { - return (dwLayout << 16) | (0x0000FFFF & dwColor); -} + CFWL_ArrowData* CFWL_ArrowData::m_pInstance = NULL; CFWL_ArrowData* CFWL_ArrowData::GetInstance() { if (!m_pInstance) { diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h index 03d575a1d9..771278ef31 100644 --- a/xfa/fwl/theme/cfwl_widgettp.h +++ b/xfa/fwl/theme/cfwl_widgettp.h @@ -140,7 +140,6 @@ class CFWL_WidgetTP { FWLTHEME_DIRECTION eDict, FWLTHEME_STATE eState, CFX_Matrix* pMatrix = NULL); - FWLCOLOR BlendColor(FWLCOLOR srcColor, FWLCOLOR renderColor, uint8_t scale); uint32_t m_dwRefCount; IFDE_TextOut* m_pTextOut; IFX_Font* m_pFDEFont; @@ -154,7 +153,6 @@ FX_BOOL FWLTHEME_Init(); void FWLTHEME_Release(); uint32_t FWL_GetThemeLayout(uint32_t dwThemeID); uint32_t FWL_GetThemeColor(uint32_t dwThemeID); -uint32_t FWL_MakeThemeID(uint32_t dwLayout, uint32_t dwColor); class CFWL_ArrowData { public: |