1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "xfa/fwl/core/cfwl_widget.h"
#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fwl/core/cfwl_themetext.h"
#include "xfa/fwl/core/cfwl_widgetmgr.h"
#include "xfa/fwl/core/fwl_noteimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#define FWL_WGT_CalcHeight 2048
#define FWL_WGT_CalcWidth 2048
#define FWL_WGT_CalcMultiLineDefWidth 120.0f
CFWL_Widget::CFWL_Widget(const IFWL_App* app) : m_pApp(app) {}
CFWL_Widget::~CFWL_Widget() {}
void CFWL_Widget::Initialize() {
ASSERT(m_pIface);
m_pIface->SetAssociateWidget(this);
}
IFWL_Widget* CFWL_Widget::GetWidget() {
return m_pIface.get();
}
const IFWL_Widget* CFWL_Widget::GetWidget() const {
return m_pIface.get();
}
void CFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
if (m_pIface)
m_pIface->GetWidgetRect(rect, bAutoSize);
}
void CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
if (m_pIface)
m_pIface->SetWidgetRect(rect);
}
void CFWL_Widget::ModifyStyles(uint32_t dwStylesAdded,
uint32_t dwStylesRemoved) {
if (m_pIface)
m_pIface->ModifyStyles(dwStylesAdded, dwStylesRemoved);
}
uint32_t CFWL_Widget::GetStylesEx() {
if (!m_pIface)
return 0;
return m_pIface->GetStylesEx();
}
void CFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded,
uint32_t dwStylesExRemoved) {
m_pIface->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
uint32_t CFWL_Widget::GetStates() {
return m_pIface ? m_pIface->GetStates() : 0;
}
void CFWL_Widget::SetStates(uint32_t dwStates, bool bSet) {
if (m_pIface)
m_pIface->SetStates(dwStates, bSet);
}
void CFWL_Widget::SetLayoutItem(void* pItem) {
if (m_pIface)
m_pIface->SetLayoutItem(pItem);
}
void CFWL_Widget::Update() {
if (!m_pIface)
return;
m_pIface->Update();
}
void CFWL_Widget::LockUpdate() {
if (!m_pIface)
return;
m_pIface->LockUpdate();
}
void CFWL_Widget::UnlockUpdate() {
if (!m_pIface)
return;
m_pIface->UnlockUpdate();
}
FWL_WidgetHit CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (!m_pIface)
return FWL_WidgetHit::Unknown;
return m_pIface->HitTest(fx, fy);
}
void CFWL_Widget::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
if (m_pIface)
m_pIface->DrawWidget(pGraphics, pMatrix);
}
IFWL_WidgetDelegate* CFWL_Widget::GetDelegate() const {
return m_pIface ? m_pIface->GetDelegate() : nullptr;
}
void CFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) {
if (m_pIface)
m_pIface->SetDelegate(pDelegate);
}
|