summaryrefslogtreecommitdiff
path: root/xfa/fwl/basewidget
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fwl/basewidget')
-rw-r--r--xfa/fwl/basewidget/fwl_caretimp.cpp27
-rw-r--r--xfa/fwl/basewidget/fwl_caretimp.h4
-rw-r--r--xfa/fwl/basewidget/fwl_scrollbarimp.cpp28
-rw-r--r--xfa/fwl/basewidget/fwl_scrollbarimp.h4
-rw-r--r--xfa/fwl/basewidget/fwl_spinbuttonimp.cpp31
-rw-r--r--xfa/fwl/basewidget/fwl_spinbuttonimp.h5
-rw-r--r--xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp51
-rw-r--r--xfa/fwl/basewidget/fwl_tooltipctrlimp.h10
8 files changed, 79 insertions, 81 deletions
diff --git a/xfa/fwl/basewidget/fwl_caretimp.cpp b/xfa/fwl/basewidget/fwl_caretimp.cpp
index c67c0c4291..dbe8e50bc2 100644
--- a/xfa/fwl/basewidget/fwl_caretimp.cpp
+++ b/xfa/fwl/basewidget/fwl_caretimp.cpp
@@ -38,7 +38,7 @@ FWL_Error IFWL_Caret::SetColor(CFX_Color crFill) {
CFWL_CaretImp::CFWL_CaretImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_WidgetImp(properties, pOuter),
- m_hTimer(nullptr),
+ m_pTimerInfo(nullptr),
m_dwElapse(400),
m_bSetColor(FALSE) {
m_pTimer = new CFWL_CaretTimer(this);
@@ -67,9 +67,9 @@ FWL_Error CFWL_CaretImp::Initialize() {
}
FWL_Error CFWL_CaretImp::Finalize() {
- if (m_hTimer) {
- FWL_StopTimer(m_hTimer);
- m_hTimer = NULL;
+ if (m_pTimerInfo) {
+ m_pTimerInfo->StopTimer();
+ m_pTimerInfo = nullptr;
}
delete m_pDelegate;
m_pDelegate = nullptr;
@@ -89,12 +89,12 @@ FWL_Error CFWL_CaretImp::DrawWidget(CFX_Graphics* pGraphics,
}
void CFWL_CaretImp::ShowCaret(FX_BOOL bFlag) {
- if (m_hTimer) {
- FWL_StopTimer(m_hTimer);
- m_hTimer = nullptr;
+ if (m_pTimerInfo) {
+ m_pTimerInfo->StopTimer();
+ m_pTimerInfo = nullptr;
}
if (bFlag)
- m_hTimer = FWL_StartTimer(m_pTimer, m_dwElapse);
+ m_pTimerInfo = m_pTimer->StartTimer(m_dwElapse, true);
SetStates(FWL_WGTSTATE_Invisible, !bFlag);
}
@@ -138,17 +138,14 @@ void CFWL_CaretImp::DrawCaretBK(CFX_Graphics* pGraphics,
CFWL_CaretImp::CFWL_CaretTimer::CFWL_CaretTimer(CFWL_CaretImp* pCaret)
: m_pCaret(pCaret) {}
-int32_t CFWL_CaretImp::CFWL_CaretTimer::Run(FWL_HTIMER hTimer) {
- if (m_pCaret->GetStates() & FWL_STATE_CAT_HightLight) {
- m_pCaret->SetStates(FWL_STATE_CAT_HightLight, FALSE);
- } else {
- m_pCaret->SetStates(FWL_STATE_CAT_HightLight);
- }
+void CFWL_CaretImp::CFWL_CaretTimer::Run(IFWL_TimerInfo* pTimerInfo) {
+ bool toggle = !(m_pCaret->GetStates() & FWL_STATE_CAT_HightLight);
+ m_pCaret->SetStates(FWL_STATE_CAT_HightLight, toggle);
+
CFX_RectF rt;
m_pCaret->GetWidgetRect(rt);
rt.Set(0, 0, rt.width + 1, rt.height);
m_pCaret->Repaint(&rt);
- return 1;
}
CFWL_CaretImpDelegate::CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner)
diff --git a/xfa/fwl/basewidget/fwl_caretimp.h b/xfa/fwl/basewidget/fwl_caretimp.h
index b1ebcfa184..e7484e6edc 100644
--- a/xfa/fwl/basewidget/fwl_caretimp.h
+++ b/xfa/fwl/basewidget/fwl_caretimp.h
@@ -43,7 +43,7 @@ class CFWL_CaretImp : public CFWL_WidgetImp {
public:
explicit CFWL_CaretTimer(CFWL_CaretImp* pCaret);
~CFWL_CaretTimer() override {}
- int32_t Run(FWL_HTIMER hTimer) override;
+ void Run(IFWL_TimerInfo* hTimer) override;
CFWL_CaretImp* const m_pCaret;
};
@@ -52,7 +52,7 @@ class CFWL_CaretImp : public CFWL_WidgetImp {
const CFX_Matrix* pMatrix);
CFWL_CaretTimer* m_pTimer;
- FWL_HTIMER m_hTimer;
+ IFWL_TimerInfo* m_pTimerInfo;
uint32_t m_dwElapse;
CFX_Color m_crFill;
FX_BOOL m_bSetColor;
diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp
index 17f98059be..15b1d911b5 100644
--- a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp
+++ b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp
@@ -67,7 +67,7 @@ FX_BOOL IFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) {
CFWL_ScrollBarImp::CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_WidgetImp(properties, pOuter),
- m_hTimer(nullptr),
+ m_pTimerInfo(nullptr),
m_fRangeMin(0),
m_fRangeMax(-1),
m_fPageSize(0),
@@ -233,15 +233,15 @@ FX_BOOL CFWL_ScrollBarImp::DoScroll(uint32_t dwCode, FX_FLOAT fPos) {
}
return OnScroll(dwCode, fPos);
}
-int32_t CFWL_ScrollBarImp::Run(FWL_HTIMER hTimer) {
- if (m_hTimer) {
- FWL_StopTimer(m_hTimer);
- }
- if (!SendEvent()) {
- m_hTimer = FWL_StartTimer(this, 0);
- }
- return 1;
+
+void CFWL_ScrollBarImp::Run(IFWL_TimerInfo* pTimerInfo) {
+ if (m_pTimerInfo)
+ m_pTimerInfo->StopTimer();
+
+ if (!SendEvent())
+ m_pTimerInfo = StartTimer(0, true);
}
+
FWL_Error CFWL_ScrollBarImp::SetOuter(IFWL_Widget* pOuter) {
m_pOuter = pOuter;
return FWL_Error::Succeeded;
@@ -281,8 +281,6 @@ void CFWL_ScrollBarImp::DrawArrowBtn(CFX_Graphics* pGraphics,
void CFWL_ScrollBarImp::DrawThumb(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
- if (!IsEnabled()) {
- }
CFWL_ThemeBackground param;
param.m_pWidget = m_pInterface;
param.m_iPart = CFWL_Part::Thumb;
@@ -706,14 +704,14 @@ void CFWL_ScrollBarImpDelegate::OnLButtonDown(uint32_t dwFlags,
}
}
}
- if (!m_pOwner->SendEvent()) {
- m_pOwner->m_hTimer = FWL_StartTimer(m_pOwner, FWL_SCROLLBAR_Elapse);
- }
+ if (!m_pOwner->SendEvent())
+ m_pOwner->m_pTimerInfo = m_pOwner->StartTimer(FWL_SCROLLBAR_Elapse, true);
}
+
void CFWL_ScrollBarImpDelegate::OnLButtonUp(uint32_t dwFlags,
FX_FLOAT fx,
FX_FLOAT fy) {
- FWL_StopTimer(m_pOwner->m_hTimer);
+ m_pOwner->m_pTimerInfo->StopTimer();
m_pOwner->m_bMouseDown = FALSE;
DoMouseUp(0, m_pOwner->m_rtMinBtn, m_pOwner->m_iMinButtonState, fx, fy);
DoMouseUp(1, m_pOwner->m_rtThumb, m_pOwner->m_iThumbButtonState, fx, fy);
diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.h b/xfa/fwl/basewidget/fwl_scrollbarimp.h
index ad10e207db..4410830707 100644
--- a/xfa/fwl/basewidget/fwl_scrollbarimp.h
+++ b/xfa/fwl/basewidget/fwl_scrollbarimp.h
@@ -32,7 +32,7 @@ class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer {
const CFX_Matrix* pMatrix = nullptr) override;
// IFWL_Timer
- int32_t Run(FWL_HTIMER hTimer) override;
+ void Run(IFWL_TimerInfo* pTimerInfo) override;
FX_BOOL IsVertical();
FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax);
@@ -74,7 +74,7 @@ class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer {
FX_BOOL SendEvent();
FX_BOOL OnScroll(uint32_t dwCode, FX_FLOAT fPos);
- FWL_HTIMER m_hTimer;
+ IFWL_TimerInfo* m_pTimerInfo;
FX_FLOAT m_fRangeMin;
FX_FLOAT m_fRangeMax;
FX_FLOAT m_fPageSize;
diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp
index 25c8a35983..4eddce7439 100644
--- a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp
+++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp
@@ -52,7 +52,7 @@ CFWL_SpinButtonImp::CFWL_SpinButtonImp(
m_dwDnState(CFWL_PartState_Normal),
m_iButtonIndex(0),
m_bLButtonDwn(FALSE),
- m_hTimer(NULL) {
+ m_pTimerInfo(nullptr) {
m_rtClient.Reset();
m_rtUpButton.Reset();
m_rtDnButton.Reset();
@@ -133,7 +133,7 @@ FWL_Error CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics,
if (!pGraphics)
return FWL_Error::Indefinite;
CFX_RectF rtClip(m_rtClient);
- if (pMatrix != NULL) {
+ if (pMatrix) {
pMatrix->TransformRect(rtClip);
}
IFWL_ThemeProvider* pTheme = GetAvailableTheme();
@@ -147,15 +147,17 @@ FWL_Error CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics,
DrawDownButton(pGraphics, pTheme, pMatrix);
return FWL_Error::Succeeded;
}
-int32_t CFWL_SpinButtonImp::Run(FWL_HTIMER hTimer) {
- if (m_hTimer) {
- CFWL_EvtSpbClick wmPosChanged;
- wmPosChanged.m_pSrcTarget = m_pInterface;
- wmPosChanged.m_bUp = m_iButtonIndex == 0;
- DispatchEvent(&wmPosChanged);
- }
- return 1;
+
+void CFWL_SpinButtonImp::Run(IFWL_TimerInfo* pTimerInfo) {
+ if (!m_pTimerInfo)
+ return;
+
+ CFWL_EvtSpbClick wmPosChanged;
+ wmPosChanged.m_pSrcTarget = m_pInterface;
+ wmPosChanged.m_bUp = m_iButtonIndex == 0;
+ DispatchEvent(&wmPosChanged);
}
+
FWL_Error CFWL_SpinButtonImp::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) {
if (bUp) {
if (bEnable) {
@@ -305,8 +307,9 @@ void CFWL_SpinButtonImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_pOwner->DispatchEvent(&wmPosChanged);
m_pOwner->Repaint(bUpPress ? &m_pOwner->m_rtUpButton
: &m_pOwner->m_rtDnButton);
- m_pOwner->m_hTimer = FWL_StartTimer(m_pOwner, kElapseTime);
+ m_pOwner->m_pTimerInfo = m_pOwner->StartTimer(kElapseTime, true);
}
+
void CFWL_SpinButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_pProperties->m_dwStates & CFWL_PartState_Disabled) {
return;
@@ -314,9 +317,9 @@ void CFWL_SpinButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_pOwner->m_bLButtonDwn = FALSE;
m_pOwner->SetGrab(FALSE);
m_pOwner->SetFocus(FALSE);
- if (m_pOwner->m_hTimer) {
- FWL_StopTimer(m_pOwner->m_hTimer);
- m_pOwner->m_hTimer = NULL;
+ if (m_pOwner->m_pTimerInfo) {
+ m_pOwner->m_pTimerInfo->StopTimer();
+ m_pOwner->m_pTimerInfo = nullptr;
}
FX_BOOL bRepaint = FALSE;
CFX_RectF rtInvalidate;
diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.h b/xfa/fwl/basewidget/fwl_spinbuttonimp.h
index 068fbd888f..d986f31cd2 100644
--- a/xfa/fwl/basewidget/fwl_spinbuttonimp.h
+++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.h
@@ -33,7 +33,7 @@ class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer {
const CFX_Matrix* pMatrix = nullptr) override;
// IFWL_Timer
- int32_t Run(FWL_HTIMER hTimer) override;
+ void Run(IFWL_TimerInfo* pTimerInfo) override;
FWL_Error EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE);
FX_BOOL IsButtonEnable(FX_BOOL bUp = TRUE);
@@ -55,8 +55,9 @@ class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer {
uint32_t m_dwDnState;
int32_t m_iButtonIndex;
FX_BOOL m_bLButtonDwn;
- FWL_HTIMER m_hTimer;
+ IFWL_TimerInfo* m_pTimerInfo;
};
+
class CFWL_SpinButtonImpDelegate : public CFWL_WidgetImpDelegate {
public:
CFWL_SpinButtonImpDelegate(CFWL_SpinButtonImp* pOwner);
diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
index 9ac9c31160..e09113e19e 100644
--- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
+++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
@@ -48,9 +48,9 @@ CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties,
m_bBtnDown(FALSE),
m_dwTTOStyles(FDE_TTOSTYLE_SingleLine),
m_iTTOAlign(FDE_TTOALIGNMENT_Center),
- m_hTimerShow(NULL),
- m_hTimerHide(NULL),
- m_pTimer(NULL) {
+ m_pTimerInfoShow(nullptr),
+ m_pTimerInfoHide(nullptr),
+ m_pTimer(nullptr) {
m_rtClient.Set(0, 0, 0, 0);
m_rtCaption.Set(0, 0, 0, 0);
m_rtAnchor.Set(0, 0, 0, 0);
@@ -59,10 +59,8 @@ CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties,
}
CFWL_ToolTipImp::~CFWL_ToolTipImp() {
- if (m_pTimer) {
- delete m_pTimer;
- m_pTimer = NULL;
- }
+ delete m_pTimer;
+ m_pTimer = nullptr;
}
FWL_Error CFWL_ToolTipImp::GetClassName(CFX_WideString& wsClass) const {
@@ -92,7 +90,7 @@ FWL_Error CFWL_ToolTipImp::Finalize() {
FWL_Error CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Set(0, 0, 0, 0);
- if (m_pProperties->m_pThemeProvider == NULL) {
+ if (!m_pProperties->m_pThemeProvider) {
m_pProperties->m_pThemeProvider = GetAvailableTheme();
}
CFX_WideString wsCaption;
@@ -221,18 +219,18 @@ void CFWL_ToolTipImp::Show() {
static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
int32_t nInitDelay = pData->GetInitialDelay(m_pInterface);
if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible))
- m_hTimerShow = FWL_StartTimer(&m_TimerShow, nInitDelay, FALSE);
+ m_pTimerInfoShow = m_TimerShow.StartTimer(nInitDelay, false);
}
void CFWL_ToolTipImp::Hide() {
SetStates(FWL_WGTSTATE_Invisible, TRUE);
- if (m_hTimerHide) {
- FWL_StopTimer(m_hTimerHide);
- m_hTimerHide = nullptr;
+ if (m_pTimerInfoHide) {
+ m_pTimerInfoHide->StopTimer();
+ m_pTimerInfoHide = nullptr;
}
- if (m_hTimerShow) {
- FWL_StopTimer(m_hTimerShow);
- m_hTimerShow = nullptr;
+ if (m_pTimerInfoShow) {
+ m_pTimerInfoShow->StopTimer();
+ m_pTimerInfoShow = nullptr;
}
}
@@ -241,7 +239,7 @@ void CFWL_ToolTipImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
IFWL_ToolTipDP* pData =
static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
int32_t nAutoPopDelay = pData->GetAutoPopDelay(m_pInterface);
- m_hTimerHide = FWL_StartTimer(&m_TimerHide, nAutoPopDelay, FALSE);
+ m_pTimerInfoHide = m_TimerHide.StartTimer(nAutoPopDelay, false);
}
CFWL_WidgetImp::SetStates(dwStates, bSet);
}
@@ -276,23 +274,24 @@ void CFWL_ToolTipImp::RefreshToolTipPos() {
}
CFWL_ToolTipImp::CFWL_ToolTipTimer::CFWL_ToolTipTimer(CFWL_ToolTipImp* pToolTip)
: m_pToolTip(pToolTip) {}
-int32_t CFWL_ToolTipImp::CFWL_ToolTipTimer::Run(FWL_HTIMER hTimer) {
- if (m_pToolTip->m_hTimerShow == hTimer && m_pToolTip->m_hTimerShow) {
+
+void CFWL_ToolTipImp::CFWL_ToolTipTimer::Run(IFWL_TimerInfo* pTimerInfo) {
+ if (m_pToolTip->m_pTimerInfoShow == pTimerInfo &&
+ m_pToolTip->m_pTimerInfoShow) {
if (m_pToolTip->GetStates() & FWL_WGTSTATE_Invisible) {
m_pToolTip->SetStates(FWL_WGTSTATE_Invisible, FALSE);
m_pToolTip->RefreshToolTipPos();
- FWL_StopTimer(m_pToolTip->m_hTimerShow);
- m_pToolTip->m_hTimerShow = NULL;
- return TRUE;
+ m_pToolTip->m_pTimerInfoShow->StopTimer();
+ m_pToolTip->m_pTimerInfoShow = nullptr;
+ return;
}
}
- if (m_pToolTip->m_hTimerHide == hTimer && m_pToolTip->m_hTimerHide) {
+ if (m_pToolTip->m_pTimerInfoHide == pTimerInfo &&
+ m_pToolTip->m_pTimerInfoHide) {
m_pToolTip->SetStates(FWL_WGTSTATE_Invisible, TRUE);
- FWL_StopTimer(m_pToolTip->m_hTimerHide);
- m_pToolTip->m_hTimerHide = NULL;
- return TRUE;
+ m_pToolTip->m_pTimerInfoHide->StopTimer();
+ m_pToolTip->m_pTimerInfoHide = nullptr;
}
- return TRUE;
}
CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner)
diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h b/xfa/fwl/basewidget/fwl_tooltipctrlimp.h
index 6d7af8dc89..c21a47ec07 100644
--- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h
+++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.h
@@ -44,10 +44,10 @@ class CFWL_ToolTipImp : public CFWL_FormImp {
class CFWL_ToolTipTimer : public IFWL_Timer {
public:
CFWL_ToolTipTimer() {}
- ~CFWL_ToolTipTimer() {}
+ explicit CFWL_ToolTipTimer(CFWL_ToolTipImp* pToolTip);
+ ~CFWL_ToolTipTimer() override {}
- CFWL_ToolTipTimer(CFWL_ToolTipImp* pToolTip);
- virtual int32_t Run(FWL_HTIMER hTimer);
+ void Run(IFWL_TimerInfo* pTimerInfo) override;
CFWL_ToolTipImp* m_pToolTip;
};
@@ -67,8 +67,8 @@ class CFWL_ToolTipImp : public CFWL_FormImp {
uint32_t m_dwTTOStyles;
int32_t m_iTTOAlign;
CFX_RectF m_rtAnchor;
- FWL_HTIMER m_hTimerShow;
- FWL_HTIMER m_hTimerHide;
+ IFWL_TimerInfo* m_pTimerInfoShow;
+ IFWL_TimerInfo* m_pTimerInfoHide;
CFWL_ToolTipTimer* m_pTimer;
CFWL_ToolTipTimer m_TimerShow;
CFWL_ToolTipTimer m_TimerHide;