Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cfwl_edittp.cpp
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include "xfa/fwl/theme/cfwl_edittp.h"
8
9#include "xfa/fgas/graphics/cfgas_gecolor.h"
10#include "xfa/fgas/graphics/cfgas_gegraphics.h"
11#include "xfa/fgas/graphics/cfgas_gepath.h"
12#include "xfa/fwl/cfwl_edit.h"
13#include "xfa/fwl/cfwl_themebackground.h"
14#include "xfa/fwl/cfwl_widget.h"
15
16namespace pdfium {
17
18CFWL_EditTP::CFWL_EditTP() = default;
19
20CFWL_EditTP::~CFWL_EditTP() = default;
21
22void CFWL_EditTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
23 switch (pParams.GetPart()) {
25 DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
26 break;
27 }
29 CFGAS_GEGraphics* pGraphics = pParams.GetGraphics();
30 CFGAS_GEGraphics::StateRestorer restorer(pGraphics);
31 const CFGAS_GEPath* pParamsPath = pParams.GetPath();
32 if (pParamsPath) {
34 pGraphics->FillPath(*pParamsPath,
36 pParams.m_matrix);
37 } else {
38 CFGAS_GEPath path;
42 if (!pParams.m_bStaticBackground) {
43 if (pParams.m_dwStates & CFWL_PartState::kDisabled)
45 else if (pParams.m_dwStates & CFWL_PartState::kReadOnly)
46 cr = CFGAS_GEColor(ArgbEncode(255, 236, 233, 216));
47 else
48 cr = CFGAS_GEColor(0xFFFFFFFF);
49 }
50 pGraphics->SetFillColor(cr);
52 pParams.m_matrix);
53 }
54 break;
55 }
57 CFWL_Widget::AdapterIface* pWidget =
58 pParams.GetWidget()->GetOutmost()->GetAdapterIface();
59 FX_ARGB cr = 0xFF000000;
60 float fWidth = 1.0f;
61 pWidget->GetBorderColorAndThickness(&cr, &fWidth);
64 const CFGAS_GEPath* pParamsPath = pParams.GetPath();
65 if (pParamsPath)
66 pParams.GetGraphics()->StrokePath(*pParamsPath, pParams.m_matrix);
67 break;
68 }
69 default:
70 break;
71 }
72}
73
74} // namespace pdfium
#define FWLTHEME_COLOR_BKSelected
Definition cfwl_utils.h:23
#define FWLTHEME_COLOR_EDGERB1
Definition cfwl_utils.h:21
#define FWLTHEME_COLOR_Background
Definition cfwl_utils.h:22
CFGAS_GEColor & operator=(const CFGAS_GEColor &that)
CFGAS_GEColor(FX_ARGB argb)
StateRestorer(CFGAS_GEGraphics *graphics)
void FillPath(const CFGAS_GEPath &path, CFX_FillRenderOptions::FillType fill_type, const CFX_Matrix &matrix)
void SetLineWidth(float lineWidth)
void SetStrokeColor(const CFGAS_GEColor &color)
void SetFillColor(const CFGAS_GEColor &color)
void StrokePath(const CFGAS_GEPath &path, const CFX_Matrix &matrix)
void AddRectangle(float left, float top, float width, float height)
void DrawBackground(const CFWL_ThemeBackground &pParams) override
~CFWL_EditTP() override
CFGAS_GEGraphics * GetGraphics() const
const CFGAS_GEPath * GetPath() const
CFWL_Widget * GetWidget() const
void DrawBorder(CFGAS_GEGraphics *pGraphics, const CFX_RectF &rect, const CFX_Matrix &matrix)
virtual void GetBorderColorAndThickness(FX_ARGB *cr, float *fWidth)=0
uint32_t FX_ARGB
Definition fx_dib.h:36
constexpr FX_ARGB ArgbEncode(uint32_t a, uint32_t r, uint32_t g, uint32_t b)
Definition fx_dib.h:188