7#include "xfa/fwl/cfwl_checkbox.h"
12#include "xfa/fde/cfde_textout.h"
13#include "xfa/fwl/cfwl_app.h"
14#include "xfa/fwl/cfwl_event.h"
15#include "xfa/fwl/cfwl_messagekey.h"
16#include "xfa/fwl/cfwl_messagemouse.h"
17#include "xfa/fwl/cfwl_notedriver.h"
18#include "xfa/fwl/cfwl_themebackground.h"
19#include "xfa/fwl/cfwl_themetext.h"
20#include "xfa/fwl/cfwl_widgetmgr.h"
21#include "xfa/fwl/fwl_widgetdef.h"
22#include "xfa/fwl/ifwl_themeprovider.h"
26const int kCaptionMargin = 5;
30CFWL_CheckBox::CFWL_CheckBox(CFWL_App* app)
42 m_fBoxHeight = fHeight;
49 UpdateTextOutStyles();
65 param.m_dwStates = dwStates;
69 param.m_pRtData = &m_FocusRect;
74 checkParam.m_dwStates = dwStates;
78 checkParam.m_pRtData = &m_FocusRect;
82 textParam.m_dwStates = dwStates;
85 textParam.m_wsText = L"Check box";
91void CFWL_CheckBox::SetCheckState(int32_t iCheck) {
107void CFWL_CheckBox::Layout() {
112 float fTextLeft = m_ClientRect
.left + m_fBoxHeight;
113 m_BoxRect
= CFX_RectF(m_ClientRect.TopLeft(), m_fBoxHeight, m_fBoxHeight);
117 m_CaptionRect
.Inflate(-kCaptionMargin
, -kCaptionMargin
);
120 CalcTextRect(L"Check box", m_TTOStyles, m_iTTOAlign, &rtFocus);
121 m_FocusRect
= CFX_RectF(m_CaptionRect.TopLeft(),
149void CFWL_CheckBox::UpdateTextOutStyles() {
155void CFWL_CheckBox::NextStates() {
196 CFWL_MessageMouse* pMsg =
static_cast<CFWL_MessageMouse*>(pMessage);
216 CFWL_MessageKey* pKey =
static_cast<CFWL_MessageKey*>(pMessage);
234void CFWL_CheckBox::OnFocusGained() {
239void CFWL_CheckBox::OnFocusLost() {
244void CFWL_CheckBox::OnLButtonDown() {
254void CFWL_CheckBox::OnLButtonUp(CFWL_MessageMouse* pMsg) {
259 if (!m_ClientRect.Contains(pMsg->m_pos))
267void CFWL_CheckBox::OnMouseMove(CFWL_MessageMouse* pMsg) {
271 bool bRepaint =
false;
273 if (m_ClientRect.Contains(pMsg->m_pos)) {
293 if (m_ClientRect.Contains(pMsg->m_pos)) {
304void CFWL_CheckBox::OnMouseLeave() {
313void CFWL_CheckBox::OnKeyDown(CFWL_MessageKey* pMsg) {
#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
void OnDrawWidget(CFGAS_GEGraphics *pGraphics, const CFX_Matrix &matrix) override
~CFWL_CheckBox() override
void SetBoxSize(float fHeight)
void DrawWidget(CFGAS_GEGraphics *pGraphics, const CFX_Matrix &matrix) override
void OnProcessMessage(CFWL_Message *pMessage) override
FWL_Type GetClassID() const override
const uint32_t m_dwKeyCodeOrChar
const MouseCommand m_dwCmd
CFWL_Widget * GetDstTarget() const
FDE_TextStyle m_dwTTOStyles
FDE_TextAlignment m_iTTOAlign
CFX_Matrix & operator=(const CFX_Matrix &other)=default
void Inflate(float x, float y)
CFX_RectF & operator=(const CFX_RectF &other)=default
constexpr CFX_RectF(float dst_left, float dst_top, float dst_width, float dst_height)
virtual void DrawBackground(const CFWL_ThemeBackground &pParams)=0
virtual void DrawText(const CFWL_ThemeText &pParams)=0
int FXSYS_roundf(float f)