summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-03-29 12:38:01 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-29 12:38:01 -0700
commit7f432a1c87014d6673ee69ff0ffa3724f237acf4 (patch)
tree517afad0bed7a3706b9cafa35f0b4944ebc68f76 /xfa/fwl
parent90d87793cf55f3c4e57e9db6c8de692ebef41e29 (diff)
downloadpdfium-7f432a1c87014d6673ee69ff0ffa3724f237acf4.tar.xz
Move xfa/include/fwl/{theme,lightwidget} to xfa/fwl
This CL moves and splits the remaining FWL files out of xfa/include and into their proper locations. Review URL: https://codereview.chromium.org/1834323003
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/basewidget/fwl_pictureboximp.cpp2
-rw-r--r--xfa/fwl/basewidget/ifwl_edit.h2
-rw-r--r--xfa/fwl/core/ifwl_widgetdelegate.h2
-rw-r--r--xfa/fwl/lightwidget/cfwl_app.cpp (renamed from xfa/fwl/lightwidget/app.cpp)8
-rw-r--r--xfa/fwl/lightwidget/cfwl_app.h31
-rw-r--r--xfa/fwl/lightwidget/cfwl_barcode.cpp (renamed from xfa/fwl/lightwidget/barcode.cpp)7
-rw-r--r--xfa/fwl/lightwidget/cfwl_barcode.h120
-rw-r--r--xfa/fwl/lightwidget/cfwl_caret.cpp (renamed from xfa/fwl/lightwidget/caret.cpp)11
-rw-r--r--xfa/fwl/lightwidget/cfwl_caret.h28
-rw-r--r--xfa/fwl/lightwidget/cfwl_checkbox.cpp (renamed from xfa/fwl/lightwidget/checkbox.cpp)12
-rw-r--r--xfa/fwl/lightwidget/cfwl_checkbox.h38
-rw-r--r--xfa/fwl/lightwidget/cfwl_combobox.cpp (renamed from xfa/fwl/lightwidget/combobox.cpp)64
-rw-r--r--xfa/fwl/lightwidget/cfwl_combobox.h143
-rw-r--r--xfa/fwl/lightwidget/cfwl_datetimepicker.cpp (renamed from xfa/fwl/lightwidget/datetimepicker.cpp)30
-rw-r--r--xfa/fwl/lightwidget/cfwl_datetimepicker.h61
-rw-r--r--xfa/fwl/lightwidget/cfwl_edit.cpp (renamed from xfa/fwl/lightwidget/edit.cpp)41
-rw-r--r--xfa/fwl/lightwidget/cfwl_edit.h67
-rw-r--r--xfa/fwl/lightwidget/cfwl_listbox.cpp (renamed from xfa/fwl/lightwidget/listbox.cpp)47
-rw-r--r--xfa/fwl/lightwidget/cfwl_listbox.h127
-rw-r--r--xfa/fwl/lightwidget/cfwl_picturebox.cpp (renamed from xfa/fwl/lightwidget/picturebox.cpp)24
-rw-r--r--xfa/fwl/lightwidget/cfwl_picturebox.h64
-rw-r--r--xfa/fwl/lightwidget/cfwl_pushbutton.cpp (renamed from xfa/fwl/lightwidget/pushbutton.cpp)11
-rw-r--r--xfa/fwl/lightwidget/cfwl_pushbutton.h36
-rw-r--r--xfa/fwl/lightwidget/cfwl_scrollbar.cpp (renamed from xfa/fwl/lightwidget/scrollbar.cpp)21
-rw-r--r--xfa/fwl/lightwidget/cfwl_scrollbar.h32
-rw-r--r--xfa/fwl/lightwidget/cfwl_theme.cpp (renamed from xfa/fwl/lightwidget/theme.cpp)26
-rw-r--r--xfa/fwl/lightwidget/cfwl_theme.h59
-rw-r--r--xfa/fwl/lightwidget/cfwl_tooltip.cpp (renamed from xfa/fwl/lightwidget/tooltipctrl.cpp)25
-rw-r--r--xfa/fwl/lightwidget/cfwl_tooltip.h53
-rw-r--r--xfa/fwl/lightwidget/cfwl_widget.cpp (renamed from xfa/fwl/lightwidget/widget.cpp)68
-rw-r--r--xfa/fwl/lightwidget/cfwl_widget.h76
-rw-r--r--xfa/fwl/lightwidget/cfwl_widgetdelegate.cpp27
-rw-r--r--xfa/fwl/lightwidget/cfwl_widgetdelegate.h29
-rw-r--r--xfa/fwl/lightwidget/cfwl_widgetproperties.cpp25
-rw-r--r--xfa/fwl/lightwidget/cfwl_widgetproperties.h42
-rw-r--r--xfa/fwl/theme/cfwl_barcodetp.cpp (renamed from xfa/fwl/theme/barcodetp.cpp)4
-rw-r--r--xfa/fwl/theme/cfwl_barcodetp.h21
-rw-r--r--xfa/fwl/theme/cfwl_carettp.cpp (renamed from xfa/fwl/theme/carettp.cpp)2
-rw-r--r--xfa/fwl/theme/cfwl_carettp.h27
-rw-r--r--xfa/fwl/theme/cfwl_checkboxtp.cpp (renamed from xfa/fwl/theme/checkboxtp.cpp)2
-rw-r--r--xfa/fwl/theme/cfwl_checkboxtp.h84
-rw-r--r--xfa/fwl/theme/cfwl_comboboxtp.cpp (renamed from xfa/fwl/theme/comboboxtp.cpp)2
-rw-r--r--xfa/fwl/theme/cfwl_comboboxtp.h29
-rw-r--r--xfa/fwl/theme/cfwl_datetimepickedtp.cpp (renamed from xfa/fwl/theme/datetimepickertp.cpp)6
-rw-r--r--xfa/fwl/theme/cfwl_datetimepickertp.h27
-rw-r--r--xfa/fwl/theme/cfwl_edittp.cpp (renamed from xfa/fwl/theme/edittp.cpp)2
-rw-r--r--xfa/fwl/theme/cfwl_edittp.h22
-rw-r--r--xfa/fwl/theme/cfwl_formtp.cpp (renamed from xfa/fwl/theme/formtp.cpp)2
-rw-r--r--xfa/fwl/theme/cfwl_formtp.h111
-rw-r--r--xfa/fwl/theme/cfwl_listboxtp.cpp (renamed from xfa/fwl/theme/listboxtp.cpp)2
-rw-r--r--xfa/fwl/theme/cfwl_listboxtp.h29
-rw-r--r--xfa/fwl/theme/cfwl_monthcalendartp.cpp (renamed from xfa/fwl/theme/monthcalendartp.cpp)2
-rw-r--r--xfa/fwl/theme/cfwl_monthcalendartp.h51
-rw-r--r--xfa/fwl/theme/cfwl_pictureboxtp.cpp (renamed from xfa/fwl/theme/pictureboxtp.cpp)2
-rw-r--r--xfa/fwl/theme/cfwl_pictureboxtp.h20
-rw-r--r--xfa/fwl/theme/cfwl_pushbuttontp.cpp (renamed from xfa/fwl/theme/pushbuttontp.cpp)2
-rw-r--r--xfa/fwl/theme/cfwl_pushbuttontp.h46
-rw-r--r--xfa/fwl/theme/cfwl_scrollbartp.cpp (renamed from xfa/fwl/theme/scrollbartp.cpp)2
-rw-r--r--xfa/fwl/theme/cfwl_scrollbartp.h60
-rw-r--r--xfa/fwl/theme/cfwl_utils.h75
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.cpp (renamed from xfa/fwl/theme/widgettp.cpp)2
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.h220
62 files changed, 2238 insertions, 75 deletions
diff --git a/xfa/fwl/basewidget/fwl_pictureboximp.cpp b/xfa/fwl/basewidget/fwl_pictureboximp.cpp
index f1b72b8ee4..2787423d6e 100644
--- a/xfa/fwl/basewidget/fwl_pictureboximp.cpp
+++ b/xfa/fwl/basewidget/fwl_pictureboximp.cpp
@@ -9,7 +9,7 @@
#include "xfa/fwl/core/fwl_noteimp.h"
#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
-#include "xfa/include/fwl/lightwidget/picturebox.h"
+#include "xfa/fwl/lightwidget/cfwl_picturebox.h"
// static
IFWL_PictureBox* IFWL_PictureBox::Create(
diff --git a/xfa/fwl/basewidget/ifwl_edit.h b/xfa/fwl/basewidget/ifwl_edit.h
index f77714122d..b27f8b4898 100644
--- a/xfa/fwl/basewidget/ifwl_edit.h
+++ b/xfa/fwl/basewidget/ifwl_edit.h
@@ -9,8 +9,8 @@
#include <vector>
-#include "xfa/include/fwl/lightwidget/widget.h"
#include "xfa/fwl/core/ifwl_dataprovider.h"
+#include "xfa/fwl/lightwidget/cfwl_widget.h"
#define FWL_CLASS_Edit L"FWL_EDIT"
#define FWL_CLASSHASH_Edit 2893987822
diff --git a/xfa/fwl/core/ifwl_widgetdelegate.h b/xfa/fwl/core/ifwl_widgetdelegate.h
index eeca68e8bc..7fb56d3ba1 100644
--- a/xfa/fwl/core/ifwl_widgetdelegate.h
+++ b/xfa/fwl/core/ifwl_widgetdelegate.h
@@ -20,7 +20,7 @@ class IFWL_WidgetDelegate {
virtual int32_t OnProcessMessage(CFWL_Message* pMessage) = 0;
virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent) = 0;
virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = NULL) = 0;
+ const CFX_Matrix* pMatrix = nullptr) = 0;
};
#endif // XFA_FWL_CORE_IFWL_WIDGETDELEGATE_H_
diff --git a/xfa/fwl/lightwidget/app.cpp b/xfa/fwl/lightwidget/cfwl_app.cpp
index 1d5b7d6f8f..c09e5c0a26 100644
--- a/xfa/fwl/lightwidget/app.cpp
+++ b/xfa/fwl/lightwidget/cfwl_app.cpp
@@ -4,28 +4,30 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/app.h"
+#include "xfa/fwl/lightwidget/cfwl_app.h"
#include "core/fxcrt/include/fx_coordinates.h"
#include "xfa/fwl/core/fwl_error.h"
#include "xfa/fwl/core/ifwl_app.h"
-#include "xfa/include/fwl/lightwidget/theme.h"
+#include "xfa/fwl/lightwidget/cfwl_theme.h"
CFWL_App::CFWL_App() : m_pIface(IFWL_App::Create(nullptr)), m_pTheme(nullptr) {}
+
CFWL_App::~CFWL_App() {
if (m_pTheme) {
m_pTheme->Finalize();
delete m_pTheme;
- m_pTheme = NULL;
}
m_pIface->Release();
}
+
FWL_ERR CFWL_App::Initialize() {
m_pTheme = new CFWL_Theme;
m_pTheme->Initialize();
m_pIface->SetThemeProvider(m_pTheme);
return m_pIface->Initialize();
}
+
FWL_ERR CFWL_App::Exit(int32_t iExitCode) {
if (!m_pIface)
return FWL_ERR_Indefinite;
diff --git a/xfa/fwl/lightwidget/cfwl_app.h b/xfa/fwl/lightwidget/cfwl_app.h
new file mode 100644
index 0000000000..24cbd5abb4
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_app.h
@@ -0,0 +1,31 @@
+// 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_APP_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_APP_H_
+
+#include "xfa/fwl/core/fwl_error.h"
+
+class CFWL_Theme;
+class IFWL_App;
+
+class CFWL_App {
+ public:
+ CFWL_App();
+ virtual ~CFWL_App();
+
+ FWL_ERR Initialize();
+ FWL_ERR Exit(int32_t iExitCode);
+
+ CFWL_Theme* GetTheme() const { return m_pTheme; }
+ IFWL_App* GetInterface() const { return m_pIface; }
+
+ private:
+ IFWL_App* m_pIface;
+ CFWL_Theme* m_pTheme;
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_APP_H_
diff --git a/xfa/fwl/lightwidget/barcode.cpp b/xfa/fwl/lightwidget/cfwl_barcode.cpp
index 4f05837352..4ac358ce54 100644
--- a/xfa/fwl/lightwidget/barcode.cpp
+++ b/xfa/fwl/lightwidget/cfwl_barcode.cpp
@@ -4,13 +4,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/barcode.h"
+#include "xfa/fwl/lightwidget/cfwl_barcode.h"
#include <memory>
CFWL_Barcode* CFWL_Barcode::Create() {
return new CFWL_Barcode;
}
+
FWL_ERR CFWL_Barcode::Initialize(const CFWL_WidgetProperties* pProperties) {
if (m_pIface)
return FWL_ERR_Indefinite;
@@ -27,13 +28,17 @@ FWL_ERR CFWL_Barcode::Initialize(const CFWL_WidgetProperties* pProperties) {
CFWL_Widget::Initialize();
return FWL_ERR_Succeeded;
}
+
CFWL_Barcode::CFWL_Barcode() {}
+
CFWL_Barcode::~CFWL_Barcode() {}
+
void CFWL_Barcode::SetType(BC_TYPE type) {
if (!m_pIface)
return;
static_cast<IFWL_Barcode*>(m_pIface)->SetType(type);
}
+
FX_BOOL CFWL_Barcode::IsProtectedType() {
if (!m_pIface)
return 0;
diff --git a/xfa/fwl/lightwidget/cfwl_barcode.h b/xfa/fwl/lightwidget/cfwl_barcode.h
new file mode 100644
index 0000000000..e1e7e658d5
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_barcode.h
@@ -0,0 +1,120 @@
+// 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_BARCODE_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_BARCODE_H_
+
+#include "xfa/fwl/basewidget/ifwl_barcode.h"
+#include "xfa/fwl/core/fwl_error.h"
+#include "xfa/fwl/lightwidget/cfwl_edit.h"
+
+class CFWL_Widget;
+class CFWL_WidgetProperties;
+
+class CFWL_Barcode : public CFWL_Edit {
+ public:
+ static CFWL_Barcode* Create();
+ FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL);
+ void SetType(BC_TYPE type);
+ FX_BOOL IsProtectedType();
+
+ void SetCharEncoding(BC_CHAR_ENCODING encoding) {
+ m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CHARENCODING;
+ m_barcodeData.m_eCharEncoding = encoding;
+ }
+ void SetModuleHeight(int32_t height) {
+ m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEHEIGHT;
+ m_barcodeData.m_nModuleHeight = height;
+ }
+ void SetModuleWidth(int32_t width) {
+ m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEWIDTH;
+ m_barcodeData.m_nModuleWidth = width;
+ }
+ void SetDataLength(int32_t dataLength) {
+ m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_DATALENGTH;
+ m_barcodeData.m_nDataLength = dataLength;
+ static_cast<IFWL_Barcode*>(m_pIface)->SetLimit(dataLength);
+ }
+ void SetCalChecksum(int32_t calChecksum) {
+ m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CALCHECKSUM;
+ m_barcodeData.m_nCalChecksum = calChecksum;
+ }
+ void SetPrintChecksum(FX_BOOL printChecksum) {
+ m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_PRINTCHECKSUM;
+ m_barcodeData.m_bPrintChecksum = printChecksum;
+ }
+ void SetTextLocation(BC_TEXT_LOC location) {
+ m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TEXTLOCATION;
+ m_barcodeData.m_eTextLocation = location;
+ }
+ void SetWideNarrowRatio(int32_t ratio) {
+ m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_WIDENARROWRATIO;
+ m_barcodeData.m_nWideNarrowRatio = ratio;
+ }
+ void SetStartChar(FX_CHAR startChar) {
+ m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_STARTCHAR;
+ m_barcodeData.m_cStartChar = startChar;
+ }
+ void SetEndChar(FX_CHAR endChar) {
+ m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ENDCHAR;
+ m_barcodeData.m_cEndChar = endChar;
+ }
+ void SetVersion(int32_t version) {
+ m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_VERSION;
+ m_barcodeData.m_nVersion = version;
+ }
+ void SetErrorCorrectionLevel(int32_t ecLevel) {
+ m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ECLEVEL;
+ m_barcodeData.m_nECLevel = ecLevel;
+ }
+ void SetTruncated(FX_BOOL truncated) {
+ m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TRUNCATED;
+ m_barcodeData.m_bTruncated = truncated;
+ }
+ void ResetBarcodeAttributes() { m_barcodeData.m_dwAttributeMask = 0; }
+
+ protected:
+ CFWL_Barcode();
+ virtual ~CFWL_Barcode();
+
+ class CFWL_BarcodeDP : public IFWL_BarcodeDP {
+ public:
+ virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption);
+ BC_CHAR_ENCODING m_eCharEncoding;
+ virtual BC_CHAR_ENCODING GetCharEncoding() { return m_eCharEncoding; }
+ int32_t m_nModuleHeight, m_nModuleWidth;
+ virtual int32_t GetModuleHeight() { return m_nModuleHeight; }
+ virtual int32_t GetModuleWidth() { return m_nModuleWidth; }
+ int32_t m_nDataLength;
+ virtual int32_t GetDataLength() { return m_nDataLength; }
+ int32_t m_nCalChecksum;
+ virtual int32_t GetCalChecksum() { return m_nCalChecksum; }
+ FX_BOOL m_bPrintChecksum;
+ virtual FX_BOOL GetPrintChecksum() { return m_bPrintChecksum; }
+
+ BC_TEXT_LOC m_eTextLocation;
+ virtual BC_TEXT_LOC GetTextLocation() { return m_eTextLocation; }
+ int32_t m_nWideNarrowRatio;
+ virtual int32_t GetWideNarrowRatio() { return m_nWideNarrowRatio; }
+ FX_CHAR m_cStartChar, m_cEndChar;
+ virtual FX_CHAR GetStartChar() { return m_cStartChar; }
+ virtual FX_CHAR GetEndChar() { return m_cEndChar; }
+ int32_t m_nVersion;
+ virtual int32_t GetVersion() { return m_nVersion; }
+ int32_t m_nECLevel;
+ virtual int32_t GetErrorCorrectionLevel() { return m_nECLevel; }
+ FX_BOOL m_bTruncated;
+ virtual FX_BOOL GetTruncated() { return m_bTruncated; }
+ uint32_t m_dwAttributeMask;
+ virtual uint32_t GetBarcodeAttributeMask() { return m_dwAttributeMask; }
+
+ public:
+ CFWL_BarcodeDP() : m_dwAttributeMask(0) {}
+ };
+ CFWL_BarcodeDP m_barcodeData;
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_BARCODE_H_
diff --git a/xfa/fwl/lightwidget/caret.cpp b/xfa/fwl/lightwidget/cfwl_caret.cpp
index 9c2b90b22a..7fea4f9e77 100644
--- a/xfa/fwl/lightwidget/caret.cpp
+++ b/xfa/fwl/lightwidget/cfwl_caret.cpp
@@ -4,18 +4,19 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/caret.h"
+#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/include/fwl/lightwidget/edit.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;
@@ -32,17 +33,23 @@ FWL_ERR CFWL_Caret::Initialize(const CFWL_WidgetProperties* pProperties) {
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
new file mode 100644
index 0000000000..c806f2eb73
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_caret.h
@@ -0,0 +1,28 @@
+// 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/lightwidget/checkbox.cpp b/xfa/fwl/lightwidget/cfwl_checkbox.cpp
index 1d921993d6..b5e2a87d67 100644
--- a/xfa/fwl/lightwidget/checkbox.cpp
+++ b/xfa/fwl/lightwidget/cfwl_checkbox.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/checkbox.h"
+#include "xfa/fwl/lightwidget/cfwl_checkbox.h"
#include <memory>
@@ -13,6 +13,7 @@
CFWL_CheckBox* CFWL_CheckBox::Create() {
return new CFWL_CheckBox;
}
+
FWL_ERR CFWL_CheckBox::Initialize(const CFWL_WidgetProperties* pProperties) {
if (m_pIface)
return FWL_ERR_Indefinite;
@@ -29,29 +30,38 @@ FWL_ERR CFWL_CheckBox::Initialize(const CFWL_WidgetProperties* pProperties) {
CFWL_Widget::Initialize();
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_CheckBox::SetCaption(const CFX_WideStringC& wsCaption) {
m_checkboxData.m_wsCaption = wsCaption;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_CheckBox::SetBoxSize(FX_FLOAT fHeight) {
m_checkboxData.m_fBoxHeight = fHeight;
return FWL_ERR_Succeeded;
}
+
int32_t CFWL_CheckBox::GetCheckState() {
return static_cast<IFWL_CheckBox*>(m_pIface)->GetCheckState();
}
+
FWL_ERR CFWL_CheckBox::SetCheckState(int32_t iCheck) {
return static_cast<IFWL_CheckBox*>(m_pIface)->SetCheckState(iCheck);
}
+
CFWL_CheckBox::CFWL_CheckBox() {}
+
CFWL_CheckBox::~CFWL_CheckBox() {}
+
CFWL_CheckBox::CFWL_CheckBoxDP::CFWL_CheckBoxDP()
: m_fBoxHeight(16.0f), m_wsCaption(L"Check box") {}
+
FWL_ERR CFWL_CheckBox::CFWL_CheckBoxDP::GetCaption(IFWL_Widget* pWidget,
CFX_WideString& wsCaption) {
wsCaption = m_wsCaption;
return FWL_ERR_Succeeded;
}
+
FX_FLOAT CFWL_CheckBox::CFWL_CheckBoxDP::GetBoxSize(IFWL_Widget* pWidget) {
return m_fBoxHeight;
}
diff --git a/xfa/fwl/lightwidget/cfwl_checkbox.h b/xfa/fwl/lightwidget/cfwl_checkbox.h
new file mode 100644
index 0000000000..7b7e4004bd
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_checkbox.h
@@ -0,0 +1,38 @@
+// 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_CHECKBOX_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_CHECKBOX_H_
+
+#include "xfa/fwl/basewidget/ifwl_checkbox.h"
+#include "xfa/fwl/lightwidget/cfwl_widget.h"
+
+class CFWL_CheckBox : public CFWL_Widget {
+ public:
+ static CFWL_CheckBox* Create();
+
+ FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL);
+ FWL_ERR GetCaption(CFX_WideString& wsCaption);
+ FWL_ERR SetCaption(const CFX_WideStringC& wsCaption);
+ FWL_ERR SetBoxSize(FX_FLOAT fHeight);
+ int32_t GetCheckState();
+ FWL_ERR SetCheckState(int32_t iCheck);
+ CFWL_CheckBox();
+ virtual ~CFWL_CheckBox();
+
+ protected:
+ class CFWL_CheckBoxDP : public IFWL_CheckBoxDP {
+ public:
+ CFWL_CheckBoxDP();
+ virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption);
+ virtual FX_FLOAT GetBoxSize(IFWL_Widget* pWidget);
+ FX_FLOAT m_fBoxHeight;
+ CFX_WideString m_wsCaption;
+ };
+ CFWL_CheckBoxDP m_checkboxData;
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_CHECKBOX_H_
diff --git a/xfa/fwl/lightwidget/combobox.cpp b/xfa/fwl/lightwidget/cfwl_combobox.cpp
index 65b1081832..bdcc36fa30 100644
--- a/xfa/fwl/lightwidget/combobox.cpp
+++ b/xfa/fwl/lightwidget/cfwl_combobox.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/combobox.h"
+#include "xfa/fwl/lightwidget/cfwl_combobox.h"
#include <utility>
@@ -14,6 +14,7 @@
CFWL_ComboBox* CFWL_ComboBox::Create() {
return new CFWL_ComboBox;
}
+
FWL_ERR CFWL_ComboBox::Initialize(const CFWL_WidgetProperties* pProperties) {
if (m_pIface)
return FWL_ERR_Indefinite;
@@ -30,6 +31,7 @@ FWL_ERR CFWL_ComboBox::Initialize(const CFWL_WidgetProperties* pProperties) {
CFWL_Widget::Initialize();
return FWL_ERR_Succeeded;
}
+
int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) {
std::unique_ptr<CFWL_ComboBoxItem> pItem(new CFWL_ComboBoxItem);
pItem->m_wsText = wsText;
@@ -37,6 +39,7 @@ int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) {
m_comboBoxData.m_ItemArray.push_back(std::move(pItem));
return m_comboBoxData.m_ItemArray.size() - 1;
}
+
int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText,
CFX_DIBitmap* pIcon) {
std::unique_ptr<CFWL_ComboBoxItem> pItem(new CFWL_ComboBoxItem);
@@ -46,6 +49,7 @@ int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText,
m_comboBoxData.m_ItemArray.push_back(std::move(pItem));
return m_comboBoxData.m_ItemArray.size() - 1;
}
+
bool CFWL_ComboBox::RemoveAt(int32_t iIndex) {
if (iIndex < 0 ||
static_cast<size_t>(iIndex) >= m_comboBoxData.m_ItemArray.size()) {
@@ -54,12 +58,15 @@ bool CFWL_ComboBox::RemoveAt(int32_t iIndex) {
m_comboBoxData.m_ItemArray.erase(m_comboBoxData.m_ItemArray.begin() + iIndex);
return true;
}
+
void CFWL_ComboBox::RemoveAll() {
m_comboBoxData.m_ItemArray.clear();
}
+
int32_t CFWL_ComboBox::CountItems() {
return m_comboBoxData.CountItems(GetWidget());
}
+
FWL_ERR CFWL_ComboBox::GetTextByIndex(int32_t iIndex, CFX_WideString& wsText) {
CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(
m_comboBoxData.GetItem(m_pIface, iIndex));
@@ -68,26 +75,31 @@ FWL_ERR CFWL_ComboBox::GetTextByIndex(int32_t iIndex, CFX_WideString& wsText) {
wsText = pItem->m_wsText;
return FWL_ERR_Succeeded;
}
+
int32_t CFWL_ComboBox::GetCurSel() {
if (!m_pIface)
return -1;
return static_cast<IFWL_ComboBox*>(m_pIface)->GetCurSel();
}
+
FWL_ERR CFWL_ComboBox::SetCurSel(int32_t iSel) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ComboBox*>(m_pIface)->SetCurSel(iSel);
}
+
FWL_ERR CFWL_ComboBox::SetEditText(const CFX_WideStringC& wsText) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditText(wsText);
}
+
int32_t CFWL_ComboBox::GetEditTextLength() const {
if (!m_pIface)
return 0;
return static_cast<IFWL_ComboBox*>(m_pIface)->GetEditTextLength();
}
+
FWL_ERR CFWL_ComboBox::GetEditText(CFX_WideString& wsText,
int32_t nStart,
int32_t nCount) const {
@@ -96,45 +108,54 @@ FWL_ERR CFWL_ComboBox::GetEditText(CFX_WideString& wsText,
return static_cast<IFWL_ComboBox*>(m_pIface)
->GetEditText(wsText, nStart, nCount);
}
+
FWL_ERR CFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditSelRange(nStart, nCount);
}
+
int32_t CFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) {
if (!m_pIface)
return 0;
return static_cast<IFWL_ComboBox*>(m_pIface)->GetEditSelRange(nIndex, nStart);
}
+
int32_t CFWL_ComboBox::GetEditLimit() {
if (!m_pIface)
return 0;
return static_cast<IFWL_ComboBox*>(m_pIface)->GetEditLimit();
}
+
FWL_ERR CFWL_ComboBox::SetEditLimit(int32_t nLimit) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditLimit(nLimit);
}
+
FWL_ERR CFWL_ComboBox::EditDoClipboard(int32_t iCmd) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditDoClipboard(iCmd);
}
+
FX_BOOL CFWL_ComboBox::EditRedo(const CFX_ByteStringC& bsRecord) {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditRedo(bsRecord);
}
+
FX_BOOL CFWL_ComboBox::EditUndo(const CFX_ByteStringC& bsRecord) {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditUndo(bsRecord);
}
+
FWL_ERR CFWL_ComboBox::SetMaxListHeight(FX_FLOAT fMaxHeight) {
m_comboBoxData.m_fMaxListHeight = fMaxHeight;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ComboBox::SetItemData(int32_t iIndex, void* pData) {
CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(
m_comboBoxData.GetItem(m_pIface, iIndex));
@@ -143,6 +164,7 @@ FWL_ERR CFWL_ComboBox::SetItemData(int32_t iIndex, void* pData) {
pItem->m_pData = pData;
return FWL_ERR_Succeeded;
}
+
void* CFWL_ComboBox::GetItemData(int32_t iIndex) {
CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(
m_comboBoxData.GetItem(m_pIface, iIndex));
@@ -150,86 +172,104 @@ void* CFWL_ComboBox::GetItemData(int32_t iIndex) {
return NULL;
return pItem->m_pData;
}
+
FWL_ERR CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) {
return static_cast<IFWL_ComboBox*>(m_pIface)->GetListBoxt()->SetThemeProvider(
pTheme);
}
+
FX_BOOL CFWL_ComboBox::AfterFocusShowDropList() {
return static_cast<IFWL_ComboBox*>(m_pIface)->AfterFocusShowDropList();
}
+
FWL_ERR CFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) {
return static_cast<IFWL_ComboBox*>(m_pIface)->OpenDropDownList(bActivate);
}
+
FX_BOOL CFWL_ComboBox::EditCanUndo() {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditCanUndo();
}
+
FX_BOOL CFWL_ComboBox::EditCanRedo() {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditCanRedo();
}
+
FX_BOOL CFWL_ComboBox::EditUndo() {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditUndo();
}
+
FX_BOOL CFWL_ComboBox::EditRedo() {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditRedo();
}
+
FX_BOOL CFWL_ComboBox::EditCanCopy() {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditCanCopy();
}
+
FX_BOOL CFWL_ComboBox::EditCanCut() {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditCanCut();
}
+
FX_BOOL CFWL_ComboBox::EditCanSelectAll() {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditCanSelectAll();
}
+
FX_BOOL CFWL_ComboBox::EditCopy(CFX_WideString& wsCopy) {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditCopy(wsCopy);
}
+
FX_BOOL CFWL_ComboBox::EditCut(CFX_WideString& wsCut) {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditCut(wsCut);
}
+
FX_BOOL CFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditPaste(wsPaste);
}
+
FX_BOOL CFWL_ComboBox::EditSelectAll() {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditSelectAll();
}
+
FX_BOOL CFWL_ComboBox::EditDelete() {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditDelete();
}
+
FX_BOOL CFWL_ComboBox::EditDeSelect() {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->EditDeSelect();
}
+
FWL_ERR CFWL_ComboBox::GetBBox(CFX_RectF& rect) {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ComboBox*>(m_pIface)->GetBBox(rect);
}
+
FWL_ERR CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded,
uint32_t dwStylesExRemoved) {
if (!m_pIface)
@@ -237,16 +277,22 @@ FWL_ERR CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded,
return static_cast<IFWL_ComboBox*>(m_pIface)
->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
+
CFWL_ComboBox::CFWL_ComboBox() {}
+
CFWL_ComboBox::~CFWL_ComboBox() {}
+
CFWL_ComboBox::CFWL_ComboBoxDP::CFWL_ComboBoxDP() {
m_fItemHeight = 0;
m_fMaxListHeight = 0;
}
+
CFWL_ComboBox::CFWL_ComboBoxDP::~CFWL_ComboBoxDP() {}
+
int32_t CFWL_ComboBox::CFWL_ComboBoxDP::CountItems(IFWL_Widget* pWidget) {
return m_ItemArray.size();
}
+
FWL_HLISTITEM CFWL_ComboBox::CFWL_ComboBoxDP::GetItem(IFWL_Widget* pWidget,
int32_t nIndex) {
if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size())
@@ -254,6 +300,7 @@ FWL_HLISTITEM CFWL_ComboBox::CFWL_ComboBoxDP::GetItem(IFWL_Widget* pWidget,
return reinterpret_cast<FWL_HLISTITEM>(m_ItemArray[nIndex].get());
}
+
int32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIndex(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
auto it = std::find_if(
@@ -263,6 +310,7 @@ int32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIndex(IFWL_Widget* pWidget,
});
return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1;
}
+
FX_BOOL CFWL_ComboBox::CFWL_ComboBoxDP::SetItemIndex(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
int32_t nIndex) {
@@ -272,12 +320,14 @@ FX_BOOL CFWL_ComboBox::CFWL_ComboBoxDP::SetItemIndex(IFWL_Widget* pWidget,
m_ItemArray[nIndex].reset(reinterpret_cast<CFWL_ComboBoxItem*>(hItem));
return TRUE;
}
+
uint32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemStyles(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
if (!hItem)
return 0;
return reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_dwStyles;
}
+
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemText(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_WideString& wsText) {
@@ -286,6 +336,7 @@ FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemText(IFWL_Widget* pWidget,
wsText = reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_wsText;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_RectF& rtItem) {
@@ -296,6 +347,7 @@ FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemRect(IFWL_Widget* pWidget,
pItem->m_rtItem.height);
return FWL_ERR_Succeeded;
}
+
void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
if (!hItem)
@@ -303,6 +355,7 @@ void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget,
CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem);
return pItem->m_pData;
}
+
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
uint32_t dwStyle) {
@@ -311,6 +364,7 @@ FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget,
reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_dwStyles = dwStyle;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemText(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
const FX_WCHAR* pszText) {
@@ -319,6 +373,7 @@ FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemText(IFWL_Widget* pWidget,
reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_wsText = pszText;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
const CFX_RectF& rtItem) {
@@ -327,15 +382,18 @@ FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemRect(IFWL_Widget* pWidget,
reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_rtItem = rtItem;
return FWL_ERR_Succeeded;
}
+
FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetItemHeight(IFWL_Widget* pWidget) {
return m_fItemHeight;
}
+
CFX_DIBitmap* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIcon(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
if (!hItem)
return NULL;
return reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_pDIB;
}
+
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_RectF& rtCheck) {
@@ -343,6 +401,7 @@ FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget,
rtCheck = pItem->m_rtCheckBox;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckRect(
IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
@@ -351,12 +410,14 @@ FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckRect(
pItem->m_rtCheckBox = rtCheck;
return FWL_ERR_Succeeded;
}
+
uint32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckState(
IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem);
return pItem->m_dwCheckState;
}
+
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckState(
IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
@@ -365,6 +426,7 @@ FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckState(
pItem->m_dwCheckState = dwCheckState;
return FWL_ERR_Succeeded;
}
+
FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetListHeight(IFWL_Widget* pWidget) {
return m_fMaxListHeight;
}
diff --git a/xfa/fwl/lightwidget/cfwl_combobox.h b/xfa/fwl/lightwidget/cfwl_combobox.h
new file mode 100644
index 0000000000..59b542c453
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_combobox.h
@@ -0,0 +1,143 @@
+// 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_COMBOBOX_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_COMBOBOX_H_
+
+#include <memory>
+#include <vector>
+
+#include "xfa/fwl/basewidget/ifwl_combobox.h"
+#include "xfa/fwl/lightwidget/cfwl_widget.h"
+
+class CFWL_WidgetProperties;
+class IFWL_ComboBoxDP;
+class CFWL_ComboBoxDP;
+class CFWL_ComboBoxItem;
+
+class CFWL_ComboBox : public CFWL_Widget {
+ public:
+ static CFWL_ComboBox* Create();
+ FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL);
+ int32_t AddString(const CFX_WideStringC& wsText);
+ int32_t AddString(const CFX_WideStringC& wsText, CFX_DIBitmap* pIcon);
+ bool RemoveAt(int32_t iIndex); // Returns false iff |iIndex| out of range.
+ void RemoveAll();
+ int32_t CountItems();
+ FWL_ERR GetTextByIndex(int32_t iIndex, CFX_WideString& wsText);
+ int32_t GetCurSel();
+ FWL_ERR SetCurSel(int32_t iSel);
+ FWL_ERR SetEditText(const CFX_WideStringC& wsText);
+ int32_t GetEditTextLength() const;
+ FWL_ERR GetEditText(CFX_WideString& wsText,
+ int32_t nStart = 0,
+ int32_t nCount = -1) const;
+ FWL_ERR SetEditSelRange(int32_t nStart, int32_t nCount = -1);
+ int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart);
+ int32_t GetEditLimit();
+ FWL_ERR SetEditLimit(int32_t nLimit);
+ FWL_ERR EditDoClipboard(int32_t iCmd);
+ FX_BOOL EditRedo(const CFX_ByteStringC& bsRecord);
+ FX_BOOL EditUndo(const CFX_ByteStringC& bsRecord);
+ FWL_ERR SetMaxListHeight(FX_FLOAT fMaxHeight);
+ FWL_ERR SetItemData(int32_t iIndex, void* pData);
+ void* GetItemData(int32_t iIndex);
+ FWL_ERR SetListTheme(IFWL_ThemeProvider* pTheme);
+ FX_BOOL AfterFocusShowDropList();
+ FWL_ERR OpenDropDownList(FX_BOOL bActivate);
+
+ FX_BOOL EditCanUndo();
+ FX_BOOL EditCanRedo();
+ FX_BOOL EditUndo();
+ FX_BOOL EditRedo();
+ FX_BOOL EditCanCopy();
+ FX_BOOL EditCanCut();
+ FX_BOOL EditCanSelectAll();
+ FX_BOOL EditCopy(CFX_WideString& wsCopy);
+ FX_BOOL EditCut(CFX_WideString& wsCut);
+ FX_BOOL EditPaste(const CFX_WideString& wsPaste);
+ FX_BOOL EditSelectAll();
+ FX_BOOL EditDelete();
+ FX_BOOL EditDeSelect();
+ FWL_ERR GetBBox(CFX_RectF& rect);
+ FWL_ERR EditModifyStylesEx(uint32_t dwStylesExAdded,
+ uint32_t dwStylesExRemoved);
+ CFWL_ComboBox();
+ virtual ~CFWL_ComboBox();
+
+ protected:
+ class CFWL_ComboBoxDP : public IFWL_ComboBoxDP {
+ public:
+ CFWL_ComboBoxDP();
+ ~CFWL_ComboBoxDP();
+ virtual FWL_ERR GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
+ return FWL_ERR_Succeeded;
+ }
+
+ virtual int32_t CountItems(IFWL_Widget* pWidget);
+ virtual FWL_HLISTITEM GetItem(IFWL_Widget* pWidget, int32_t nIndex);
+ virtual int32_t GetItemIndex(IFWL_Widget* pWidget, FWL_HLISTITEM hItem);
+ virtual FX_BOOL SetItemIndex(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ int32_t nIndex);
+
+ virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, FWL_HLISTITEM hItem);
+ virtual FWL_ERR GetItemText(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ CFX_WideString& wsText);
+ virtual FWL_ERR GetItemRect(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ CFX_RectF& rtItem);
+ virtual void* GetItemData(IFWL_Widget* pWidget, FWL_HLISTITEM hItem);
+ virtual FWL_ERR SetItemStyles(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ uint32_t dwStyle);
+ virtual FWL_ERR SetItemText(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ const FX_WCHAR* pszText);
+ virtual FWL_ERR SetItemRect(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ const CFX_RectF& rtItem);
+ virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget);
+ virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem);
+ virtual FWL_ERR GetItemCheckRect(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ CFX_RectF& rtCheck);
+ virtual FWL_ERR SetItemCheckRect(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ const CFX_RectF& rtCheck);
+ virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem);
+ virtual FWL_ERR SetItemCheckState(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ uint32_t dwCheckState);
+ virtual FX_FLOAT GetListHeight(IFWL_Widget* pWidget);
+
+ std::vector<std::unique_ptr<CFWL_ComboBoxItem>> m_ItemArray;
+ FX_FLOAT m_fMaxListHeight;
+ FX_FLOAT m_fItemHeight;
+ };
+ CFWL_ComboBoxDP m_comboBoxData;
+};
+
+class CFWL_ComboBoxItem {
+ public:
+ CFWL_ComboBoxItem() {
+ m_pDIB = NULL;
+ m_pData = NULL;
+ }
+ CFX_RectF m_rtItem;
+ uint32_t m_dwStyles;
+ CFX_WideString m_wsText;
+ CFX_DIBitmap* m_pDIB;
+ uint32_t m_dwCheckState;
+ CFX_RectF m_rtCheckBox;
+ void* m_pData;
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_COMBOBOX_H_
diff --git a/xfa/fwl/lightwidget/datetimepicker.cpp b/xfa/fwl/lightwidget/cfwl_datetimepicker.cpp
index a3ace90c2d..e470616ed8 100644
--- a/xfa/fwl/lightwidget/datetimepicker.cpp
+++ b/xfa/fwl/lightwidget/cfwl_datetimepicker.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/datetimepicker.h"
+#include "xfa/fwl/lightwidget/cfwl_datetimepicker.h"
#include <memory>
@@ -15,6 +15,7 @@
CFWL_DateTimePicker* CFWL_DateTimePicker::Create() {
return new CFWL_DateTimePicker;
}
+
FWL_ERR CFWL_DateTimePicker::Initialize(
const CFWL_WidgetProperties* pProperties) {
if (m_pIface)
@@ -43,44 +44,55 @@ FWL_ERR CFWL_DateTimePicker::SetToday(int32_t iYear,
m_DateTimePickerDP.m_iDay = iDay;
return FWL_ERR_Succeeded;
}
+
int32_t CFWL_DateTimePicker::CountSelRanges() {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->CountSelRanges();
}
+
int32_t CFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) {
return static_cast<IFWL_DateTimePicker*>(m_pIface)
->GetSelRange(nIndex, nStart);
}
+
FWL_ERR CFWL_DateTimePicker::GetEditText(CFX_WideString& wsText) {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->GetEditText(wsText);
}
+
FWL_ERR CFWL_DateTimePicker::SetEditText(const CFX_WideStringC& wsText) {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->SetEditText(wsText);
}
+
FWL_ERR CFWL_DateTimePicker::GetCurSel(int32_t& iYear,
int32_t& iMonth,
int32_t& iDay) {
return static_cast<IFWL_DateTimePicker*>(m_pIface)
->GetCurSel(iYear, iMonth, iDay);
}
+
FWL_ERR CFWL_DateTimePicker::SetCurSel(int32_t iYear,
int32_t iMonth,
int32_t iDay) {
return static_cast<IFWL_DateTimePicker*>(m_pIface)
->SetCurSel(iYear, iMonth, iDay);
}
+
CFWL_DateTimePicker::CFWL_DateTimePicker() {}
+
CFWL_DateTimePicker::~CFWL_DateTimePicker() {}
+
CFWL_DateTimePicker::CFWL_DateTimePickerDP::CFWL_DateTimePickerDP() {
m_iYear = 2011;
m_iMonth = 1;
m_iDay = 1;
}
+
FWL_ERR CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetCaption(
IFWL_Widget* pWidget,
CFX_WideString& wsCaption) {
wsCaption = m_wsData;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetToday(
IFWL_Widget* pWidget,
int32_t& iYear,
@@ -91,51 +103,67 @@ FWL_ERR CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetToday(
iDay = m_iDay;
return FWL_ERR_Succeeded;
}
+
FX_BOOL CFWL_DateTimePicker::CanUndo() {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanUndo();
}
+
FX_BOOL CFWL_DateTimePicker::CanRedo() {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanRedo();
}
+
FX_BOOL CFWL_DateTimePicker::Undo() {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->Undo();
}
+
FX_BOOL CFWL_DateTimePicker::Redo() {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->Redo();
}
+
FX_BOOL CFWL_DateTimePicker::CanCopy() {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanCopy();
}
+
FX_BOOL CFWL_DateTimePicker::CanCut() {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanCut();
}
+
FX_BOOL CFWL_DateTimePicker::CanSelectAll() {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanSelectAll();
}
+
FX_BOOL CFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->Copy(wsCopy);
}
+
FX_BOOL CFWL_DateTimePicker::Cut(CFX_WideString& wsCut) {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->Copy(wsCut);
}
+
FX_BOOL CFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->Paste(wsPaste);
}
+
FX_BOOL CFWL_DateTimePicker::SelectAll() {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->SelectAll();
}
+
FX_BOOL CFWL_DateTimePicker::Delete() {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->Delete();
}
+
FX_BOOL CFWL_DateTimePicker::DeSelect() {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->DeSelect();
}
+
FWL_ERR CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->GetBBox(rect);
}
+
FWL_ERR CFWL_DateTimePicker::SetEditLimit(int32_t nLimit) {
return static_cast<IFWL_DateTimePicker*>(m_pIface)->SetEditLimit(nLimit);
}
+
FWL_ERR CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded,
uint32_t dwStylesExRemoved) {
return static_cast<IFWL_DateTimePicker*>(m_pIface)
diff --git a/xfa/fwl/lightwidget/cfwl_datetimepicker.h b/xfa/fwl/lightwidget/cfwl_datetimepicker.h
new file mode 100644
index 0000000000..a96ac532c1
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_datetimepicker.h
@@ -0,0 +1,61 @@
+// 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_DATETIMEPICKER_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_DATETIMEPICKER_H_
+
+#include "xfa/fwl/basewidget/ifwl_datetimepicker.h"
+#include "xfa/fwl/lightwidget/cfwl_widget.h"
+
+class CFWL_DateTimePicker : public CFWL_Widget {
+ public:
+ static CFWL_DateTimePicker* Create();
+ FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL);
+ FWL_ERR SetToday(int32_t iYear, int32_t iMonth, int32_t iDay);
+ FWL_ERR GetEditText(CFX_WideString& wsText);
+ FWL_ERR SetEditText(const CFX_WideStringC& wsText);
+ int32_t CountSelRanges();
+ int32_t GetSelRange(int32_t nIndex, int32_t& nStart);
+ FWL_ERR GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay);
+ FWL_ERR SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay);
+ FX_BOOL CanUndo();
+ FX_BOOL CanRedo();
+ FX_BOOL Undo();
+ FX_BOOL Redo();
+ FX_BOOL CanCopy();
+ FX_BOOL CanCut();
+ FX_BOOL CanSelectAll();
+ FX_BOOL Copy(CFX_WideString& wsCopy);
+ FX_BOOL Cut(CFX_WideString& wsCut);
+ FX_BOOL Paste(const CFX_WideString& wsPaste);
+ FX_BOOL SelectAll();
+ FX_BOOL Delete();
+ FX_BOOL DeSelect();
+ FWL_ERR GetBBox(CFX_RectF& rect);
+ FWL_ERR SetEditLimit(int32_t nLimit);
+ FWL_ERR ModifyEditStylesEx(uint32_t dwStylesExAdded,
+ uint32_t dwStylesExRemoved);
+
+ protected:
+ CFWL_DateTimePicker();
+ virtual ~CFWL_DateTimePicker();
+ class CFWL_DateTimePickerDP : public IFWL_DateTimePickerDP {
+ public:
+ CFWL_DateTimePickerDP();
+ virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption);
+ virtual FWL_ERR GetToday(IFWL_Widget* pWidget,
+ int32_t& iYear,
+ int32_t& iMonth,
+ int32_t& iDay);
+ int32_t m_iYear;
+ int32_t m_iMonth;
+ int32_t m_iDay;
+ CFX_WideString m_wsData;
+ };
+ CFWL_DateTimePickerDP m_DateTimePickerDP;
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_DATETIMEPICKER_H_
diff --git a/xfa/fwl/lightwidget/edit.cpp b/xfa/fwl/lightwidget/cfwl_edit.cpp
index efceb4e39f..ba0ff58f6d 100644
--- a/xfa/fwl/lightwidget/edit.cpp
+++ b/xfa/fwl/lightwidget/cfwl_edit.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/edit.h"
+#include "xfa/fwl/lightwidget/cfwl_edit.h"
#include <memory>
#include <vector>
@@ -14,6 +14,7 @@
CFWL_Edit* CFWL_Edit::Create() {
return new CFWL_Edit;
}
+
FWL_ERR CFWL_Edit::Initialize(const CFWL_WidgetProperties* pProperties) {
if (m_pIface)
return FWL_ERR_Indefinite;
@@ -30,16 +31,19 @@ FWL_ERR CFWL_Edit::Initialize(const CFWL_WidgetProperties* pProperties) {
CFWL_Widget::Initialize();
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_Edit::SetText(const CFX_WideString& wsText) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)->SetText(wsText);
}
+
int32_t CFWL_Edit::GetTextLength() const {
if (!m_pIface)
return 0;
return static_cast<IFWL_Edit*>(m_pIface)->GetTextLength();
}
+
FWL_ERR CFWL_Edit::GetText(CFX_WideString& wsText,
int32_t nStart,
int32_t nCount) const {
@@ -47,21 +51,25 @@ FWL_ERR CFWL_Edit::GetText(CFX_WideString& wsText,
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)->GetText(wsText, nStart, nCount);
}
+
FWL_ERR CFWL_Edit::ClearText() {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)->ClearText();
}
+
int32_t CFWL_Edit::GetCaretPos() const {
if (!m_pIface)
return -1;
return static_cast<IFWL_Edit*>(m_pIface)->GetCaretPos();
}
+
int32_t CFWL_Edit::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) {
if (!m_pIface)
return -1;
return static_cast<IFWL_Edit*>(m_pIface)->SetCaretPos(nIndex, bBefore);
}
+
FWL_ERR CFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) {
if (!m_pIface)
return FWL_ERR_Indefinite;
@@ -75,36 +83,43 @@ FWL_ERR CFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) {
}
return static_cast<IFWL_Edit*>(m_pIface)->SetCaretPos(pos);
}
+
int32_t CFWL_Edit::CountSelRanges() {
if (!m_pIface)
return 0;
return static_cast<IFWL_Edit*>(m_pIface)->CountSelRanges();
}
+
int32_t CFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) {
if (!m_pIface)
return 0;
return static_cast<IFWL_Edit*>(m_pIface)->GetSelRange(nIndex, nStart);
}
+
FWL_ERR CFWL_Edit::ClearSelections() {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)->ClearSelections();
}
+
int32_t CFWL_Edit::GetLimit() {
if (!m_pIface)
return -1;
return static_cast<IFWL_Edit*>(m_pIface)->GetLimit();
}
+
FWL_ERR CFWL_Edit::SetLimit(int32_t nLimit) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)->SetLimit(nLimit);
}
+
FWL_ERR CFWL_Edit::SetAliasChar(FX_WCHAR wAlias) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)->SetAliasChar(wAlias);
}
+
FWL_ERR CFWL_Edit::Insert(int32_t nStart,
const FX_WCHAR* lpText,
int32_t nLen) {
@@ -112,21 +127,25 @@ FWL_ERR CFWL_Edit::Insert(int32_t nStart,
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)->Insert(nStart, lpText, nLen);
}
+
FWL_ERR CFWL_Edit::DeleteSelections() {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)->DeleteSelections();
}
+
FWL_ERR CFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)->DeleteRange(nStart, nCount);
}
+
FWL_ERR CFWL_Edit::ReplaceSelections(const CFX_WideStringC& wsReplace) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)->ReplaceSelections(wsReplace);
}
+
FWL_ERR CFWL_Edit::Replace(int32_t nStart,
int32_t nLen,
const CFX_WideStringC& wsReplace) {
@@ -134,78 +153,98 @@ FWL_ERR CFWL_Edit::Replace(int32_t nStart,
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)->Replace(nStart, nLen, wsReplace);
}
+
FWL_ERR CFWL_Edit::DoClipboard(int32_t iCmd) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)->DoClipboard(iCmd);
}
+
FX_BOOL CFWL_Edit::Redo(const CFX_ByteStringC& bsRecord) {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_Edit*>(m_pIface)->Redo(bsRecord);
}
+
FX_BOOL CFWL_Edit::Undo(const CFX_ByteStringC& bsRecord) {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_Edit*>(m_pIface)->Undo(bsRecord);
}
+
FWL_ERR CFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)
->SetTabWidth(fTabWidth, bEquidistant);
}
+
FWL_ERR CFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) {
if (iMin > iMax) {
return FWL_ERR_Parameter_Invalid;
}
return static_cast<IFWL_Edit*>(m_pIface)->SetNumberRange(iMin, iMax);
}
+
FWL_ERR CFWL_Edit::SetBackColor(uint32_t dwColor) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)->SetBackColor(dwColor);
}
+
FWL_ERR CFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_Edit*>(m_pIface)->SetFont(wsFont, fSize);
}
+
FX_BOOL CFWL_Edit::CanUndo() {
return static_cast<IFWL_Edit*>(m_pIface)->CanUndo();
}
+
FX_BOOL CFWL_Edit::CanRedo() {
return static_cast<IFWL_Edit*>(m_pIface)->CanRedo();
}
+
FX_BOOL CFWL_Edit::Undo() {
return static_cast<IFWL_Edit*>(m_pIface)->Undo();
}
+
FX_BOOL CFWL_Edit::Redo() {
return static_cast<IFWL_Edit*>(m_pIface)->Undo();
}
+
FX_BOOL CFWL_Edit::Copy(CFX_WideString& wsCopy) {
return static_cast<IFWL_Edit*>(m_pIface)->Copy(wsCopy);
}
+
FX_BOOL CFWL_Edit::Cut(CFX_WideString& wsCut) {
return static_cast<IFWL_Edit*>(m_pIface)->Cut(wsCut);
}
+
FX_BOOL CFWL_Edit::Paste(const CFX_WideString& wsPaste) {
return static_cast<IFWL_Edit*>(m_pIface)->Paste(wsPaste);
}
+
FX_BOOL CFWL_Edit::Delete() {
return static_cast<IFWL_Edit*>(m_pIface)->Delete();
}
+
void CFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) {
return static_cast<IFWL_Edit*>(m_pIface)->SetScrollOffset(fScrollOffset);
}
+
FX_BOOL CFWL_Edit::GetSuggestWords(CFX_PointF pointf,
std::vector<CFX_ByteString>& sSuggest) {
return static_cast<IFWL_Edit*>(m_pIface)->GetSuggestWords(pointf, sSuggest);
}
+
FX_BOOL CFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf,
const CFX_ByteStringC& bsReplace) {
return static_cast<IFWL_Edit*>(m_pIface)
->ReplaceSpellCheckWord(pointf, bsReplace);
}
+
CFWL_Edit::CFWL_Edit() {}
+
CFWL_Edit::~CFWL_Edit() {}
diff --git a/xfa/fwl/lightwidget/cfwl_edit.h b/xfa/fwl/lightwidget/cfwl_edit.h
new file mode 100644
index 0000000000..153c756044
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_edit.h
@@ -0,0 +1,67 @@
+// 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_EDIT_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_EDIT_H_
+
+#include <vector>
+
+#include "xfa/fwl/lightwidget/cfwl_widget.h"
+
+class CFWL_WidgetProperties;
+
+class CFWL_Edit : public CFWL_Widget {
+ public:
+ static CFWL_Edit* Create();
+ FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL);
+ FWL_ERR SetText(const CFX_WideString& wsText);
+ int32_t GetTextLength() const;
+ FWL_ERR GetText(CFX_WideString& wsText,
+ int32_t nStart = 0,
+ int32_t nCount = -1) const;
+ FWL_ERR ClearText();
+ int32_t GetCaretPos() const;
+ int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE);
+ FWL_ERR AddSelRange(int32_t nStart, int32_t nCount = -1);
+ int32_t CountSelRanges();
+ int32_t GetSelRange(int32_t nIndex, int32_t& nStart);
+ FWL_ERR ClearSelections();
+ int32_t GetLimit();
+ FWL_ERR SetLimit(int32_t nLimit);
+ FWL_ERR SetAliasChar(FX_WCHAR wAlias);
+ FWL_ERR SetFormatString(const CFX_WideString& wsFormat);
+ FWL_ERR Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen);
+ FWL_ERR DeleteSelections();
+ FWL_ERR DeleteRange(int32_t nStart, int32_t nCount = -1);
+ FWL_ERR ReplaceSelections(const CFX_WideStringC& wsReplace);
+ FWL_ERR Replace(int32_t nStart,
+ int32_t nLen,
+ const CFX_WideStringC& wsReplace);
+ FWL_ERR DoClipboard(int32_t iCmd);
+ FX_BOOL Redo(const CFX_ByteStringC& bsRecord);
+ FX_BOOL Undo(const CFX_ByteStringC& bsRecord);
+ FWL_ERR SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant);
+ FWL_ERR SetNumberRange(int32_t iMin, int32_t iMax);
+ FWL_ERR SetBackColor(uint32_t dwColor);
+ FWL_ERR SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize);
+ FX_BOOL CanUndo();
+ FX_BOOL CanRedo();
+ FX_BOOL Undo();
+ FX_BOOL Redo();
+ FX_BOOL Copy(CFX_WideString& wsCopy);
+ FX_BOOL Cut(CFX_WideString& wsCut);
+ FX_BOOL Paste(const CFX_WideString& wsPaste);
+ FX_BOOL Delete();
+ void SetScrollOffset(FX_FLOAT fScrollOffset);
+ FX_BOOL GetSuggestWords(CFX_PointF pointf,
+ std::vector<CFX_ByteString>& sSuggest);
+ FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf,
+ const CFX_ByteStringC& bsReplace);
+ CFWL_Edit();
+ virtual ~CFWL_Edit();
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_EDIT_H_
diff --git a/xfa/fwl/lightwidget/listbox.cpp b/xfa/fwl/lightwidget/cfwl_listbox.cpp
index 7913727775..2102d2d3ee 100644
--- a/xfa/fwl/lightwidget/listbox.cpp
+++ b/xfa/fwl/lightwidget/cfwl_listbox.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/listbox.h"
+#include "xfa/fwl/lightwidget/cfwl_listbox.h"
#include <memory>
@@ -13,6 +13,7 @@
CFWL_ListBox* CFWL_ListBox::Create() {
return new CFWL_ListBox;
}
+
FWL_ERR CFWL_ListBox::Initialize(const CFWL_WidgetProperties* pProperties) {
if (m_pIface)
return FWL_ERR_Indefinite;
@@ -29,10 +30,12 @@ FWL_ERR CFWL_ListBox::Initialize(const CFWL_WidgetProperties* pProperties) {
CFWL_Widget::Initialize();
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, FWL_HLISTITEM hItem) {
reinterpret_cast<CFWL_ListItem*>(hItem)->m_pDIB = pDIB;
return FWL_ERR_Succeeded;
}
+
FWL_HLISTITEM CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd,
FX_BOOL bSelect) {
std::unique_ptr<CFWL_ListItem> pItem(new CFWL_ListItem);
@@ -42,6 +45,7 @@ FWL_HLISTITEM CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd,
m_ListBoxDP.m_ItemArray.push_back(std::move(pItem));
return (FWL_HLISTITEM)m_ListBoxDP.m_ItemArray.back().get();
}
+
FX_BOOL CFWL_ListBox::DeleteString(FWL_HLISTITEM hItem) {
int32_t nIndex = m_ListBoxDP.GetItemIndex(GetWidget(), hItem);
if (nIndex < 0 ||
@@ -64,43 +68,52 @@ FX_BOOL CFWL_ListBox::DeleteString(FWL_HLISTITEM hItem) {
m_ListBoxDP.m_ItemArray.erase(m_ListBoxDP.m_ItemArray.begin() + nIndex);
return TRUE;
}
+
void CFWL_ListBox::DeleteAll() {
m_ListBoxDP.m_ItemArray.clear();
}
+
int32_t CFWL_ListBox::CountSelItems() {
if (!m_pIface)
return 0;
return static_cast<IFWL_ListBox*>(m_pIface)->CountSelItems();
}
+
FWL_HLISTITEM CFWL_ListBox::GetSelItem(int32_t nIndexSel) {
if (!m_pIface)
return NULL;
return static_cast<IFWL_ListBox*>(m_pIface)->GetSelItem(nIndexSel);
}
+
int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) {
if (!m_pIface)
return 0;
return static_cast<IFWL_ListBox*>(m_pIface)->GetSelIndex(nIndex);
}
+
FWL_ERR CFWL_ListBox::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ListBox*>(m_pIface)->SetSelItem(hItem, bSelect);
}
+
FWL_ERR CFWL_ListBox::GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ListBox*>(m_pIface)->GetItemText(hItem, wsText);
}
+
FWL_ERR CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ListBox*>(m_pIface)->GetScrollPos(fPos, bVert);
}
+
FWL_ERR CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) {
m_ListBoxDP.m_fItemHeight = fItemHeight;
return FWL_ERR_Succeeded;
}
+
FWL_HLISTITEM CFWL_ListBox::GetFocusItem() {
for (const auto& hItem : m_ListBoxDP.m_ItemArray) {
if (hItem->m_dwStates & FWL_ITEMSTATE_LTB_Focused)
@@ -108,23 +121,28 @@ FWL_HLISTITEM CFWL_ListBox::GetFocusItem() {
}
return nullptr;
}
+
FWL_ERR CFWL_ListBox::SetFocusItem(FWL_HLISTITEM hItem) {
int32_t nIndex = m_ListBoxDP.GetItemIndex(GetWidget(), hItem);
m_ListBoxDP.m_ItemArray[nIndex]->m_dwStates |= FWL_ITEMSTATE_LTB_Focused;
return FWL_ERR_Succeeded;
}
+
FWL_ERR* CFWL_ListBox::Sort(IFWL_ListBoxCompare* pCom) {
return static_cast<IFWL_ListBox*>(m_pIface)->Sort(pCom);
}
+
int32_t CFWL_ListBox::CountItems() {
return pdfium::CollectionSize<int32_t>(m_ListBoxDP.m_ItemArray);
}
+
FWL_HLISTITEM CFWL_ListBox::GetItem(int32_t nIndex) {
if (nIndex < 0 || nIndex >= CountItems())
return nullptr;
return (FWL_HLISTITEM)m_ListBoxDP.m_ItemArray[nIndex].get();
}
+
FWL_ERR CFWL_ListBox::SetItemString(FWL_HLISTITEM hItem,
const CFX_WideStringC& wsText) {
if (!hItem)
@@ -132,6 +150,7 @@ FWL_ERR CFWL_ListBox::SetItemString(FWL_HLISTITEM hItem,
reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText = wsText;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ListBox::GetItemString(FWL_HLISTITEM hItem,
CFX_WideString& wsText) {
if (!hItem)
@@ -139,17 +158,20 @@ FWL_ERR CFWL_ListBox::GetItemString(FWL_HLISTITEM hItem,
wsText = reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ListBox::SetItemData(FWL_HLISTITEM hItem, void* pData) {
if (!hItem)
return FWL_ERR_Indefinite;
reinterpret_cast<CFWL_ListItem*>(hItem)->m_pData = pData;
return FWL_ERR_Succeeded;
}
+
void* CFWL_ListBox::GetItemData(FWL_HLISTITEM hItem) {
if (!hItem)
return NULL;
return reinterpret_cast<CFWL_ListItem*>(hItem)->m_pData;
}
+
FWL_HLISTITEM CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
CFX_RectF rtClient;
m_pIface->GetClientRect(rtClient);
@@ -174,24 +196,32 @@ FWL_HLISTITEM CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
}
return NULL;
}
+
uint32_t CFWL_ListBox::GetItemStates(FWL_HLISTITEM hItem) {
if (!hItem)
return 0;
CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem);
return pItem->m_dwStates | pItem->m_dwCheckState;
}
+
CFWL_ListBox::CFWL_ListBox() {}
+
CFWL_ListBox::~CFWL_ListBox() {}
+
CFWL_ListBox::CFWL_ListBoxDP::CFWL_ListBoxDP() {}
+
CFWL_ListBox::CFWL_ListBoxDP::~CFWL_ListBoxDP() {}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetCaption(IFWL_Widget* pWidget,
CFX_WideString& wsCaption) {
wsCaption = m_wsData;
return FWL_ERR_Succeeded;
}
+
int32_t CFWL_ListBox::CFWL_ListBoxDP::CountItems(IFWL_Widget* pWidget) {
return pdfium::CollectionSize<int32_t>(m_ItemArray);
}
+
FWL_HLISTITEM CFWL_ListBox::CFWL_ListBoxDP::GetItem(IFWL_Widget* pWidget,
int32_t nIndex) {
if (nIndex < 0 || nIndex >= CountItems(pWidget))
@@ -199,6 +229,7 @@ FWL_HLISTITEM CFWL_ListBox::CFWL_ListBoxDP::GetItem(IFWL_Widget* pWidget,
return (FWL_HLISTITEM)m_ItemArray[nIndex].get();
}
+
int32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemIndex(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
auto it = std::find_if(
@@ -208,6 +239,7 @@ int32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemIndex(IFWL_Widget* pWidget,
});
return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1;
}
+
FX_BOOL CFWL_ListBox::CFWL_ListBoxDP::SetItemIndex(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
int32_t nIndex) {
@@ -216,12 +248,14 @@ FX_BOOL CFWL_ListBox::CFWL_ListBoxDP::SetItemIndex(IFWL_Widget* pWidget,
m_ItemArray[nIndex].reset(reinterpret_cast<CFWL_ListItem*>(hItem));
return TRUE;
}
+
uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemStyles(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
if (!hItem)
return -1;
return reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwStates;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemText(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_WideString& wsText) {
@@ -230,6 +264,7 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemText(IFWL_Widget* pWidget,
wsText = reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_RectF& rtItem) {
@@ -239,6 +274,7 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemRect(IFWL_Widget* pWidget,
rtItem = pItem->m_rtItem;
return FWL_ERR_Succeeded;
}
+
void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
if (!hItem)
@@ -246,6 +282,7 @@ void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget,
CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem);
return pItem->m_pData;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
uint32_t dwStyle) {
@@ -254,6 +291,7 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget,
reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwStates = dwStyle;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemText(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
const FX_WCHAR* pszText) {
@@ -262,6 +300,7 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemText(IFWL_Widget* pWidget,
reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText = pszText;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
const CFX_RectF& rtItem) {
@@ -270,19 +309,23 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemRect(IFWL_Widget* pWidget,
reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtItem = rtItem;
return FWL_ERR_Succeeded;
}
+
FX_FLOAT CFWL_ListBox::CFWL_ListBoxDP::GetItemHeight(IFWL_Widget* pWidget) {
return m_fItemHeight;
}
+
CFX_DIBitmap* CFWL_ListBox::CFWL_ListBoxDP::GetItemIcon(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
return reinterpret_cast<CFWL_ListItem*>(hItem)->m_pDIB;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_RectF& rtCheck) {
rtCheck = reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckRect(
IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
@@ -290,10 +333,12 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckRect(
reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox = rtCheck;
return FWL_ERR_Succeeded;
}
+
uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckState(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
return reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwCheckState;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckState(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
uint32_t dwCheckState) {
diff --git a/xfa/fwl/lightwidget/cfwl_listbox.h b/xfa/fwl/lightwidget/cfwl_listbox.h
new file mode 100644
index 0000000000..28fb42af69
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_listbox.h
@@ -0,0 +1,127 @@
+// 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_LISTBOX_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_LISTBOX_H_
+
+#include <memory>
+#include <vector>
+
+#include "xfa/fwl/basewidget/ifwl_listbox.h"
+#include "xfa/fwl/core/fwl_error.h"
+#include "xfa/fwl/core/ifwl_widget.h"
+#include "xfa/fwl/lightwidget/cfwl_widget.h"
+
+class CFWL_ListItem;
+
+class CFWL_ListBox : public CFWL_Widget {
+ public:
+ static CFWL_ListBox* Create();
+ FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL);
+ FWL_ERR AddDIBitmap(CFX_DIBitmap* pDIB, FWL_HLISTITEM hItem);
+ FWL_HLISTITEM AddString(const CFX_WideStringC& wsAdd,
+ FX_BOOL bSelect = FALSE);
+ FX_BOOL DeleteString(FWL_HLISTITEM hItem);
+ void DeleteAll();
+ int32_t CountSelItems();
+ FWL_HLISTITEM GetSelItem(int32_t nIndexSel);
+ int32_t GetSelIndex(int32_t nIndex);
+ FWL_ERR SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE);
+ FWL_ERR GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText);
+ FWL_ERR GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE);
+ FWL_ERR SetItemHeight(FX_FLOAT fItemHeight);
+ FWL_HLISTITEM GetFocusItem();
+ FWL_ERR SetFocusItem(FWL_HLISTITEM hItem);
+ FWL_ERR* Sort(IFWL_ListBoxCompare* pCom);
+ int32_t CountItems();
+ FWL_HLISTITEM GetItem(int32_t nIndex);
+ FWL_ERR SetItemString(FWL_HLISTITEM hItem, const CFX_WideStringC& wsText);
+ FWL_ERR GetItemString(FWL_HLISTITEM hItem, CFX_WideString& wsText);
+ FWL_ERR SetItemData(FWL_HLISTITEM hItem, void* pData);
+ void* GetItemData(FWL_HLISTITEM hItem);
+ FWL_HLISTITEM GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy);
+ uint32_t GetItemStates(FWL_HLISTITEM hItem);
+ CFWL_ListBox();
+ virtual ~CFWL_ListBox();
+
+ protected:
+ class CFWL_ListBoxDP : public IFWL_ListBoxDP {
+ public:
+ CFWL_ListBoxDP();
+ ~CFWL_ListBoxDP();
+
+ // IFWL_DataProvider:
+ FWL_ERR GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) override;
+
+ // IFWL_ListBoxDP:
+ int32_t CountItems(IFWL_Widget* pWidget) override;
+ FWL_HLISTITEM GetItem(IFWL_Widget* pWidget, int32_t nIndex) override;
+ int32_t GetItemIndex(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) override;
+ FX_BOOL SetItemIndex(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ int32_t nIndex) override;
+ uint32_t GetItemStyles(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) override;
+ FWL_ERR GetItemText(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ CFX_WideString& wsText) override;
+ FWL_ERR GetItemRect(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ CFX_RectF& rtItem) override;
+ void* GetItemData(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) override;
+ FWL_ERR SetItemStyles(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ uint32_t dwStyle) override;
+ FWL_ERR SetItemText(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ const FX_WCHAR* pszText) override;
+ FWL_ERR SetItemRect(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ const CFX_RectF& rtItem) override;
+ FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override;
+ CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem) override;
+ FWL_ERR GetItemCheckRect(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ CFX_RectF& rtCheck) override;
+ FWL_ERR SetItemCheckRect(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ const CFX_RectF& rtCheck) override;
+ uint32_t GetItemCheckState(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem) override;
+ FWL_ERR SetItemCheckState(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ uint32_t dwCheckState) override;
+
+ std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray;
+ CFX_WideString m_wsData;
+ FX_FLOAT m_fItemHeight;
+ };
+
+ CFWL_ListBoxDP m_ListBoxDP;
+};
+
+class CFWL_ListItem {
+ public:
+ CFWL_ListItem() {
+ m_rtItem.Reset();
+ m_dwStates = 0;
+ m_wsText = L"";
+ m_pDIB = NULL;
+ m_pData = NULL;
+ m_dwCheckState = 0;
+ m_rtCheckBox.Reset();
+ }
+ CFX_RectF m_rtItem;
+ uint32_t m_dwStates;
+ CFX_WideString m_wsText;
+ CFX_DIBitmap* m_pDIB;
+ void* m_pData;
+ uint32_t m_dwCheckState;
+ CFX_RectF m_rtCheckBox;
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_LISTBOX_H_
diff --git a/xfa/fwl/lightwidget/picturebox.cpp b/xfa/fwl/lightwidget/cfwl_picturebox.cpp
index e35741c3ac..b0bd3c9931 100644
--- a/xfa/fwl/lightwidget/picturebox.cpp
+++ b/xfa/fwl/lightwidget/cfwl_picturebox.cpp
@@ -4,13 +4,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/picturebox.h"
+#include "xfa/fwl/lightwidget/cfwl_picturebox.h"
#include <memory>
CFWL_PictureBox* CFWL_PictureBox::Create() {
return new CFWL_PictureBox;
}
+
FWL_ERR CFWL_PictureBox::Initialize(const CFWL_WidgetProperties* pProperties) {
if (m_pIface)
return FWL_ERR_Indefinite;
@@ -27,45 +28,56 @@ FWL_ERR CFWL_PictureBox::Initialize(const CFWL_WidgetProperties* pProperties) {
CFWL_Widget::Initialize();
return FWL_ERR_Succeeded;
}
+
CFX_DIBitmap* CFWL_PictureBox::GetPicture() {
return m_PictureBoxDP.m_pBitmap;
}
+
FWL_ERR CFWL_PictureBox::SetPicture(CFX_DIBitmap* pBitmap) {
m_PictureBoxDP.m_pBitmap = pBitmap;
return FWL_ERR_Succeeded;
}
+
FX_FLOAT CFWL_PictureBox::GetRotation() {
return m_PictureBoxDP.m_fRotation;
}
+
FWL_ERR CFWL_PictureBox::SetRotation(FX_FLOAT fRotation) {
m_PictureBoxDP.m_fRotation = fRotation;
return FWL_ERR_Succeeded;
}
+
int32_t CFWL_PictureBox::GetFlipMode() {
return m_PictureBoxDP.GetFlipMode(m_pIface);
}
+
FWL_ERR CFWL_PictureBox::SetFlipMode(int32_t iFlipMode) {
m_PictureBoxDP.m_iFlipMode = iFlipMode;
return FWL_ERR_Succeeded;
}
+
int32_t CFWL_PictureBox::GetOpacity() {
return m_PictureBoxDP.GetOpacity(m_pIface);
}
+
FWL_ERR CFWL_PictureBox::SetOpacity(int32_t iOpacity) {
m_PictureBoxDP.m_iOpacity = iOpacity;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_PictureBox::GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY) {
CFX_Matrix matrix;
m_PictureBoxDP.GetMatrix(m_pIface, matrix);
matrix.Scale(fScaleX, fScaleY);
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_PictureBox::SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY) {
m_PictureBoxDP.m_fScaleX = fScaleX;
m_PictureBoxDP.m_fScaleY = fScaleY;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_PictureBox::GetOffset(FX_FLOAT& fx, FX_FLOAT& fy) {
CFX_Matrix matrix;
m_PictureBoxDP.GetMatrix(m_pIface, matrix);
@@ -73,33 +85,42 @@ FWL_ERR CFWL_PictureBox::GetOffset(FX_FLOAT& fx, FX_FLOAT& fy) {
fy = matrix.f;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_PictureBox::SetOffset(FX_FLOAT fx, FX_FLOAT fy) {
m_PictureBoxDP.m_fOffSetX = fx;
m_PictureBoxDP.m_fOffSetY = fy;
return FWL_ERR_Succeeded;
}
+
CFWL_PictureBox::CFWL_PictureBox() {}
+
CFWL_PictureBox::~CFWL_PictureBox() {}
+
FWL_ERR CFWL_PictureBox::CFWL_PictureBoxDP::GetCaption(
IFWL_Widget* pWidget,
CFX_WideString& wsCaption) {
return FWL_ERR_Succeeded;
}
+
CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetPicture(
IFWL_Widget* pWidget) {
return m_pBitmap;
}
+
CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetErrorPicture(
IFWL_Widget* pWidget) {
return m_pBitmap;
}
+
CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetInitialPicture(
IFWL_Widget* pWidget) {
return m_pBitmap;
}
+
int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetOpacity(IFWL_Widget* pWidget) {
return m_iOpacity;
}
+
FWL_ERR CFWL_PictureBox::CFWL_PictureBoxDP::GetMatrix(IFWL_Widget* pWidget,
CFX_Matrix& matrix) {
CFX_RectF rect;
@@ -114,6 +135,7 @@ FWL_ERR CFWL_PictureBox::CFWL_PictureBoxDP::GetMatrix(IFWL_Widget* pWidget,
matrix.Translate(m_fOffSetX, m_fOffSetY);
return FWL_ERR_Succeeded;
}
+
int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetFlipMode(IFWL_Widget* pWidget) {
return m_iFlipMode;
}
diff --git a/xfa/fwl/lightwidget/cfwl_picturebox.h b/xfa/fwl/lightwidget/cfwl_picturebox.h
new file mode 100644
index 0000000000..8fa985acd8
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_picturebox.h
@@ -0,0 +1,64 @@
+// 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_PICTUREBOX_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_PICTUREBOX_H_
+
+#include "xfa/fwl/basewidget/ifwl_picturebox.h"
+#include "xfa/fwl/core/fwl_error.h"
+#include "xfa/fwl/lightwidget/cfwl_widget.h"
+
+class CFWL_PictureBox : public CFWL_Widget {
+ public:
+ static CFWL_PictureBox* Create();
+ FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL);
+ CFX_DIBitmap* GetPicture();
+ FWL_ERR SetPicture(CFX_DIBitmap* pBitmap);
+ FX_FLOAT GetRotation();
+ FWL_ERR SetRotation(FX_FLOAT fRotation);
+ int32_t GetFlipMode();
+ FWL_ERR SetFlipMode(int32_t iFlipMode);
+ int32_t GetOpacity();
+ FWL_ERR SetOpacity(int32_t iOpacity);
+ FWL_ERR GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY);
+ FWL_ERR SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY);
+ FWL_ERR GetOffset(FX_FLOAT& fx, FX_FLOAT& fy);
+ FWL_ERR SetOffset(FX_FLOAT fx, FX_FLOAT fy);
+ CFWL_PictureBox();
+ virtual ~CFWL_PictureBox();
+
+ protected:
+ class CFWL_PictureBoxDP : public IFWL_PictureBoxDP {
+ public:
+ CFWL_PictureBoxDP() {
+ m_fRotation = 0.0f;
+ m_fScaleX = 1.0f;
+ m_fScaleY = 1.0f;
+ m_fOffSetX = 0.0f;
+ m_fOffSetY = 0.0f;
+ m_pBitmap = NULL;
+ }
+ virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption);
+ virtual CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget);
+ virtual CFX_DIBitmap* GetErrorPicture(IFWL_Widget* pWidget);
+ virtual CFX_DIBitmap* GetInitialPicture(IFWL_Widget* pWidget);
+ virtual int32_t GetOpacity(IFWL_Widget* pWidget);
+ virtual int32_t GetFlipMode(IFWL_Widget* pWidget);
+ virtual FWL_ERR GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix);
+ CFX_DIBitmap* m_pBitmap;
+ int32_t m_iOpacity;
+ int32_t m_iFlipMode;
+ FX_FLOAT m_fRotation;
+ FX_FLOAT m_fScaleX;
+ FX_FLOAT m_fScaleY;
+ FX_FLOAT m_fOffSetX;
+ FX_FLOAT m_fOffSetY;
+ CFX_WideString m_wsData;
+ };
+ CFWL_PictureBoxDP m_PictureBoxDP;
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_PICTUREBOX_H_
diff --git a/xfa/fwl/lightwidget/pushbutton.cpp b/xfa/fwl/lightwidget/cfwl_pushbutton.cpp
index c9fb74e5f5..52747bdebe 100644
--- a/xfa/fwl/lightwidget/pushbutton.cpp
+++ b/xfa/fwl/lightwidget/cfwl_pushbutton.cpp
@@ -4,13 +4,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/pushbutton.h"
+#include "xfa/fwl/lightwidget/cfwl_pushbutton.h"
#include <memory>
CFWL_PushButton* CFWL_PushButton::Create() {
return new CFWL_PushButton;
}
+
FWL_ERR CFWL_PushButton::Initialize(const CFWL_WidgetProperties* pProperties) {
if (m_pIface)
return FWL_ERR_Indefinite;
@@ -27,29 +28,37 @@ FWL_ERR CFWL_PushButton::Initialize(const CFWL_WidgetProperties* pProperties) {
CFWL_Widget::Initialize();
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) {
wsCaption = m_buttonData.m_wsCaption;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_PushButton::SetCaption(const CFX_WideStringC& wsCaption) {
m_buttonData.m_wsCaption = wsCaption;
return FWL_ERR_Succeeded;
}
+
CFX_DIBitmap* CFWL_PushButton::GetPicture() {
return m_buttonData.m_pBitmap;
}
+
FWL_ERR CFWL_PushButton::SetPicture(CFX_DIBitmap* pBitmap) {
m_buttonData.m_pBitmap = pBitmap;
return FWL_ERR_Succeeded;
}
+
CFWL_PushButton::CFWL_PushButton() {}
+
CFWL_PushButton::~CFWL_PushButton() {}
+
FWL_ERR CFWL_PushButton::CFWL_PushButtonDP::GetCaption(
IFWL_Widget* pWidget,
CFX_WideString& wsCaption) {
wsCaption = m_wsCaption;
return FWL_ERR_Succeeded;
}
+
CFX_DIBitmap* CFWL_PushButton::CFWL_PushButtonDP::GetPicture(
IFWL_Widget* pWidget) {
return m_pBitmap;
diff --git a/xfa/fwl/lightwidget/cfwl_pushbutton.h b/xfa/fwl/lightwidget/cfwl_pushbutton.h
new file mode 100644
index 0000000000..99b067d2cf
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_pushbutton.h
@@ -0,0 +1,36 @@
+// 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_PUSHBUTTON_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_PUSHBUTTON_H_
+
+#include "xfa/fwl/basewidget/ifwl_pushbutton.h"
+#include "xfa/fwl/lightwidget/cfwl_widget.h"
+
+class CFWL_PushButton : public CFWL_Widget {
+ public:
+ static CFWL_PushButton* Create();
+ FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL);
+ FWL_ERR GetCaption(CFX_WideString& wsCaption);
+ FWL_ERR SetCaption(const CFX_WideStringC& wsCaption);
+ CFX_DIBitmap* GetPicture();
+ FWL_ERR SetPicture(CFX_DIBitmap* pBitmap);
+ CFWL_PushButton();
+ virtual ~CFWL_PushButton();
+
+ protected:
+ class CFWL_PushButtonDP : public IFWL_PushButtonDP {
+ public:
+ CFWL_PushButtonDP() : m_pBitmap(NULL) {}
+ FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption);
+ virtual CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget);
+ CFX_WideString m_wsCaption;
+ CFX_DIBitmap* m_pBitmap;
+ };
+ CFWL_PushButtonDP m_buttonData;
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_PUSHBUTTON_H_
diff --git a/xfa/fwl/lightwidget/scrollbar.cpp b/xfa/fwl/lightwidget/cfwl_scrollbar.cpp
index 62f2ffd1e5..0c02314733 100644
--- a/xfa/fwl/lightwidget/scrollbar.cpp
+++ b/xfa/fwl/lightwidget/cfwl_scrollbar.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/scrollbar.h"
+#include "xfa/fwl/lightwidget/cfwl_scrollbar.h"
#include <memory>
@@ -13,6 +13,11 @@
CFWL_ScrollBar* CFWL_ScrollBar::Create() {
return new CFWL_ScrollBar;
}
+
+CFWL_ScrollBar::CFWL_ScrollBar() {}
+
+CFWL_ScrollBar::~CFWL_ScrollBar() {}
+
FWL_ERR CFWL_ScrollBar::Initialize(const CFWL_WidgetProperties* pProperties) {
if (m_pIface)
return FWL_ERR_Indefinite;
@@ -29,65 +34,75 @@ FWL_ERR CFWL_ScrollBar::Initialize(const CFWL_WidgetProperties* pProperties) {
CFWL_Widget::Initialize();
return FWL_ERR_Succeeded;
}
+
FX_BOOL CFWL_ScrollBar::IsVertical() {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ScrollBar*>(m_pIface)->IsVertical();
}
+
FWL_ERR CFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ScrollBar*>(m_pIface)->GetRange(fMin, fMax);
}
+
FWL_ERR CFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ScrollBar*>(m_pIface)->SetRange(fMin, fMax);
}
+
FX_FLOAT CFWL_ScrollBar::GetPageSize() {
if (!m_pIface)
return 0;
return static_cast<IFWL_ScrollBar*>(m_pIface)->GetPageSize();
}
+
FWL_ERR CFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ScrollBar*>(m_pIface)->SetPageSize(fPageSize);
}
+
FX_FLOAT CFWL_ScrollBar::GetStepSize() {
if (!m_pIface)
return 0;
return static_cast<IFWL_ScrollBar*>(m_pIface)->GetStepSize();
}
+
FWL_ERR CFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ScrollBar*>(m_pIface)->SetStepSize(fStepSize);
}
+
FX_FLOAT CFWL_ScrollBar::GetPos() {
if (!m_pIface)
return -1;
return static_cast<IFWL_ScrollBar*>(m_pIface)->GetPos();
}
+
FWL_ERR CFWL_ScrollBar::SetPos(FX_FLOAT fPos) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ScrollBar*>(m_pIface)->SetPos(fPos);
}
+
FX_FLOAT CFWL_ScrollBar::GetTrackPos() {
if (!m_pIface)
return -1;
return static_cast<IFWL_ScrollBar*>(m_pIface)->GetTrackPos();
}
+
FWL_ERR CFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ScrollBar*>(m_pIface)->SetTrackPos(fTrackPos);
}
+
FX_BOOL CFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) {
if (!m_pIface)
return FALSE;
return static_cast<IFWL_ScrollBar*>(m_pIface)->DoScroll(dwCode, fPos);
}
-CFWL_ScrollBar::CFWL_ScrollBar() {}
-CFWL_ScrollBar::~CFWL_ScrollBar() {}
diff --git a/xfa/fwl/lightwidget/cfwl_scrollbar.h b/xfa/fwl/lightwidget/cfwl_scrollbar.h
new file mode 100644
index 0000000000..89c0fe44e4
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_scrollbar.h
@@ -0,0 +1,32 @@
+// 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_SCROLLBAR_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_SCROLLBAR_H_
+
+#include "xfa/fwl/lightwidget/cfwl_widget.h"
+
+class CFWL_ScrollBar : public CFWL_Widget {
+ public:
+ static CFWL_ScrollBar* Create();
+ FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL);
+ FX_BOOL IsVertical();
+ FWL_ERR GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax);
+ FWL_ERR SetRange(FX_FLOAT fMin, FX_FLOAT fMax);
+ FX_FLOAT GetPageSize();
+ FWL_ERR SetPageSize(FX_FLOAT fPageSize);
+ FX_FLOAT GetStepSize();
+ FWL_ERR SetStepSize(FX_FLOAT fStepSize);
+ FX_FLOAT GetPos();
+ FWL_ERR SetPos(FX_FLOAT fPos);
+ FX_FLOAT GetTrackPos();
+ FWL_ERR SetTrackPos(FX_FLOAT fTrackPos);
+ FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f);
+ CFWL_ScrollBar();
+ virtual ~CFWL_ScrollBar();
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_SCROLLBAR_H_
diff --git a/xfa/fwl/lightwidget/theme.cpp b/xfa/fwl/lightwidget/cfwl_theme.cpp
index 59729c1b2d..fdb0a89997 100644
--- a/xfa/fwl/lightwidget/theme.cpp
+++ b/xfa/fwl/lightwidget/cfwl_theme.cpp
@@ -4,25 +4,25 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/theme.h"
+#include "xfa/fwl/lightwidget/cfwl_theme.h"
#include <algorithm>
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_themepart.h"
#include "xfa/fwl/core/cfwl_themetext.h"
-#include "xfa/include/fwl/theme/barcodetp.h"
-#include "xfa/include/fwl/theme/carettp.h"
-#include "xfa/include/fwl/theme/checkboxtp.h"
-#include "xfa/include/fwl/theme/comboboxtp.h"
-#include "xfa/include/fwl/theme/datetimepickertp.h"
-#include "xfa/include/fwl/theme/edittp.h"
-#include "xfa/include/fwl/theme/formtp.h"
-#include "xfa/include/fwl/theme/listboxtp.h"
-#include "xfa/include/fwl/theme/monthcalendartp.h"
-#include "xfa/include/fwl/theme/pictureboxtp.h"
-#include "xfa/include/fwl/theme/pushbuttontp.h"
-#include "xfa/include/fwl/theme/scrollbartp.h"
+#include "xfa/fwl/theme/cfwl_barcodetp.h"
+#include "xfa/fwl/theme/cfwl_carettp.h"
+#include "xfa/fwl/theme/cfwl_checkboxtp.h"
+#include "xfa/fwl/theme/cfwl_comboboxtp.h"
+#include "xfa/fwl/theme/cfwl_datetimepickertp.h"
+#include "xfa/fwl/theme/cfwl_edittp.h"
+#include "xfa/fwl/theme/cfwl_formtp.h"
+#include "xfa/fwl/theme/cfwl_listboxtp.h"
+#include "xfa/fwl/theme/cfwl_monthcalendartp.h"
+#include "xfa/fwl/theme/cfwl_pictureboxtp.h"
+#include "xfa/fwl/theme/cfwl_pushbuttontp.h"
+#include "xfa/fwl/theme/cfwl_scrollbartp.h"
CFWL_Theme::CFWL_Theme() {
m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_FormTP));
diff --git a/xfa/fwl/lightwidget/cfwl_theme.h b/xfa/fwl/lightwidget/cfwl_theme.h
new file mode 100644
index 0000000000..fa62e092fb
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_theme.h
@@ -0,0 +1,59 @@
+// 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_THEME_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_THEME_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/include/fx_coordinates.h"
+#include "core/fxcrt/include/fx_system.h"
+#include "core/include/fxge/fx_dib.h"
+#include "xfa/fwl/core/ifwl_themeprovider.h"
+
+class CFWL_WidgetTP;
+class IFWL_Widget;
+class CFWL_ThemePart;
+class CFWL_ThemeText;
+
+class CFWL_Theme : public IFWL_ThemeProvider {
+ public:
+ CFWL_Theme();
+ ~CFWL_Theme() override;
+
+ // IFWL_ThemeProvider:
+ FX_BOOL IsValidWidget(IFWL_Widget* pWidget) override;
+ uint32_t GetThemeID(IFWL_Widget* pWidget) override;
+ uint32_t SetThemeID(IFWL_Widget* pWidget,
+ uint32_t dwThemeID,
+ FX_BOOL bChildren = TRUE) override;
+ FWL_ERR GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) override;
+ FWL_ERR SetThemeMatrix(IFWL_Widget* pWidget,
+ const CFX_Matrix& matrix) override;
+ FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override;
+ FX_BOOL DrawText(CFWL_ThemeText* pParams) override;
+ void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity) override;
+ FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget) override;
+ FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) override;
+ FX_BOOL IsInPart(CFWL_ThemePart* pThemePart,
+ FX_FLOAT fx,
+ FX_FLOAT fy) override;
+ FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) override;
+
+ FWL_ERR Initialize();
+ FWL_ERR Finalize();
+ FWL_ERR SetFont(IFWL_Widget* pWidget,
+ const FX_WCHAR* strFont,
+ FX_FLOAT fFontSize,
+ FX_ARGB rgbFont);
+ CFWL_WidgetTP* GetTheme(IFWL_Widget* pWidget);
+
+ protected:
+ std::vector<std::unique_ptr<CFWL_WidgetTP>> m_ThemesArray;
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_THEME_H_
diff --git a/xfa/fwl/lightwidget/tooltipctrl.cpp b/xfa/fwl/lightwidget/cfwl_tooltip.cpp
index 323eed0282..abdf48997c 100644
--- a/xfa/fwl/lightwidget/tooltipctrl.cpp
+++ b/xfa/fwl/lightwidget/cfwl_tooltip.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/tooltipctrl.h"
+#include "xfa/fwl/lightwidget/cfwl_tooltip.h"
#include <memory>
@@ -18,6 +18,7 @@
CFWL_ToolTip* CFWL_ToolTip::Create() {
return new CFWL_ToolTip;
}
+
FWL_ERR CFWL_ToolTip::Initialize(const CFWL_WidgetProperties* pProperties) {
if (m_pIface)
return FWL_ERR_Indefinite;
@@ -34,78 +35,100 @@ FWL_ERR CFWL_ToolTip::Initialize(const CFWL_WidgetProperties* pProperties) {
CFWL_Widget::Initialize();
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ToolTip::GetCaption(CFX_WideString& wsCaption) {
wsCaption = m_tooltipData.m_wsCaption;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ToolTip::SetCaption(const CFX_WideStringC& wsCaption) {
m_tooltipData.m_wsCaption = wsCaption;
return FWL_ERR_Succeeded;
}
+
int32_t CFWL_ToolTip::GetInitialDelay() {
return m_tooltipData.m_nInitDelayTime;
}
+
int32_t CFWL_ToolTip::SetInitialDelay(int32_t nDelayTime) {
m_tooltipData.m_nInitDelayTime = nDelayTime;
return FWL_ERR_Succeeded;
}
+
int32_t CFWL_ToolTip::GetAutoPopDelay() {
return m_tooltipData.m_nAutoPopDelayTime;
}
+
int32_t CFWL_ToolTip::SetAutoPopDelay(int32_t nDelayTime) {
m_tooltipData.m_nAutoPopDelayTime = nDelayTime;
return FWL_ERR_Succeeded;
}
+
CFX_DIBitmap* CFWL_ToolTip::GetToolTipIcon() {
return m_tooltipData.m_pBitmap;
}
+
FWL_ERR CFWL_ToolTip::SetToolTipIcon(CFX_DIBitmap* pBitmap) {
m_tooltipData.m_pBitmap = pBitmap;
return FWL_ERR_Succeeded;
}
+
CFX_SizeF CFWL_ToolTip::GetToolTipIconSize() {
return m_tooltipData.m_fIconSize;
}
+
FWL_ERR CFWL_ToolTip::SetToolTipIconSize(CFX_SizeF fSize) {
m_tooltipData.m_fIconSize = fSize;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) {
return static_cast<IFWL_ToolTip*>(m_pIface)->SetAnchor(rtAnchor);
}
+
FWL_ERR CFWL_ToolTip::Show() {
return static_cast<IFWL_ToolTip*>(m_pIface)->Show();
}
+
FWL_ERR CFWL_ToolTip::Hide() {
return static_cast<IFWL_ToolTip*>(m_pIface)->Hide();
}
+
CFWL_ToolTip::CFWL_ToolTip() {}
+
CFWL_ToolTip::~CFWL_ToolTip() {}
+
CFWL_ToolTip::CFWL_ToolTipDP::CFWL_ToolTipDP() : m_pBitmap(NULL) {
m_wsCaption = L"";
m_nInitDelayTime = 500;
m_nAutoPopDelayTime = 50000;
m_fAnchor.Set(0.0, 0.0, 0.0, 0.0);
}
+
FWL_ERR CFWL_ToolTip::CFWL_ToolTipDP::GetCaption(IFWL_Widget* pWidget,
CFX_WideString& wsCaption) {
wsCaption = m_wsCaption;
return FWL_ERR_Succeeded;
}
+
int32_t CFWL_ToolTip::CFWL_ToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) {
return m_nInitDelayTime;
}
+
int32_t CFWL_ToolTip::CFWL_ToolTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) {
return m_nAutoPopDelayTime;
}
+
CFX_DIBitmap* CFWL_ToolTip::CFWL_ToolTipDP::GetToolTipIcon(
IFWL_Widget* pWidget) {
return m_pBitmap;
}
+
CFX_SizeF CFWL_ToolTip::CFWL_ToolTipDP::GetToolTipIconSize(
IFWL_Widget* pWidget) {
return m_fIconSize;
}
+
CFX_RectF CFWL_ToolTip::CFWL_ToolTipDP::GetAnchor() {
return m_fAnchor;
}
diff --git a/xfa/fwl/lightwidget/cfwl_tooltip.h b/xfa/fwl/lightwidget/cfwl_tooltip.h
new file mode 100644
index 0000000000..817362a41c
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_tooltip.h
@@ -0,0 +1,53 @@
+// 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_TOOLTIP_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_TOOLTIP_H_
+
+#include "xfa/fwl/basewidget/ifwl_tooltip.h"
+#include "xfa/fwl/lightwidget/cfwl_widget.h"
+
+class CFWL_ToolTip : public CFWL_Widget {
+ public:
+ static CFWL_ToolTip* Create();
+ FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL);
+ FWL_ERR GetCaption(CFX_WideString& wsCaption);
+ FWL_ERR SetCaption(const CFX_WideStringC& wsCaption);
+ int32_t GetInitialDelay();
+ int32_t SetInitialDelay(int32_t nDelayTime);
+ int32_t GetAutoPopDelay();
+ int32_t SetAutoPopDelay(int32_t nDelayTime);
+ CFX_DIBitmap* GetToolTipIcon();
+ FWL_ERR SetToolTipIcon(CFX_DIBitmap* pBitmap);
+ CFX_SizeF GetToolTipIconSize();
+ FWL_ERR SetToolTipIconSize(CFX_SizeF fSize);
+ FWL_ERR SetAnchor(const CFX_RectF& rtAnchor);
+ FWL_ERR Show();
+ FWL_ERR Hide();
+ CFWL_ToolTip();
+ virtual ~CFWL_ToolTip();
+
+ protected:
+ class CFWL_ToolTipDP : public IFWL_ToolTipDP {
+ public:
+ CFWL_ToolTipDP();
+ FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption);
+ int32_t GetInitialDelay(IFWL_Widget* pWidget);
+ int32_t GetAutoPopDelay(IFWL_Widget* pWidget);
+ CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget);
+ CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget);
+ CFX_RectF GetAnchor();
+ CFX_WideString m_wsCaption;
+ int32_t m_nInitDelayTime;
+ int32_t m_nAutoPopDelayTime;
+ CFX_DIBitmap* m_pBitmap;
+ CFX_SizeF m_fIconSize;
+ CFX_RectF m_fAnchor;
+ };
+ CFWL_ToolTipDP m_tooltipData;
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_TOOLTIP_H_
diff --git a/xfa/fwl/lightwidget/widget.cpp b/xfa/fwl/lightwidget/cfwl_widget.cpp
index 294604a01b..1f4512e381 100644
--- a/xfa/fwl/lightwidget/widget.cpp
+++ b/xfa/fwl/lightwidget/cfwl_widget.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/widget.h"
+#include "xfa/fwl/lightwidget/cfwl_widget.h"
#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fwl/core/cfwl_themetext.h"
@@ -16,65 +16,60 @@
#include "xfa/fwl/core/ifwl_notethread.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
-CFWL_WidgetImpProperties CFWL_WidgetProperties::MakeWidgetImpProperties(
- IFWL_DataProvider* pDataProvider) const {
- CFWL_WidgetImpProperties result;
- result.m_ctmOnParent = m_ctmOnParent;
- result.m_rtWidget = m_rtWidget;
- result.m_dwStyles = m_dwStyles;
- result.m_dwStyleExes = m_dwStyleExes;
- result.m_dwStates = m_dwStates;
- if (m_pParent)
- result.m_pParent = m_pParent->GetWidget();
- if (m_pOwner)
- result.m_pOwner = m_pOwner->GetWidget();
- result.m_pDataProvider = pDataProvider;
- return result;
-}
IFWL_Widget* CFWL_Widget::GetWidget() {
return m_pIface;
}
+
FWL_ERR CFWL_Widget::GetClassName(CFX_WideString& wsClass) const {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->GetClassName(wsClass);
}
+
uint32_t CFWL_Widget::GetClassID() const {
if (!m_pIface)
return 0;
return m_pIface->GetClassID();
}
+
FX_BOOL CFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const {
if (!m_pIface)
return FALSE;
return m_pIface->IsInstance(wsClass);
}
+
static void* gs_pFWLWidget = (void*)FXBSTR_ID('l', 'i', 'g', 't');
+
FWL_ERR CFWL_Widget::Initialize(const CFWL_WidgetProperties* pProperties) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->SetPrivateData(gs_pFWLWidget, this, NULL);
}
+
FWL_ERR CFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->GetWidgetRect(rect, bAutoSize);
}
+
FWL_ERR CFWL_Widget::GetGlobalRect(CFX_RectF& rect) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->GetGlobalRect(rect);
}
+
FWL_ERR CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->SetWidgetRect(rect);
}
+
FWL_ERR CFWL_Widget::GetClientRect(CFX_RectF& rect) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->GetClientRect(rect);
}
+
CFWL_Widget* CFWL_Widget::GetParent() {
if (!m_pIface)
return NULL;
@@ -84,26 +79,31 @@ CFWL_Widget* CFWL_Widget::GetParent() {
}
return NULL;
}
+
FWL_ERR CFWL_Widget::SetParent(CFWL_Widget* pParent) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->SetParent(pParent ? pParent->GetWidget() : NULL);
}
+
CFWL_Widget* CFWL_Widget::GetOwner() {
if (!m_pIface)
return NULL;
return NULL;
}
+
FWL_ERR CFWL_Widget::SetOwner(CFWL_Widget* pOwner) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return FWL_ERR_Succeeded;
}
+
uint32_t CFWL_Widget::GetStyles() {
if (!m_pIface)
return 0;
return m_pIface->GetStyles();
}
+
FWL_ERR CFWL_Widget::ModifyStyles(uint32_t dwStylesAdded,
uint32_t dwStylesRemoved) {
if (!m_pIface)
@@ -115,20 +115,24 @@ uint32_t CFWL_Widget::GetStylesEx() {
return 0;
return m_pIface->GetStylesEx();
}
+
FWL_ERR CFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded,
uint32_t dwStylesExRemoved) {
return m_pIface->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
+
uint32_t CFWL_Widget::GetStates() {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->GetStates();
}
+
FWL_ERR CFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->SetStates(dwStates, bSet);
}
+
FWL_ERR CFWL_Widget::SetPrivateData(void* module_id,
void* pData,
PD_CALLBACK_FREEDATA callback) {
@@ -136,31 +140,37 @@ FWL_ERR CFWL_Widget::SetPrivateData(void* module_id,
return FWL_ERR_Indefinite;
return m_pIface->SetPrivateData(module_id, pData, callback);
}
+
void* CFWL_Widget::GetPrivateData(void* module_id) {
if (!m_pIface)
return NULL;
return m_pIface->GetPrivateData(module_id);
}
+
FWL_ERR CFWL_Widget::Update() {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->Update();
}
+
FWL_ERR CFWL_Widget::LockUpdate() {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->LockUpdate();
}
+
FWL_ERR CFWL_Widget::UnlockUpdate() {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->UnlockUpdate();
}
+
uint32_t CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (!m_pIface)
return 0;
return m_pIface->HitTest(fx, fy);
}
+
FWL_ERR CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
FX_FLOAT& fx,
FX_FLOAT& fy) {
@@ -168,39 +178,46 @@ FWL_ERR CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
return FWL_ERR_Indefinite;
return m_pIface->TransformTo(pWidget ? pWidget->GetWidget() : NULL, fx, fy);
}
+
FWL_ERR CFWL_Widget::TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->TransformTo(pWidget ? pWidget->GetWidget() : NULL, rt);
}
+
FWL_ERR CFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->GetMatrix(matrix, bGlobal);
}
+
FWL_ERR CFWL_Widget::SetMatrix(const CFX_Matrix& matrix) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->SetMatrix(matrix);
}
+
FWL_ERR CFWL_Widget::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return m_pIface->DrawWidget(pGraphics, pMatrix);
}
+
IFWL_WidgetDelegate* CFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) {
if (!m_pIface)
return NULL;
m_pDelegate = m_pIface->SetDelegate(pDelegate);
return m_pDelegate;
}
+
CFWL_Widget::CFWL_Widget()
: m_pIface(NULL), m_pDelegate(NULL), m_pProperties(NULL) {
m_pProperties = new CFWL_WidgetProperties;
m_pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
FXSYS_assert(m_pWidgetMgr != NULL);
}
+
CFWL_Widget::~CFWL_Widget() {
delete m_pProperties;
if (m_pIface) {
@@ -208,6 +225,7 @@ CFWL_Widget::~CFWL_Widget() {
delete m_pIface;
}
}
+
FWL_ERR CFWL_Widget::Repaint(const CFX_RectF* pRect) {
if (!m_pIface)
return FWL_ERR_Indefinite;
@@ -220,6 +238,7 @@ FWL_ERR CFWL_Widget::Repaint(const CFX_RectF* pRect) {
}
return m_pWidgetMgr->RepaintWidget(m_pIface, &rect);
}
+
FWL_ERR CFWL_Widget::SetFocus(FX_BOOL bFocus) {
if (!m_pIface)
return FWL_ERR_Indefinite;
@@ -238,6 +257,7 @@ FWL_ERR CFWL_Widget::SetFocus(FX_BOOL bFocus) {
}
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_Widget::SetGrab(FX_BOOL bSet) {
if (!m_pIface)
return FWL_ERR_Indefinite;
@@ -250,6 +270,7 @@ FWL_ERR CFWL_Widget::SetGrab(FX_BOOL bSet) {
pDriver->SetGrab(m_pIface, bSet);
return FWL_ERR_Succeeded;
}
+
void CFWL_Widget::RegisterEventTarget(CFWL_Widget* pEventSource,
uint32_t dwFilter) {
if (!m_pIface)
@@ -264,6 +285,7 @@ void CFWL_Widget::RegisterEventTarget(CFWL_Widget* pEventSource,
!pEventSource ? NULL : pEventSource->GetWidget();
pNoteDriver->RegisterEventTarget(GetWidget(), pEventSourceImp, dwFilter);
}
+
void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
if (!m_pIface)
return;
@@ -278,9 +300,11 @@ void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
return;
pNoteDriver->SendNote(pEvent);
}
+
#define FWL_WGT_CalcHeight 2048
#define FWL_WGT_CalcWidth 2048
#define FWL_WGT_CalcMultiLineDefWidth 120.0f
+
CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText,
FX_BOOL bMultiLine,
int32_t iLineWidth) {
@@ -305,15 +329,3 @@ CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText,
pTheme->CalcTextRect(&calPart, rect);
return CFX_SizeF(rect.width, rect.height);
}
-CFWL_WidgetDelegate::CFWL_WidgetDelegate() {}
-CFWL_WidgetDelegate::~CFWL_WidgetDelegate() {}
-int32_t CFWL_WidgetDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- return 1;
-}
-FWL_ERR CFWL_WidgetDelegate::OnProcessEvent(CFWL_Event* pEvent) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_WidgetDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
- return FWL_ERR_Succeeded;
-}
diff --git a/xfa/fwl/lightwidget/cfwl_widget.h b/xfa/fwl/lightwidget/cfwl_widget.h
new file mode 100644
index 0000000000..f1b6715811
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_widget.h
@@ -0,0 +1,76 @@
+// 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_WIDGET_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_WIDGET_H_
+
+#include "xfa/fwl/core/cfwl_event.h"
+#include "xfa/fwl/lightwidget/cfwl_widgetproperties.h"
+#include "xfa/fwl/core/ifwl_widget.h"
+
+class CFWL_Event;
+class CFWL_Message;
+class CFWL_Widget;
+class CFWL_WidgetDelegate;
+class CFWL_WidgetMgr;
+
+class CFWL_Widget {
+ public:
+ virtual ~CFWL_Widget();
+ IFWL_Widget* GetWidget();
+ FWL_ERR GetClassName(CFX_WideString& wsClass) const;
+ uint32_t GetClassID() const;
+ virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const;
+
+ FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
+ FWL_ERR GetGlobalRect(CFX_RectF& rect);
+ FWL_ERR SetWidgetRect(const CFX_RectF& rect);
+ FWL_ERR GetClientRect(CFX_RectF& rtClient);
+ CFWL_Widget* GetParent();
+ FWL_ERR SetParent(CFWL_Widget* pParent);
+ CFWL_Widget* GetOwner();
+ FWL_ERR SetOwner(CFWL_Widget* pOwner);
+ uint32_t GetStyles();
+ FWL_ERR ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved);
+ uint32_t GetStylesEx();
+ FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved);
+ uint32_t GetStates();
+ FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
+ FWL_ERR SetPrivateData(void* module_id,
+ void* pData,
+ PD_CALLBACK_FREEDATA callback);
+ void* GetPrivateData(void* module_id);
+ FWL_ERR Update();
+ FWL_ERR LockUpdate();
+ FWL_ERR UnlockUpdate();
+ uint32_t HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ FWL_ERR TransformTo(CFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy);
+ FWL_ERR TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt);
+ FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE);
+ FWL_ERR SetMatrix(const CFX_Matrix& matrix);
+ FWL_ERR DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL);
+ IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate);
+ FWL_ERR Repaint(const CFX_RectF* pRect = NULL);
+ FWL_ERR SetFocus(FX_BOOL bFocus);
+ FWL_ERR SetGrab(FX_BOOL bSet);
+ CFWL_Widget();
+
+ void RegisterEventTarget(CFWL_Widget* pEventSource = NULL,
+ uint32_t dwFilter = FWL_EVENT_ALL_MASK);
+ void DispatchEvent(CFWL_Event* pEvent);
+ CFX_SizeF CalcTextSize(const CFX_WideString& wsText,
+ FX_BOOL bMultiLine = FALSE,
+ int32_t iLineWidth = -1);
+ IFWL_Widget* m_pIface;
+ IFWL_WidgetDelegate* m_pDelegate;
+ CFWL_WidgetMgr* m_pWidgetMgr;
+ CFWL_WidgetProperties* m_pProperties;
+
+ protected:
+ FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL);
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_WIDGET_H_
diff --git a/xfa/fwl/lightwidget/cfwl_widgetdelegate.cpp b/xfa/fwl/lightwidget/cfwl_widgetdelegate.cpp
new file mode 100644
index 0000000000..1596aba48a
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_widgetdelegate.cpp
@@ -0,0 +1,27 @@
+// Copyright 2016 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_widgetdelegate.h"
+
+#include "xfa/fwl/core/cfwl_event.h"
+#include "xfa/fwl/core/cfwl_message.h"
+
+CFWL_WidgetDelegate::CFWL_WidgetDelegate() {}
+
+CFWL_WidgetDelegate::~CFWL_WidgetDelegate() {}
+
+int32_t CFWL_WidgetDelegate::OnProcessMessage(CFWL_Message* pMessage) {
+ return 1;
+}
+
+FWL_ERR CFWL_WidgetDelegate::OnProcessEvent(CFWL_Event* pEvent) {
+ return FWL_ERR_Succeeded;
+}
+
+FWL_ERR CFWL_WidgetDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
+ return FWL_ERR_Succeeded;
+}
diff --git a/xfa/fwl/lightwidget/cfwl_widgetdelegate.h b/xfa/fwl/lightwidget/cfwl_widgetdelegate.h
new file mode 100644
index 0000000000..42f6f9329f
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_widgetdelegate.h
@@ -0,0 +1,29 @@
+// Copyright 2016 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_WIDGETDELEGATE_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_WIDGETDELEGATE_H_
+
+#include "xfa/fwl/core/fwl_error.h"
+#include "xfa/fwl/core/ifwl_widgetdelegate.h"
+
+class CFWL_Event;
+class CFWL_Message;
+class CFX_Graphics;
+class CFX_Matrix;
+
+class CFWL_WidgetDelegate : public IFWL_WidgetDelegate {
+ public:
+ CFWL_WidgetDelegate();
+ virtual ~CFWL_WidgetDelegate();
+
+ int32_t OnProcessMessage(CFWL_Message* pMessage) override;
+ FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override;
+ FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_WIDGETDELEGATE_H_
diff --git a/xfa/fwl/lightwidget/cfwl_widgetproperties.cpp b/xfa/fwl/lightwidget/cfwl_widgetproperties.cpp
new file mode 100644
index 0000000000..9afa1b6959
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_widgetproperties.cpp
@@ -0,0 +1,25 @@
+// Copyright 2016 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_widgetproperties.h"
+
+#include "xfa/fwl/lightwidget/cfwl_widget.h"
+
+CFWL_WidgetImpProperties CFWL_WidgetProperties::MakeWidgetImpProperties(
+ IFWL_DataProvider* pDataProvider) const {
+ CFWL_WidgetImpProperties result;
+ result.m_ctmOnParent = m_ctmOnParent;
+ result.m_rtWidget = m_rtWidget;
+ result.m_dwStyles = m_dwStyles;
+ result.m_dwStyleExes = m_dwStyleExes;
+ result.m_dwStates = m_dwStates;
+ if (m_pParent)
+ result.m_pParent = m_pParent->GetWidget();
+ if (m_pOwner)
+ result.m_pOwner = m_pOwner->GetWidget();
+ result.m_pDataProvider = pDataProvider;
+ return result;
+}
diff --git a/xfa/fwl/lightwidget/cfwl_widgetproperties.h b/xfa/fwl/lightwidget/cfwl_widgetproperties.h
new file mode 100644
index 0000000000..2a3e3ffefb
--- /dev/null
+++ b/xfa/fwl/lightwidget/cfwl_widgetproperties.h
@@ -0,0 +1,42 @@
+// Copyright 2016 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_WIDGETPROPERTIES_H_
+#define XFA_FWL_LIGHTWIDGET_CFWL_WIDGETPROPERTIES_H_
+
+#include "core/fxcrt/include/fx_coordinates.h"
+#include "core/fxcrt/include/fx_string.h"
+#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+
+class CFWL_Widget;
+class IFWL_DataProvider;
+
+class CFWL_WidgetProperties {
+ public:
+ CFWL_WidgetProperties()
+ : m_dwStyles(FWL_WGTSTYLE_Child),
+ m_dwStyleExes(0),
+ m_dwStates(0),
+ m_pParent(nullptr),
+ m_pOwner(nullptr) {
+ m_rtWidget.Set(0, 0, 0, 0);
+ }
+
+ CFWL_WidgetImpProperties MakeWidgetImpProperties(
+ IFWL_DataProvider* pDataProvider) const;
+
+ CFX_WideString m_wsWindowclass;
+ CFX_Matrix m_ctmOnParent;
+ CFX_RectF m_rtWidget;
+ uint32_t m_dwStyles;
+ uint32_t m_dwStyleExes;
+ uint32_t m_dwStates;
+ CFWL_Widget* m_pParent;
+ CFWL_Widget* m_pOwner;
+};
+
+#endif // XFA_FWL_LIGHTWIDGET_CFWL_WIDGETPROPERTIES_H_
diff --git a/xfa/fwl/theme/barcodetp.cpp b/xfa/fwl/theme/cfwl_barcodetp.cpp
index da10d7a344..0edc29b775 100644
--- a/xfa/fwl/theme/barcodetp.cpp
+++ b/xfa/fwl/theme/cfwl_barcodetp.cpp
@@ -4,13 +4,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/theme/barcodetp.h"
+#include "xfa/fwl/theme/cfwl_barcodetp.h"
#include "xfa/fwl/basewidget/ifwl_barcode.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/ifwl_widget.h"
CFWL_BarcodeTP::CFWL_BarcodeTP() {}
+
CFWL_BarcodeTP::~CFWL_BarcodeTP() {}
FX_BOOL CFWL_BarcodeTP::IsValidWidget(IFWL_Widget* pWidget) {
@@ -18,6 +19,7 @@ FX_BOOL CFWL_BarcodeTP::IsValidWidget(IFWL_Widget* pWidget) {
return FALSE;
return pWidget->GetClassID() == FWL_CLASSHASH_Barcode;
}
+
FX_BOOL CFWL_BarcodeTP::DrawBackground(CFWL_ThemeBackground* pParams) {
if (!pParams)
return FALSE;
diff --git a/xfa/fwl/theme/cfwl_barcodetp.h b/xfa/fwl/theme/cfwl_barcodetp.h
new file mode 100644
index 0000000000..0a03f49805
--- /dev/null
+++ b/xfa/fwl/theme/cfwl_barcodetp.h
@@ -0,0 +1,21 @@
+// 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_THEME_CFWL_BARCODETP_H_
+#define XFA_FWL_THEME_CFWL_BARCODETP_H_
+
+#include "xfa/fwl/theme/cfwl_utils.h"
+#include "xfa/fwl/theme/cfwl_widgettp.h"
+
+class CFWL_BarcodeTP : public CFWL_WidgetTP {
+ public:
+ CFWL_BarcodeTP();
+ virtual ~CFWL_BarcodeTP();
+ virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
+ virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams);
+};
+
+#endif // XFA_FWL_THEME_CFWL_BARCODETP_H_
diff --git a/xfa/fwl/theme/carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp
index a5782f30b6..0ebc519642 100644
--- a/xfa/fwl/theme/carettp.cpp
+++ b/xfa/fwl/theme/cfwl_carettp.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/theme/carettp.h"
+#include "xfa/fwl/theme/cfwl_carettp.h"
#include "xfa/fwl/basewidget/ifwl_caret.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
diff --git a/xfa/fwl/theme/cfwl_carettp.h b/xfa/fwl/theme/cfwl_carettp.h
new file mode 100644
index 0000000000..8c56d38aa9
--- /dev/null
+++ b/xfa/fwl/theme/cfwl_carettp.h
@@ -0,0 +1,27 @@
+// 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_THEME_CFWL_CARETTP_H_
+#define XFA_FWL_THEME_CFWL_CARETTP_H_
+
+#include "xfa/fwl/theme/cfwl_widgettp.h"
+
+class CFWL_CaretTP : public CFWL_WidgetTP {
+ public:
+ CFWL_CaretTP();
+ virtual ~CFWL_CaretTP();
+ virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
+ virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams);
+
+ protected:
+ void DrawCaretBK(CFX_Graphics* pGraphics,
+ uint32_t dwStates,
+ const CFX_RectF* pRect,
+ CFX_Color* crFill,
+ CFX_Matrix* pMatrix = NULL);
+};
+
+#endif // XFA_FWL_THEME_CFWL_CARETTP_H_
diff --git a/xfa/fwl/theme/checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp
index ee485fb7ac..94f69a4389 100644
--- a/xfa/fwl/theme/checkboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/theme/checkboxtp.h"
+#include "xfa/fwl/theme/cfwl_checkboxtp.h"
#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fwl/basewidget/ifwl_checkbox.h"
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.h b/xfa/fwl/theme/cfwl_checkboxtp.h
new file mode 100644
index 0000000000..bb2f14dec3
--- /dev/null
+++ b/xfa/fwl/theme/cfwl_checkboxtp.h
@@ -0,0 +1,84 @@
+// 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_THEME_CFWL_CHECKBOXTP_H_
+#define XFA_FWL_THEME_CFWL_CHECKBOXTP_H_
+
+#include "xfa/fwl/theme/cfwl_utils.h"
+#include "xfa/fwl/theme/cfwl_widgettp.h"
+
+class CFWL_CheckBoxTP : public CFWL_WidgetTP {
+ public:
+ CFWL_CheckBoxTP();
+ virtual ~CFWL_CheckBoxTP();
+ virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
+ virtual uint32_t SetThemeID(IFWL_Widget* pWidget,
+ uint32_t dwThemeID,
+ FX_BOOL bChildren = TRUE);
+ virtual FX_BOOL DrawText(CFWL_ThemeText* pParams);
+ virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams);
+ virtual FWL_ERR Initialize();
+ virtual FWL_ERR Finalize();
+
+ protected:
+ void DrawBoxBk(IFWL_Widget* pWidget,
+ CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ uint32_t dwStates,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawSign(IFWL_Widget* pWidget,
+ CFX_Graphics* pGraphics,
+ const CFX_RectF* pRtBox,
+ uint32_t dwStates,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawSignNeutral(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRtSign,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawSignCheck(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRtSign,
+ FX_ARGB argbFill,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawSignCircle(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRtSign,
+ FX_ARGB argbFill,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawSignCross(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRtSign,
+ FX_ARGB argbFill,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawSignDiamond(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRtSign,
+ FX_ARGB argbFill,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawSignSquare(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRtSign,
+ FX_ARGB argbFill,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawSignStar(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRtSign,
+ FX_ARGB argbFill,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawSignBorder(IFWL_Widget* pWidget,
+ CFX_Graphics* pGraphics,
+ const CFX_RectF* pRtBox,
+ FX_BOOL bDisable = FALSE,
+ CFX_Matrix* pMatrix = NULL);
+ void SetThemeData(uint32_t dwID);
+ void initCheckPath(FX_FLOAT fCheckLen);
+ struct CKBThemeData {
+ FX_ARGB clrBoxBk[13][2];
+ FX_ARGB clrSignBorderNormal;
+ FX_ARGB clrSignBorderDisable;
+ FX_ARGB clrSignCheck;
+ FX_ARGB clrSignNeutral;
+ FX_ARGB clrSignNeutralNormal;
+ FX_ARGB clrSignNeutralHover;
+ FX_ARGB clrSignNeutralPressed;
+ } * m_pThemeData;
+ CFX_Path* m_pCheckPath;
+};
+
+#endif // XFA_FWL_THEME_CFWL_CHECKBOXTP_H_
diff --git a/xfa/fwl/theme/comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp
index 578793b002..2c5a1c4ff4 100644
--- a/xfa/fwl/theme/comboboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/theme/comboboxtp.h"
+#include "xfa/fwl/theme/cfwl_comboboxtp.h"
#include "xfa/fwl/basewidget/ifwl_combobox.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
diff --git a/xfa/fwl/theme/cfwl_comboboxtp.h b/xfa/fwl/theme/cfwl_comboboxtp.h
new file mode 100644
index 0000000000..fd65fa5fab
--- /dev/null
+++ b/xfa/fwl/theme/cfwl_comboboxtp.h
@@ -0,0 +1,29 @@
+// 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_THEME_CFWL_COMBOBOXTP_H_
+#define XFA_FWL_THEME_CFWL_COMBOBOXTP_H_
+
+#include "xfa/fwl/theme/cfwl_widgettp.h"
+
+class CFWL_ComboBoxTP : public CFWL_WidgetTP {
+ public:
+ CFWL_ComboBoxTP();
+ virtual ~CFWL_ComboBoxTP();
+ virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
+ virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams);
+ virtual void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity);
+
+ protected:
+ void DrawDropDownButton(CFWL_ThemeBackground* pParams,
+ uint32_t dwStates,
+ CFX_Matrix* pMatrix);
+ void DrawStrethHandler(CFWL_ThemeBackground* pParams,
+ uint32_t dwStates,
+ CFX_Matrix* pMatrix);
+};
+
+#endif // XFA_FWL_THEME_CFWL_COMBOBOXTP_H_
diff --git a/xfa/fwl/theme/datetimepickertp.cpp b/xfa/fwl/theme/cfwl_datetimepickedtp.cpp
index 63fbc13110..4e1d39a15a 100644
--- a/xfa/fwl/theme/datetimepickertp.cpp
+++ b/xfa/fwl/theme/cfwl_datetimepickedtp.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/theme/datetimepickertp.h"
+#include "xfa/fwl/theme/cfwl_datetimepickertp.h"
#include "xfa/fwl/basewidget/ifwl_datetimepicker.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
@@ -112,7 +112,9 @@ void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams,
#endif
void CFWL_DateTimePickerTP::initThemeData() {
uint32_t* pData = (uint32_t*)&m_pThemeData->BoxBkColor;
- *pData++ = 0, *pData++ = 0, *pData++ = ArgbEncode(255, 220, 220, 215),
+ *pData++ = 0;
+ *pData++ = 0;
+ *pData++ = ArgbEncode(255, 220, 220, 215),
*pData++ = ArgbEncode(255, 255, 255, 255),
*pData++ = ArgbEncode(255, 255, 240, 207),
*pData++ = ArgbEncode(255, 248, 179, 48),
diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.h b/xfa/fwl/theme/cfwl_datetimepickertp.h
new file mode 100644
index 0000000000..199551ea1f
--- /dev/null
+++ b/xfa/fwl/theme/cfwl_datetimepickertp.h
@@ -0,0 +1,27 @@
+// 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_THEME_CFWL_DATETIMEPICKERTP_H_
+#define XFA_FWL_THEME_CFWL_DATETIMEPICKERTP_H_
+
+#include "xfa/fwl/theme/cfwl_widgettp.h"
+
+class CFWL_DateTimePickerTP : public CFWL_WidgetTP {
+ public:
+ CFWL_DateTimePickerTP();
+ virtual ~CFWL_DateTimePickerTP();
+ virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
+ virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams);
+
+ protected:
+ void DrawDropDownButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
+ void initThemeData();
+ struct DTPThemeData {
+ FX_ARGB BoxBkColor[13][2];
+ } * m_pThemeData;
+};
+
+#endif // XFA_FWL_THEME_CFWL_DATETIMEPICKERTP_H_
diff --git a/xfa/fwl/theme/edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp
index a99b2146d1..92f32dcaa9 100644
--- a/xfa/fwl/theme/edittp.cpp
+++ b/xfa/fwl/theme/cfwl_edittp.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/theme/edittp.h"
+#include "xfa/fwl/theme/cfwl_edittp.h"
#include "xfa/fwl/basewidget/ifwl_edit.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
diff --git a/xfa/fwl/theme/cfwl_edittp.h b/xfa/fwl/theme/cfwl_edittp.h
new file mode 100644
index 0000000000..73c99dafb7
--- /dev/null
+++ b/xfa/fwl/theme/cfwl_edittp.h
@@ -0,0 +1,22 @@
+// 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_THEME_CFWL_EDITTP_H_
+#define XFA_FWL_THEME_CFWL_EDITTP_H_
+
+#include "xfa/fwl/theme/cfwl_widgettp.h"
+
+class CFWL_EditTP : public CFWL_WidgetTP {
+ public:
+ CFWL_EditTP();
+ virtual ~CFWL_EditTP();
+ virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
+ virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams);
+ virtual FWL_ERR Initialize();
+ virtual FWL_ERR Finalize();
+};
+
+#endif // XFA_FWL_THEME_CFWL_EDITTP_H_
diff --git a/xfa/fwl/theme/formtp.cpp b/xfa/fwl/theme/cfwl_formtp.cpp
index 28a8805dee..e7cc1221d0 100644
--- a/xfa/fwl/theme/formtp.cpp
+++ b/xfa/fwl/theme/cfwl_formtp.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/theme/formtp.h"
+#include "xfa/fwl/theme/cfwl_formtp.h"
#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
diff --git a/xfa/fwl/theme/cfwl_formtp.h b/xfa/fwl/theme/cfwl_formtp.h
new file mode 100644
index 0000000000..838f19858a
--- /dev/null
+++ b/xfa/fwl/theme/cfwl_formtp.h
@@ -0,0 +1,111 @@
+// 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_THEME_CFWL_FORMTP_H_
+#define XFA_FWL_THEME_CFWL_FORMTP_H_
+
+#include "xfa/fwl/theme/cfwl_utils.h"
+#include "xfa/fwl/theme/cfwl_widgettp.h"
+
+class CFWL_FormTP : public CFWL_WidgetTP {
+ public:
+ CFWL_FormTP();
+ virtual ~CFWL_FormTP();
+
+ virtual FWL_ERR Initialize();
+ virtual FWL_ERR Finalize();
+ virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
+ virtual uint32_t SetThemeID(IFWL_Widget* pWidget,
+ uint32_t dwThemeID,
+ FX_BOOL bChildren = TRUE);
+ virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams);
+ virtual FX_BOOL DrawText(CFWL_ThemeText* pParams);
+ virtual void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity);
+ virtual FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart);
+
+ protected:
+ void CalCloseBox(IFWL_Widget* pWidget, CFX_RectF& rect);
+ void CalMaxBox(IFWL_Widget* pWidget, CFX_RectF& rect);
+ void CalMinBox(IFWL_Widget* pWidget, CFX_RectF& rect);
+ void CalCaption(IFWL_Widget* pWidget, CFX_RectF& rect);
+ void CalIcon(IFWL_Widget* pWidget, CFX_RectF& rect);
+
+ void DrawFormBorder(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ FWLTHEME_STATE eState,
+ CFX_Matrix* pMatrix,
+ int32_t iActive = 0);
+ void DrawCaption(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ FWLTHEME_STATE eState,
+ CFX_Matrix* pMatrix,
+ int32_t iActive = 0);
+ void DrawNarrowCaption(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ FWLTHEME_STATE eState,
+ CFX_Matrix* pMatrix,
+ int32_t iActive = 0);
+ void DrawCloseBox(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ FWLTHEME_STATE eState,
+ CFX_Matrix* pMatrix,
+ int32_t iActive = 0);
+ void DrawMinMaxBoxCommon(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ FWLTHEME_STATE eState,
+ CFX_Matrix* pMatrix,
+ int32_t iActive = 0);
+ void DrawMinimizeBox(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ FWLTHEME_STATE eState,
+ CFX_Matrix* pMatrix,
+ int32_t iActive = 0);
+ void DrawMaximizeBox(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ FWLTHEME_STATE eState,
+ FX_BOOL bMax,
+ CFX_Matrix* pMatrix,
+ int32_t iActive = 0);
+ void DrawIconImage(CFX_Graphics* pGraphics,
+ CFX_DIBitmap* pDIBitmap,
+ const CFX_RectF* pRect,
+ FWLTHEME_STATE eState,
+ CFX_Matrix* pMatrix,
+ int32_t iActive = 0);
+ void SetThemeData(uint32_t dwID);
+ void TransModeColor(FX_ARGB clrFore, FX_ARGB& clrBack);
+ void DeactiveForm();
+ void InitCaption(FX_BOOL bActive);
+ CFX_DIBitmap* m_pActiveBitmap;
+ CFX_DIBitmap* m_pDeactivebitmap;
+ CFX_RectF m_rtDisCaption;
+ CFX_RectF m_rtDisLBorder;
+ CFX_RectF m_rtDisRBorder;
+ CFX_RectF m_rtDisBBorder;
+ struct SBThemeData {
+ FX_ARGB clrHeadBK[2][4];
+ FX_ARGB clrHeadEdgeLeft[2][3];
+ FX_ARGB clrHeadEdgeRight[2][3];
+ FX_ARGB clrHeadEdgeTop[2][3];
+ FX_ARGB clrHeadEdgeBottom[2][3];
+ FX_ARGB clrCloseBtBKStart[2][3];
+ FX_ARGB clrCloseBtBKEnd[2][3];
+ FX_ARGB clrCloseBtEdgeLight[2][3];
+ FX_ARGB clrCloseBtEdgeDark[2][3];
+ FX_ARGB clrNormalBtBKStart[2][3];
+ FX_ARGB clrNormalBtBKEnd[2][3];
+ FX_ARGB clrNormalBtEdgeLight[2][3];
+ FX_ARGB clrNormalBtEdgeDark[2][3];
+ FX_ARGB clrBtnEdgeOut[2];
+ FX_ARGB clrBtnCornerLight[2][3];
+ FX_ARGB clrHeadText[2];
+ FX_ARGB clrFormBorder[2][5];
+ FX_ARGB clrFormBorderLight[2];
+ FX_ARGB clrTransWhite;
+ } * m_pThemeData;
+};
+
+#endif // XFA_FWL_THEME_CFWL_FORMTP_H_
diff --git a/xfa/fwl/theme/listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp
index 5c38166afa..210949aa41 100644
--- a/xfa/fwl/theme/listboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_listboxtp.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/theme/listboxtp.h"
+#include "xfa/fwl/theme/cfwl_listboxtp.h"
#include "xfa/fwl/basewidget/ifwl_listbox.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
diff --git a/xfa/fwl/theme/cfwl_listboxtp.h b/xfa/fwl/theme/cfwl_listboxtp.h
new file mode 100644
index 0000000000..d4bd7eff94
--- /dev/null
+++ b/xfa/fwl/theme/cfwl_listboxtp.h
@@ -0,0 +1,29 @@
+// 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_THEME_CFWL_LISTBOXTP_H_
+#define XFA_FWL_THEME_CFWL_LISTBOXTP_H_
+
+#include "xfa/fwl/theme/cfwl_widgettp.h"
+
+class CFWL_ListBoxTP : public CFWL_WidgetTP {
+ public:
+ CFWL_ListBoxTP();
+ virtual ~CFWL_ListBoxTP();
+ virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
+ virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams);
+ virtual FWL_ERR Initialize();
+ virtual FWL_ERR Finalize();
+
+ protected:
+ void DrawListBoxItem(CFX_Graphics* pGraphics,
+ uint32_t dwStates,
+ const CFX_RectF* prtItem,
+ void* pData = NULL,
+ CFX_Matrix* pMatrix = NULL);
+};
+
+#endif // XFA_FWL_THEME_CFWL_LISTBOXTP_H_
diff --git a/xfa/fwl/theme/monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
index 2ae154860a..2d53080b37 100644
--- a/xfa/fwl/theme/monthcalendartp.cpp
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/theme/monthcalendartp.h"
+#include "xfa/fwl/theme/cfwl_monthcalendartp.h"
#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fwl/basewidget/ifwl_monthcalendar.h"
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.h b/xfa/fwl/theme/cfwl_monthcalendartp.h
new file mode 100644
index 0000000000..3624ee1bfd
--- /dev/null
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.h
@@ -0,0 +1,51 @@
+// 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_THEME_CFWL_MONTHCALENDARTP_H_
+#define XFA_FWL_THEME_CFWL_MONTHCALENDARTP_H_
+
+#include "xfa/fwl/theme/cfwl_widgettp.h"
+
+class CFWL_MonthCalendarTP : public CFWL_WidgetTP {
+ public:
+ CFWL_MonthCalendarTP();
+ virtual ~CFWL_MonthCalendarTP();
+ virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
+ virtual uint32_t SetThemeID(IFWL_Widget* pWidget,
+ uint32_t dwThemeID,
+ FX_BOOL bChildren = TRUE);
+ virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams);
+ virtual FX_BOOL DrawText(CFWL_ThemeText* pParams);
+ virtual void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity);
+ virtual FWL_ERR Initialize();
+ virtual FWL_ERR Finalize();
+
+ protected:
+ FX_BOOL DrawTotalBK(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
+ FX_BOOL DrawHeadBk(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
+ FX_BOOL DrawLButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
+ FX_BOOL DrawRButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
+ FX_BOOL DrawDatesInBK(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
+ FX_BOOL DrawDatesInCircle(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
+ FX_BOOL DrawTodayCircle(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
+ FX_BOOL DrawHSeperator(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
+ FX_BOOL DrawWeekNumSep(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
+ FWLTHEME_STATE GetState(uint32_t dwFWLStates);
+ void SetThemeData(uint32_t dwThemeID);
+ class MCThemeData {
+ public:
+ FX_ARGB clrCaption;
+ FX_ARGB clrSeperator;
+ FX_ARGB clrDatesHoverBK;
+ FX_ARGB clrDatesSelectedBK;
+ FX_ARGB clrDatesCircle;
+ FX_ARGB clrToday;
+ FX_ARGB clrBK;
+ } * m_pThemeData;
+ CFX_WideString wsResource;
+};
+
+#endif // XFA_FWL_THEME_CFWL_MONTHCALENDARTP_H_
diff --git a/xfa/fwl/theme/pictureboxtp.cpp b/xfa/fwl/theme/cfwl_pictureboxtp.cpp
index ab5cd02246..ee83a7eb3f 100644
--- a/xfa/fwl/theme/pictureboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_pictureboxtp.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/theme/pictureboxtp.h"
+#include "xfa/fwl/theme/cfwl_pictureboxtp.h"
#include "xfa/fwl/basewidget/ifwl_picturebox.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.h b/xfa/fwl/theme/cfwl_pictureboxtp.h
new file mode 100644
index 0000000000..0216971a94
--- /dev/null
+++ b/xfa/fwl/theme/cfwl_pictureboxtp.h
@@ -0,0 +1,20 @@
+// 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_THEME_CFWL_PICTUREBOXTP_H_
+#define XFA_FWL_THEME_CFWL_PICTUREBOXTP_H_
+
+#include "xfa/fwl/theme/cfwl_widgettp.h"
+
+class CFWL_PictureBoxTP : public CFWL_WidgetTP {
+ public:
+ CFWL_PictureBoxTP();
+ virtual ~CFWL_PictureBoxTP();
+ virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
+ virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams);
+};
+
+#endif // XFA_FWL_THEME_CFWL_PICTUREBOXTP_H_
diff --git a/xfa/fwl/theme/pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index 00ff3e9737..5889f30927 100644
--- a/xfa/fwl/theme/pushbuttontp.cpp
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/theme/pushbuttontp.h"
+#include "xfa/fwl/theme/cfwl_pushbuttontp.h"
#include "xfa/fwl/basewidget/ifwl_pushbutton.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.h b/xfa/fwl/theme/cfwl_pushbuttontp.h
new file mode 100644
index 0000000000..b72ac86126
--- /dev/null
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.h
@@ -0,0 +1,46 @@
+// 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_THEME_CFWL_PUSHBUTTONTP_H_
+#define XFA_FWL_THEME_CFWL_PUSHBUTTONTP_H_
+
+#include "xfa/fwl/theme/cfwl_widgettp.h"
+
+class CFWL_PushButtonTP : public CFWL_WidgetTP {
+ public:
+ CFWL_PushButtonTP();
+ virtual ~CFWL_PushButtonTP();
+ virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
+ virtual uint32_t SetThemeID(IFWL_Widget* pWidget,
+ uint32_t dwThemeID,
+ FX_BOOL bChildren = TRUE);
+ virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams);
+ virtual void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity);
+ virtual FWL_ERR Initialize();
+ virtual FWL_ERR Finalize();
+
+ protected:
+ struct PBThemeData {
+ FX_ARGB clrBorder[5];
+ FX_ARGB clrStart[5];
+ FX_ARGB clrEnd[5];
+ FX_ARGB clrFill[5];
+ };
+
+ void SetThemeData(uint32_t dwID);
+ void SetTopLineColor(uint32_t* pData);
+ void SetLeftLineColor(uint32_t* pData);
+ void SetRightLineColor(uint32_t* pData);
+ void SetBottomLineColor(uint32_t* pData);
+ void SetBackgroudColor(uint32_t* pData);
+ void SetCaptionColor(uint32_t* pData);
+ void SetCornerColor(uint32_t* pData);
+ int32_t GetColorID(uint32_t dwStates);
+
+ struct PBThemeData* m_pThemeData;
+};
+
+#endif // XFA_FWL_THEME_CFWL_PUSHBUTTONTP_H_
diff --git a/xfa/fwl/theme/scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp
index 2df08d68be..c6a14f8e94 100644
--- a/xfa/fwl/theme/scrollbartp.cpp
+++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/theme/scrollbartp.h"
+#include "xfa/fwl/theme/cfwl_scrollbartp.h"
#include "xfa/fwl/basewidget/ifwl_scrollbar.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.h b/xfa/fwl/theme/cfwl_scrollbartp.h
new file mode 100644
index 0000000000..0530393043
--- /dev/null
+++ b/xfa/fwl/theme/cfwl_scrollbartp.h
@@ -0,0 +1,60 @@
+// 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_THEME_CFWL_SCROLLBARTP_H_
+#define XFA_FWL_THEME_CFWL_SCROLLBARTP_H_
+
+#include "xfa/fwl/theme/cfwl_widgettp.h"
+
+class CFWL_ScrollBarTP : public CFWL_WidgetTP {
+ public:
+ CFWL_ScrollBarTP();
+ virtual ~CFWL_ScrollBarTP();
+ virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
+ virtual uint32_t SetThemeID(IFWL_Widget* pWidget,
+ uint32_t dwThemeID,
+ FX_BOOL bChildren = TRUE);
+ virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams);
+ virtual void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity);
+
+ protected:
+ struct SBThemeData {
+ FX_ARGB clrPawColorLight[4];
+ FX_ARGB clrPawColorDark[4];
+ FX_ARGB clrBtnBK[4][2];
+ FX_ARGB clrBtnBorder[4];
+ FX_ARGB clrTrackBKStart;
+ FX_ARGB clrTrackBKEnd;
+ };
+
+ void DrawThumbBtn(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ FX_BOOL bVert,
+ FWLTHEME_STATE eState,
+ FX_BOOL bPawButton = TRUE,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawTrack(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ FX_BOOL bVert,
+ FWLTHEME_STATE eState,
+ FX_BOOL bLowerTrack,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawMaxMinBtn(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ FWLTHEME_DIRECTION eDict,
+ FWLTHEME_STATE eState,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawPaw(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ FX_BOOL bVert,
+ FWLTHEME_STATE eState,
+ CFX_Matrix* pMatrix = NULL);
+ void SetThemeData(uint32_t dwID);
+
+ struct SBThemeData* m_pThemeData;
+};
+
+#endif // XFA_FWL_THEME_CFWL_SCROLLBARTP_H_
diff --git a/xfa/fwl/theme/cfwl_utils.h b/xfa/fwl/theme/cfwl_utils.h
new file mode 100644
index 0000000000..d530b7631b
--- /dev/null
+++ b/xfa/fwl/theme/cfwl_utils.h
@@ -0,0 +1,75 @@
+// 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_THEME_CFWL_UTILS_H_
+#define XFA_FWL_THEME_CFWL_UTILS_H_
+
+#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))
+#define FWLTHEME_COLOR_EDGERB2 (ArgbEncode(255, 255, 255, 255))
+#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
+#define FWLTHEME_CAPACITY_LineHeight 12.0f
+#define FWLTHEME_CAPACITY_TextColor (ArgbEncode(255, 0, 0, 0))
+#define FWLTHEME_CAPACITY_TextSelColor (ArgbEncode(255, 153, 193, 218))
+#define FWLTHEME_CAPACITY_TextDisColor (ArgbEncode(255, 172, 168, 153))
+#define FWLTHEME_CAPACITY_ScrollBarWidth 17.0f
+#define FWLTHEME_CAPACITY_CXBorder 1.0f
+#define FWLTHEME_CAPACITY_CYBorder 1.0f
+
+#endif // XFA_FWL_THEME_CFWL_UTILS_H_
diff --git a/xfa/fwl/theme/widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index c87c70c1c2..7aaaf40454 100644
--- a/xfa/fwl/theme/widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/theme/widgettp.h"
+#include "xfa/fwl/theme/cfwl_widgettp.h"
#include <algorithm>
diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h
new file mode 100644
index 0000000000..03d575a1d9
--- /dev/null
+++ b/xfa/fwl/theme/cfwl_widgettp.h
@@ -0,0 +1,220 @@
+// 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_THEME_CFWL_WIDGETTP_H_
+#define XFA_FWL_THEME_CFWL_WIDGETTP_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/include/fx_coordinates.h"
+#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fwl/core/fwl_error.h"
+#include "xfa/fxgraphics/include/cfx_graphics.h"
+#include "xfa/fwl/theme/cfwl_utils.h"
+
+class IFWL_Widget;
+class IFDE_TextOut;
+class IFX_Font;
+class IFX_FontMgr;
+class CFWL_ArrowData;
+class CFWL_ThemeBackground;
+class CFWL_ThemePart;
+class CFWL_ThemeText;
+
+#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+class IFX_FontSourceEnum;
+#endif
+
+class CFWL_WidgetTP {
+ public:
+ virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
+ virtual uint32_t GetThemeID(IFWL_Widget* pWidget);
+ virtual uint32_t SetThemeID(IFWL_Widget* pWidget,
+ uint32_t dwThemeID,
+ FX_BOOL bChildren = TRUE);
+ virtual FWL_ERR GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix);
+ virtual FWL_ERR SetThemeMatrix(IFWL_Widget* pWidget,
+ const CFX_Matrix& matrix);
+ virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams);
+ virtual FX_BOOL DrawText(CFWL_ThemeText* pParams);
+ virtual void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity);
+ virtual FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget);
+ virtual FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart);
+ virtual FX_BOOL IsInPart(CFWL_ThemePart* pThemePart,
+ FX_FLOAT fx,
+ FX_FLOAT fy);
+ virtual FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect);
+ virtual FWL_ERR Initialize();
+ virtual FWL_ERR Finalize();
+ virtual ~CFWL_WidgetTP();
+ FWL_ERR SetFont(IFWL_Widget* pWidget,
+ const FX_WCHAR* strFont,
+ FX_FLOAT fFontSize,
+ FX_ARGB rgbFont);
+ FWL_ERR SetFont(IFWL_Widget* pWidget,
+ IFX_Font* pFont,
+ FX_FLOAT fFontSize,
+ FX_ARGB rgbFont);
+ IFX_Font* GetFont(IFWL_Widget* pWidget);
+
+ protected:
+ CFWL_WidgetTP();
+ FX_ERR InitTTO();
+ FX_ERR FinalizeTTO();
+ void DrawEdge(CFX_Graphics* pGraphics,
+ uint32_t dwStyles,
+ const CFX_RectF* pRect,
+ CFX_Matrix* pMatrix = NULL);
+ void Draw3DRect(CFX_Graphics* pGraphics,
+ FWLTHEME_EDGE eType,
+ FX_FLOAT fWidth,
+ const CFX_RectF* pRect,
+ FX_ARGB cr1,
+ FX_ARGB cr2,
+ FX_ARGB cr3,
+ FX_ARGB cr4,
+ CFX_Matrix* pMatrix = NULL);
+ void Draw3DCircle(CFX_Graphics* pGraphics,
+ FWLTHEME_EDGE eType,
+ FX_FLOAT fWidth,
+ const CFX_RectF* pRect,
+ FX_ARGB cr1,
+ FX_ARGB cr2,
+ FX_ARGB cr3,
+ FX_ARGB cr4,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawBorder(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ CFX_Matrix* pMatrix = NULL);
+ void FillBackground(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ CFX_Matrix* pMatrix = NULL);
+ void FillSoildRect(CFX_Graphics* pGraphics,
+ FX_ARGB fillColor,
+ const CFX_RectF* pRect,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawAxialShading(CFX_Graphics* pGraphics,
+ FX_FLOAT fx1,
+ FX_FLOAT fy1,
+ FX_FLOAT fx2,
+ FX_FLOAT fy2,
+ FX_ARGB beginColor,
+ FX_ARGB endColor,
+ CFX_Path* path,
+ int32_t fillMode = FXFILL_WINDING,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawAnnulusRect(CFX_Graphics* pGraphics,
+ FX_ARGB fillColor,
+ const CFX_RectF* pRect,
+ FX_FLOAT fRingWidth = 1,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawAnnulusCircle(CFX_Graphics* pGraphics,
+ FX_ARGB fillColor,
+ const CFX_RectF* pRect,
+ FX_FLOAT fWidth = 1,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawFocus(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawArrow(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ FWLTHEME_DIRECTION eDict,
+ FX_ARGB argbFill,
+ FX_BOOL bPressed,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawArrow(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ FWLTHEME_DIRECTION eDict,
+ FX_ARGB argSign,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawBtn(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ FWLTHEME_STATE eState,
+ CFX_Matrix* pMatrix = NULL);
+ void DrawArrowBtn(CFX_Graphics* pGraphics,
+ const CFX_RectF* pRect,
+ 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;
+ FX_FLOAT m_fValue;
+ uint32_t m_dwValue;
+ CFX_RectF m_rtMargin;
+ uint32_t m_dwThemeID;
+ CFX_Matrix _ctm;
+};
+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:
+ static CFWL_ArrowData* GetInstance();
+ static FX_BOOL IsInstance();
+ static void DestroyInstance();
+ virtual ~CFWL_ArrowData();
+ void SetColorData(uint32_t dwID);
+
+ class CColorData {
+ public:
+ FX_ARGB clrBorder[4];
+ FX_ARGB clrStart[4];
+ FX_ARGB clrEnd[4];
+ FX_ARGB clrSign[4];
+ } * m_pColorData;
+
+ protected:
+ CFWL_ArrowData();
+ static CFWL_ArrowData* m_pInstance;
+};
+
+class CFWL_FontData {
+ public:
+ CFWL_FontData();
+ virtual ~CFWL_FontData();
+ FX_BOOL Equal(const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage);
+ FX_BOOL LoadFont(const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage);
+ IFX_Font* GetFont() const { return m_pFont; }
+
+ protected:
+ CFX_WideString m_wsFamily;
+ uint32_t m_dwStyles;
+ uint32_t m_dwCodePage;
+ IFX_Font* m_pFont;
+ IFX_FontMgr* m_pFontMgr;
+#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+ IFX_FontSourceEnum* m_pFontSource;
+#endif
+};
+
+class CFWL_FontManager {
+ public:
+ static CFWL_FontManager* GetInstance();
+ static void DestroyInstance();
+
+ IFX_Font* FindFont(const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t dwCodePage);
+
+ protected:
+ CFWL_FontManager();
+ virtual ~CFWL_FontManager();
+
+ static CFWL_FontManager* s_FontManager;
+ std::vector<std::unique_ptr<CFWL_FontData>> m_FontsArray;
+};
+
+#endif // XFA_FWL_THEME_CFWL_WIDGETTP_H_