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
16CFWL_EditTP::CFWL_EditTP() = default;
17
18CFWL_EditTP::~CFWL_EditTP() = default;
19
20void CFWL_EditTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
21 switch (pParams.GetPart()) {
23 DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
24 break;
25 }
27 CFGAS_GEGraphics* pGraphics = pParams.GetGraphics();
28 CFGAS_GEGraphics::StateRestorer restorer(pGraphics);
29 const CFGAS_GEPath* pParamsPath = pParams.GetPath();
30 if (pParamsPath) {
32 pGraphics->FillPath(*pParamsPath,
34 pParams.m_matrix);
35 } else {
36 CFGAS_GEPath path;
40 if (!pParams.m_bStaticBackground) {
41 if (pParams.m_dwStates & CFWL_PartState::kDisabled)
43 else if (pParams.m_dwStates & CFWL_PartState::kReadOnly)
44 cr = CFGAS_GEColor(ArgbEncode(255, 236, 233, 216));
45 else
46 cr = CFGAS_GEColor(0xFFFFFFFF);
47 }
48 pGraphics->SetFillColor(cr);
50 pParams.m_matrix);
51 }
52 break;
53 }
55 CFWL_Widget::AdapterIface* pWidget =
56 pParams.GetWidget()->GetOutmost()->GetAdapterIface();
57 FX_ARGB cr = 0xFF000000;
58 float fWidth = 1.0f;
59 pWidget->GetBorderColorAndThickness(&cr, &fWidth);
62 const CFGAS_GEPath* pParamsPath = pParams.GetPath();
63 if (pParamsPath)
64 pParams.GetGraphics()->StrokePath(*pParamsPath, pParams.m_matrix);
65 break;
66 }
67 default:
68 break;
69 }
70}
CFWL_PartState
#define FWLTHEME_COLOR_BKSelected
Definition cfwl_utils.h:21
#define FWLTHEME_COLOR_EDGERB1
Definition cfwl_utils.h:19
#define FWLTHEME_COLOR_Background
Definition cfwl_utils.h:20
CFGAS_GEColor & operator=(const CFGAS_GEColor &that)
CFGAS_GEColor(const 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
CFX_RectF m_PartRect
CFX_Matrix m_matrix
Part GetPart() const
void DrawBorder(CFGAS_GEGraphics *pGraphics, const CFX_RectF &rect, const CFX_Matrix &matrix)
virtual void GetBorderColorAndThickness(FX_ARGB *cr, float *fWidth)=0
constexpr FX_ARGB ArgbEncode(uint32_t a, uint32_t r, uint32_t g, uint32_t b)
Definition fx_dib.h:118