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_checkbox.h
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#ifndef XFA_FWL_CFWL_CHECKBOX_H_
8#define XFA_FWL_CFWL_CHECKBOX_H_
9
10#include "xfa/fwl/cfwl_event.h"
11#include "xfa/fwl/cfwl_widget.h"
12
13namespace pdfium {
14
15#define FWL_STYLEEXT_CKB_3State (1L << 6)
16#define FWL_STYLEEXT_CKB_RadioButton (1L << 7)
17#define FWL_STYLEEXT_CKB_SignShapeCheck 0
18#define FWL_STYLEEXT_CKB_SignShapeCircle (1L << 10)
19#define FWL_STYLEEXT_CKB_SignShapeCross (2L << 10)
20#define FWL_STYLEEXT_CKB_SignShapeDiamond (3L << 10)
21#define FWL_STYLEEXT_CKB_SignShapeSquare (4L << 10)
22#define FWL_STYLEEXT_CKB_SignShapeStar (5L << 10)
23#define FWL_STYLEEXT_CKB_SignShapeMask (7L << 10)
24#define FWL_STATE_CKB_Hovered (1 << FWL_STATE_WGT_MAX)
25#define FWL_STATE_CKB_Pressed (1 << (FWL_STATE_WGT_MAX + 1))
26#define FWL_STATE_CKB_Unchecked 0
27#define FWL_STATE_CKB_Checked (1 << (FWL_STATE_WGT_MAX + 2))
28#define FWL_STATE_CKB_Neutral (2 << (FWL_STATE_WGT_MAX + 2))
29#define FWL_STATE_CKB_CheckMask (3L << (FWL_STATE_WGT_MAX + 2))
30
31class CFWL_MessageKey;
32class CFWL_MessageMouse;
33
34class CFWL_CheckBox final : public CFWL_Widget {
35 public:
37 ~CFWL_CheckBox() override;
38
39 // CFWL_Widget
40 FWL_Type GetClassID() const override;
41 void Update() override;
42 void DrawWidget(CFGAS_GEGraphics* pGraphics,
43 const CFX_Matrix& matrix) override;
44
45 void OnProcessMessage(CFWL_Message* pMessage) override;
46 void OnDrawWidget(CFGAS_GEGraphics* pGraphics,
47 const CFX_Matrix& matrix) override;
48
49 void SetBoxSize(float fHeight);
50
51 private:
52 explicit CFWL_CheckBox(CFWL_App* pApp);
53
54 void SetCheckState(int32_t iCheck);
55 void Layout();
56 Mask<CFWL_PartState> GetPartStates() const;
57 void UpdateTextOutStyles();
58 void NextStates();
59 void OnFocusGained();
60 void OnFocusLost();
61 void OnLButtonDown();
62 void OnLButtonUp(CFWL_MessageMouse* pMsg);
63 void OnMouseMove(CFWL_MessageMouse* pMsg);
64 void OnMouseLeave();
65 void OnKeyDown(CFWL_MessageKey* pMsg);
66
67 CFX_RectF m_ClientRect;
68 CFX_RectF m_BoxRect;
69 CFX_RectF m_CaptionRect;
70 CFX_RectF m_FocusRect;
71 FDE_TextStyle m_TTOStyles;
73 bool m_bBtnDown = false;
74 float m_fBoxHeight = 16.0f;
75};
76
77} // namespace pdfium
78
79// TODO(crbug.com/42271761): Remove.
80using pdfium::CFWL_CheckBox;
81
82#endif // XFA_FWL_CFWL_CHECKBOX_H_
#define FWL_STATE_CKB_CheckMask
#define FWL_STATE_CKB_Hovered
#define FWL_STATE_CKB_Unchecked
#define FWL_STATE_CKB_Pressed
#define FWL_STATE_CKB_Neutral
#define FWL_STATE_CKB_Checked
#define FWL_STYLEEXT_CKB_3State
#define FWL_STYLEEXT_CKB_RadioButton
#define FWL_STATE_WGT_MAX
Definition cfwl_widget.h:46
#define FWL_STATE_WGT_Focused
Definition cfwl_widget.h:44
#define FWL_STATE_WGT_Disabled
Definition cfwl_widget.h:43
CFX_Matrix & operator=(const CFX_Matrix &other)=default
void Inflate(float x, float y)
CFX_RectF & operator=(const CFX_RectF &other)=default
float right() const
constexpr CFX_RectF(float dst_left, float dst_top, float dst_width, float dst_height)
static WideString FromASCII(ByteStringView str)
void SetBoxSize(float fHeight)
FWL_Type GetClassID() const override
~CFWL_CheckBox() override
void Update() override
void OnProcessMessage(CFWL_Message *pMessage) override
void OnDrawWidget(CFGAS_GEGraphics *pGraphics, const CFX_Matrix &matrix) override
void DrawWidget(CFGAS_GEGraphics *pGraphics, const CFX_Matrix &matrix) override
const uint32_t m_dwKeyCodeOrChar
const KeyCommand m_dwCmd
Type GetType() const
CFWL_Widget * GetDstTarget() const
FDE_TextStyle m_dwTTOStyles
FDE_TextAlignment m_iTTOAlign
void OnProcessMessage(CFWL_Message *pMessage) override
void RepaintRect(const CFX_RectF &pRect)
bool HasBorder() const
void DispatchEvent(CFWL_Event *pEvent)
CFWL_Widget(CFWL_App *app, const Properties &properties, CFWL_Widget *pOuter)
void DrawBorder(CFGAS_GEGraphics *pGraphics, CFWL_ThemePart::Part iPartBorder, const CFX_Matrix &pMatrix)
virtual CFX_RectF GetClientRect()
IFWL_ThemeProvider * GetThemeProvider() const
bool IsLocked() const
void CalcTextRect(const WideString &wsText, const FDE_TextStyle &dwTTOStyles, FDE_TextAlignment iTTOAlign, CFX_RectF *pRect)
Properties m_Properties
virtual void DrawText(const CFWL_ThemeText &pParams)=0
virtual void DrawBackground(const CFWL_ThemeBackground &pParams)=0
int FXSYS_roundf(float f)
#define CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED
Definition heap.h:32
FDE_TextAlignment
Definition cfde_data.h:14
@ XFA_FWL_VKEY_Return
@ XFA_FWL_VKEY_Tab
@ XFA_FWL_VKEY_Space
fxcrt::WideString WideString
Definition widestring.h:207