Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: xfa/fwl/core/ifwl_monthcalendar.cpp

Issue 2432423002: Merge the CFWL_*Imp classes into the IFWL_* classes. (Closed)
Patch Set: Review feedback Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fwl/core/ifwl_monthcalendar.h ('k') | xfa/fwl/core/ifwl_picturebox.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fwl/core/ifwl_monthcalendar.cpp
diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp b/xfa/fwl/core/ifwl_monthcalendar.cpp
similarity index 83%
rename from xfa/fwl/basewidget/fwl_monthcalendarimp.cpp
rename to xfa/fwl/core/ifwl_monthcalendar.cpp
index 7477f04bdce530ed9bbaac6c454aa3bb1b66d6d8..741c88f6062ba9e260cd8f9ac5856aafe08b7605 100644
--- a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp
+++ b/xfa/fwl/core/ifwl_monthcalendar.cpp
@@ -4,17 +4,16 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_monthcalendarimp.h"
+#include "xfa/fwl/core/ifwl_monthcalendar.h"
#include <algorithm>
#include "xfa/fde/tto/fde_textout.h"
-#include "xfa/fwl/basewidget/ifwl_monthcalendar.h"
#include "xfa/fwl/core/cfwl_message.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_themetext.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
+#include "xfa/fwl/core/ifwl_monthcalendar.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#define MONTHCAL_HSEP_HEIGHT 1
@@ -122,35 +121,13 @@ CFX_WideString* GetCapacityForMonth(IFWL_ThemeProvider* pTheme,
IFWL_MonthCalendar* IFWL_MonthCalendar::Create(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
- IFWL_MonthCalendar* pMonthCalendar = new IFWL_MonthCalendar;
- CFWL_MonthCalendarImp* pMonthCalendarImpl =
- new CFWL_MonthCalendarImp(properties, pOuter);
- pMonthCalendar->SetImpl(pMonthCalendarImpl);
- pMonthCalendarImpl->SetInterface(pMonthCalendar);
- return pMonthCalendar;
-}
-IFWL_MonthCalendar::IFWL_MonthCalendar() {}
-int32_t IFWL_MonthCalendar::CountSelect() {
- return static_cast<CFWL_MonthCalendarImp*>(GetImpl())->CountSelect();
-}
-FX_BOOL IFWL_MonthCalendar::GetSelect(int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay,
- int32_t nIndex) {
- return static_cast<CFWL_MonthCalendarImp*>(GetImpl())
- ->GetSelect(iYear, iMonth, iDay, nIndex);
-}
-FX_BOOL IFWL_MonthCalendar::SetSelect(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
- return static_cast<CFWL_MonthCalendarImp*>(GetImpl())
- ->SetSelect(iYear, iMonth, iDay);
+ return new IFWL_MonthCalendar(properties, pOuter);
}
-CFWL_MonthCalendarImp::CFWL_MonthCalendarImp(
+IFWL_MonthCalendar::IFWL_MonthCalendar(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+ : IFWL_Widget(properties, pOuter),
m_bInit(FALSE),
m_pDateTime(new CFX_DateTime),
m_iCurYear(2011),
@@ -176,45 +153,47 @@ CFWL_MonthCalendarImp::CFWL_MonthCalendarImp(
m_rtWeekNumSep.Reset();
}
-CFWL_MonthCalendarImp::~CFWL_MonthCalendarImp() {
+IFWL_MonthCalendar::~IFWL_MonthCalendar() {
ClearDateItem();
m_arrSelDays.RemoveAll();
}
-FWL_Error CFWL_MonthCalendarImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_MonthCalendar::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_MonthCalendar;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_MonthCalendarImp::GetClassID() const {
+FWL_Type IFWL_MonthCalendar::GetClassID() const {
return FWL_Type::MonthCalendar;
}
-FWL_Error CFWL_MonthCalendarImp::Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_MonthCalendar::Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_MonthCalendarImpDelegate(this);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_MonthCalendarImp::Finalize() {
+FWL_Error IFWL_MonthCalendar::Finalize() {
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_MonthCalendarImp::GetWidgetRect(CFX_RectF& rect,
- FX_BOOL bAutoSize) {
+
+FWL_Error IFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect,
+ FX_BOOL bAutoSize) {
if (bAutoSize) {
CFX_SizeF fs = CalcSize(TRUE);
rect.Set(0, 0, fs.x, fs.y);
- CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
+ IFWL_Widget::GetWidgetRect(rect, TRUE);
} else {
rect = m_pProperties->m_rtWidget;
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_MonthCalendarImp::Update() {
+
+FWL_Error IFWL_MonthCalendar::Update() {
if (IsLocked()) {
return FWL_Error::Indefinite;
}
@@ -230,8 +209,9 @@ FWL_Error CFWL_MonthCalendarImp::Update() {
LayOut();
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_MonthCalendar::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
if (!m_pProperties->m_pThemeProvider) {
@@ -262,13 +242,15 @@ FWL_Error CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics,
}
return FWL_Error::Succeeded;
}
-int32_t CFWL_MonthCalendarImp::CountSelect() {
+
+int32_t IFWL_MonthCalendar::CountSelect() {
return m_arrSelDays.GetSize();
}
-FX_BOOL CFWL_MonthCalendarImp::GetSelect(int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay,
- int32_t nIndex) {
+
+FX_BOOL IFWL_MonthCalendar::GetSelect(int32_t& iYear,
+ int32_t& iMonth,
+ int32_t& iDay,
+ int32_t nIndex) {
if (nIndex >= m_arrSelDays.GetSize()) {
return FALSE;
}
@@ -277,17 +259,19 @@ FX_BOOL CFWL_MonthCalendarImp::GetSelect(int32_t& iYear,
iDay = m_arrSelDays[nIndex];
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::SetSelect(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
+
+FX_BOOL IFWL_MonthCalendar::SetSelect(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
ChangeToMonth(iYear, iMonth);
return AddSelDay(iDay);
}
-void CFWL_MonthCalendarImp::DrawBkground(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawBkground(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::Background;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -297,11 +281,12 @@ void CFWL_MonthCalendarImp::DrawBkground(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-void CFWL_MonthCalendarImp::DrawHeadBK(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawHeadBK(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::Header;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -311,11 +296,12 @@ void CFWL_MonthCalendarImp::DrawHeadBK(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-void CFWL_MonthCalendarImp::DrawLButton(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawLButton(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::LBtn;
params.m_pGraphics = pGraphics;
params.m_dwStates = m_iLBtnPartStates;
@@ -325,11 +311,12 @@ void CFWL_MonthCalendarImp::DrawLButton(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-void CFWL_MonthCalendarImp::DrawRButton(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawRButton(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::RBtn;
params.m_pGraphics = pGraphics;
params.m_dwStates = m_iRBtnPartStates;
@@ -339,11 +326,12 @@ void CFWL_MonthCalendarImp::DrawRButton(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-void CFWL_MonthCalendarImp::DrawCaption(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawCaption(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeText textParam;
- textParam.m_pWidget = m_pInterface;
+ textParam.m_pWidget = this;
textParam.m_iPart = CFWL_Part::Caption;
textParam.m_dwStates = CFWL_PartState_Normal;
textParam.m_pGraphics = pGraphics;
@@ -364,11 +352,12 @@ void CFWL_MonthCalendarImp::DrawCaption(CFX_Graphics* pGraphics,
}
pTheme->DrawText(&textParam);
}
-void CFWL_MonthCalendarImp::DrawSeperator(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawSeperator(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::HSeparator;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -378,11 +367,12 @@ void CFWL_MonthCalendarImp::DrawSeperator(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-void CFWL_MonthCalendarImp::DrawDatesInBK(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawDatesInBK(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::DateInBK;
params.m_pGraphics = pGraphics;
if (pMatrix) {
@@ -412,11 +402,12 @@ void CFWL_MonthCalendarImp::DrawDatesInBK(CFX_Graphics* pGraphics,
params.m_dwStates = 0;
}
}
-void CFWL_MonthCalendarImp::DrawWeek(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawWeek(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeText params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::Week;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -434,11 +425,12 @@ void CFWL_MonthCalendarImp::DrawWeek(CFX_Graphics* pGraphics,
pTheme->DrawText(&params);
}
}
-void CFWL_MonthCalendarImp::DrawWeekNumber(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawWeekNumber(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeText params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::WeekNum;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -466,11 +458,12 @@ void CFWL_MonthCalendarImp::DrawWeekNumber(CFX_Graphics* pGraphics,
pTheme->DrawText(&params);
}
}
-void CFWL_MonthCalendarImp::DrawWeekNumberSep(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawWeekNumberSep(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::WeekNumSep;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -480,14 +473,15 @@ void CFWL_MonthCalendarImp::DrawWeekNumberSep(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-void CFWL_MonthCalendarImp::DrawToday(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawToday(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoToday) {
return;
}
CFWL_ThemeText params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::Today;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -506,11 +500,12 @@ void CFWL_MonthCalendarImp::DrawToday(CFX_Graphics* pGraphics,
}
pTheme->DrawText(&params);
}
-void CFWL_MonthCalendarImp::DrawDatesIn(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawDatesIn(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeText params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::DatesIn;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -531,11 +526,12 @@ void CFWL_MonthCalendarImp::DrawDatesIn(CFX_Graphics* pGraphics,
pTheme->DrawText(&params);
}
}
-void CFWL_MonthCalendarImp::DrawDatesOut(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawDatesOut(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeText params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::DatesOut;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -545,9 +541,10 @@ void CFWL_MonthCalendarImp::DrawDatesOut(CFX_Graphics* pGraphics,
}
pTheme->DrawText(&params);
}
-void CFWL_MonthCalendarImp::DrawDatesInCircle(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawDatesInCircle(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoTodayCircle) {
return;
}
@@ -561,7 +558,7 @@ void CFWL_MonthCalendarImp::DrawDatesInCircle(CFX_Graphics* pGraphics,
if (!pDate)
return;
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::DateInCircle;
params.m_pGraphics = pGraphics;
params.m_rtPart = pDate->rect;
@@ -571,9 +568,10 @@ void CFWL_MonthCalendarImp::DrawDatesInCircle(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-void CFWL_MonthCalendarImp::DrawTodayCircle(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawTodayCircle(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoToday) {
return;
}
@@ -581,7 +579,7 @@ void CFWL_MonthCalendarImp::DrawTodayCircle(CFX_Graphics* pGraphics,
return;
}
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::TodayCircle;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -591,7 +589,8 @@ void CFWL_MonthCalendarImp::DrawTodayCircle(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) {
+
+CFX_SizeF IFWL_MonthCalendar::CalcSize(FX_BOOL bAutoSize) {
if (!m_pProperties->m_pThemeProvider)
return CFX_SizeF();
@@ -602,7 +601,7 @@ CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) {
CFX_SizeF fs;
CFWL_ThemePart params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
FX_FLOAT fMaxWeekW = 0.0f;
FX_FLOAT fMaxWeekH = 0.0f;
@@ -657,7 +656,7 @@ CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) {
return fs;
}
-void CFWL_MonthCalendarImp::CalcHeadSize() {
+void IFWL_MonthCalendar::CalcHeadSize() {
FX_FLOAT fHeadHMargin = (m_rtClient.width - m_szHead.x) / 2;
FX_FLOAT fHeadVMargin = (m_szCell.x - m_szHead.y) / 2;
m_rtHeadText.Set(m_rtClient.left + fHeadHMargin,
@@ -665,7 +664,8 @@ void CFWL_MonthCalendarImp::CalcHeadSize() {
MONTHCAL_VMARGIN + fHeadVMargin,
m_szHead.x, m_szHead.y);
}
-void CFWL_MonthCalendarImp::CalcTodaySize() {
+
+void IFWL_MonthCalendar::CalcTodaySize() {
m_rtTodayFlag.Set(
m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + MONTHCAL_HMARGIN,
m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN,
@@ -676,7 +676,8 @@ void CFWL_MonthCalendarImp::CalcTodaySize() {
m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN,
m_szToday.x, m_szToday.y);
}
-void CFWL_MonthCalendarImp::LayOut() {
+
+void IFWL_MonthCalendar::LayOut() {
GetClientRect(m_rtClient);
{
m_rtHead.Set(
@@ -707,7 +708,8 @@ void CFWL_MonthCalendarImp::LayOut() {
}
CalDateItem();
}
-void CFWL_MonthCalendarImp::CalDateItem() {
+
+void IFWL_MonthCalendar::CalDateItem() {
FX_BOOL bNewWeek = FALSE;
int32_t iWeekOfMonth = 0;
FX_FLOAT fLeft = m_rtDates.left;
@@ -732,13 +734,14 @@ void CFWL_MonthCalendarImp::CalDateItem() {
}
}
}
-void CFWL_MonthCalendarImp::GetCapValue() {
+
+void IFWL_MonthCalendar::GetCapValue() {
if (!m_pProperties->m_pThemeProvider) {
m_pProperties->m_pThemeProvider = GetAvailableTheme();
}
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
CFWL_ThemePart part;
- part.m_pWidget = m_pInterface;
+ part.m_pWidget = this;
m_fHeadWid = *static_cast<FX_FLOAT*>(
pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderWidth));
m_fHeadHei = *static_cast<FX_FLOAT*>(
@@ -795,46 +798,52 @@ void CFWL_MonthCalendarImp::GetCapValue() {
m_fMCHei = *static_cast<FX_FLOAT*>(
pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Height));
}
-int32_t CFWL_MonthCalendarImp::CalWeekNumber(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
+
+int32_t IFWL_MonthCalendar::CalWeekNumber(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
return 0;
}
-FX_BOOL CFWL_MonthCalendarImp::GetMinDate(int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) {
+
+FX_BOOL IFWL_MonthCalendar::GetMinDate(int32_t& iYear,
+ int32_t& iMonth,
+ int32_t& iDay) {
iYear = m_dtMin.iYear;
iMonth = m_dtMin.iMonth;
iDay = m_dtMin.iDay;
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::SetMinDate(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
+
+FX_BOOL IFWL_MonthCalendar::SetMinDate(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
m_dtMin = DATE(iYear, iMonth, iDay);
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::GetMaxDate(int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) {
+
+FX_BOOL IFWL_MonthCalendar::GetMaxDate(int32_t& iYear,
+ int32_t& iMonth,
+ int32_t& iDay) {
iYear = m_dtMax.iYear;
iMonth = m_dtMax.iMonth;
iDay = m_dtMax.iDay;
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::SetMaxDate(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
+
+FX_BOOL IFWL_MonthCalendar::SetMaxDate(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
m_dtMax = DATE(iYear, iMonth, iDay);
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::InitDate() {
+
+FX_BOOL IFWL_MonthCalendar::InitDate() {
if (m_pProperties->m_pDataProvider) {
IFWL_MonthCalendarDP* pDateProv =
static_cast<IFWL_MonthCalendarDP*>(m_pProperties->m_pDataProvider);
- m_iYear = pDateProv->GetCurYear(m_pInterface);
- m_iMonth = pDateProv->GetCurMonth(m_pInterface);
- m_iDay = pDateProv->GetCurDay(m_pInterface);
+ m_iYear = pDateProv->GetCurYear(this);
+ m_iMonth = pDateProv->GetCurMonth(this);
+ m_iDay = pDateProv->GetCurDay(this);
m_iCurYear = m_iYear;
m_iCurMonth = m_iMonth;
} else {
@@ -851,14 +860,14 @@ FX_BOOL CFWL_MonthCalendarImp::InitDate() {
return TRUE;
}
-void CFWL_MonthCalendarImp::ClearDateItem() {
+void IFWL_MonthCalendar::ClearDateItem() {
for (int32_t i = 0; i < m_arrDates.GetSize(); i++)
delete m_arrDates.GetAt(i);
m_arrDates.RemoveAll();
}
-void CFWL_MonthCalendarImp::ReSetDateItem() {
+void IFWL_MonthCalendar::ReSetDateItem() {
m_pDateTime->Set(m_iCurYear, m_iCurMonth, 1);
int32_t iDays = FX_DaysInMonth(m_iCurYear, m_iCurMonth);
int32_t iDayOfWeek = m_pDateTime->GetDayOfWeek();
@@ -882,7 +891,8 @@ void CFWL_MonthCalendarImp::ReSetDateItem() {
iDayOfWeek++;
}
}
-FX_BOOL CFWL_MonthCalendarImp::NextMonth() {
+
+FX_BOOL IFWL_MonthCalendar::NextMonth() {
int32_t iYear = m_iCurYear, iMonth = m_iCurMonth;
if (iMonth >= 12) {
iMonth = 1;
@@ -898,7 +908,8 @@ FX_BOOL CFWL_MonthCalendarImp::NextMonth() {
ChangeToMonth(m_iCurYear, m_iCurMonth);
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::PrevMonth() {
+
+FX_BOOL IFWL_MonthCalendar::PrevMonth() {
int32_t iYear = m_iCurYear, iMonth = m_iCurMonth;
if (iMonth <= 1) {
iMonth = 12;
@@ -914,7 +925,8 @@ FX_BOOL CFWL_MonthCalendarImp::PrevMonth() {
ChangeToMonth(m_iCurYear, m_iCurMonth);
return TRUE;
}
-void CFWL_MonthCalendarImp::ChangeToMonth(int32_t iYear, int32_t iMonth) {
+
+void IFWL_MonthCalendar::ChangeToMonth(int32_t iYear, int32_t iMonth) {
m_iCurYear = iYear;
m_iCurMonth = iMonth;
m_iHovered = -1;
@@ -923,7 +935,8 @@ void CFWL_MonthCalendarImp::ChangeToMonth(int32_t iYear, int32_t iMonth) {
CalDateItem();
GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead);
}
-FX_BOOL CFWL_MonthCalendarImp::RemoveSelDay(int32_t iDay, FX_BOOL bAll) {
+
+FX_BOOL IFWL_MonthCalendar::RemoveSelDay(int32_t iDay, FX_BOOL bAll) {
if (iDay == -1 && !bAll) {
return FALSE;
}
@@ -953,7 +966,8 @@ FX_BOOL CFWL_MonthCalendarImp::RemoveSelDay(int32_t iDay, FX_BOOL bAll) {
}
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::AddSelDay(int32_t iDay) {
+
+FX_BOOL IFWL_MonthCalendar::AddSelDay(int32_t iDay) {
ASSERT(iDay > 0);
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) {
} else {
@@ -968,7 +982,8 @@ FX_BOOL CFWL_MonthCalendarImp::AddSelDay(int32_t iDay) {
}
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::JumpToToday() {
+
+FX_BOOL IFWL_MonthCalendar::JumpToToday() {
if (m_iYear != m_iCurYear || m_iMonth != m_iCurMonth) {
m_iCurYear = m_iYear;
m_iCurMonth = m_iMonth;
@@ -981,9 +996,10 @@ FX_BOOL CFWL_MonthCalendarImp::JumpToToday() {
}
return TRUE;
}
-void CFWL_MonthCalendarImp::GetHeadText(int32_t iYear,
- int32_t iMonth,
- CFX_WideString& wsHead) {
+
+void IFWL_MonthCalendar::GetHeadText(int32_t iYear,
+ int32_t iMonth,
+ CFX_WideString& wsHead) {
ASSERT(iMonth > 0 && iMonth < 13);
static const FX_WCHAR* const pMonth[] = {
L"January", L"February", L"March", L"April",
@@ -991,13 +1007,15 @@ void CFWL_MonthCalendarImp::GetHeadText(int32_t iYear,
L"September", L"October", L"November", L"December"};
wsHead.Format(L"%s, %d", pMonth[iMonth - 1], iYear);
}
-void CFWL_MonthCalendarImp::GetTodayText(int32_t iYear,
- int32_t iMonth,
- int32_t iDay,
- CFX_WideString& wsToday) {
+
+void IFWL_MonthCalendar::GetTodayText(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay,
+ CFX_WideString& wsToday) {
wsToday.Format(L", %d/%d/%d", iDay, iMonth, iYear);
}
-int32_t CFWL_MonthCalendarImp::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) {
+
+int32_t IFWL_MonthCalendar::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) {
int32_t iCount = m_arrDates.GetSize();
for (int32_t i = 0; i < iCount; i++) {
FWL_DATEINFO* pDateInfo = m_arrDates.GetAt(i);
@@ -1007,7 +1025,8 @@ int32_t CFWL_MonthCalendarImp::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) {
}
return -1;
}
-FX_BOOL CFWL_MonthCalendarImp::GetDayRect(int32_t iDay, CFX_RectF& rtDay) {
+
+FX_BOOL IFWL_MonthCalendar::GetDayRect(int32_t iDay, CFX_RectF& rtDay) {
if (iDay <= 0 || iDay > m_arrDates.GetSize()) {
return FALSE;
}
@@ -1019,7 +1038,7 @@ FX_BOOL CFWL_MonthCalendarImp::GetDayRect(int32_t iDay, CFX_RectF& rtDay) {
}
CFWL_MonthCalendarImpDelegate::CFWL_MonthCalendarImpDelegate(
- CFWL_MonthCalendarImp* pOwner)
+ IFWL_MonthCalendar* pOwner)
: m_pOwner(pOwner) {}
void CFWL_MonthCalendarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
@@ -1063,9 +1082,7 @@ void CFWL_MonthCalendarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
}
break;
}
- default: {
- break;
- }
+ default: { break; }
}
CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
}
@@ -1086,6 +1103,7 @@ void CFWL_MonthCalendarImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
}
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
+
void CFWL_MonthCalendarImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
m_pOwner->m_iLBtnPartStates = CFWL_PartState_Pressed;
@@ -1121,20 +1139,21 @@ void CFWL_MonthCalendarImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
}
m_pOwner->AddSelDay(iCurSel);
CFWL_EvtClick wmClick;
- wmClick.m_pSrcTarget = m_pOwner->m_pInterface;
+ wmClick.m_pSrcTarget = m_pOwner;
m_pOwner->DispatchEvent(&wmClick);
CFWL_EventMcdDateChanged wmDateSelected;
wmDateSelected.m_iStartDay = iCurSel;
wmDateSelected.m_iEndDay = iCurSel;
wmDateSelected.m_iOldMonth = m_pOwner->m_iCurMonth;
wmDateSelected.m_iOldYear = m_pOwner->m_iCurYear;
- wmDateSelected.m_pSrcTarget = m_pOwner->m_pInterface;
+ wmDateSelected.m_pSrcTarget = m_pOwner;
m_pOwner->DispatchEvent(&wmDateSelected);
m_pOwner->Repaint(&rtInvalidate);
}
}
}
}
+
void CFWL_MonthCalendarImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
m_pOwner->m_iLBtnPartStates = 0;
@@ -1149,6 +1168,7 @@ void CFWL_MonthCalendarImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
}
}
}
+
void CFWL_MonthCalendarImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) {
return;
@@ -1185,6 +1205,7 @@ void CFWL_MonthCalendarImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
m_pOwner->Repaint(&rtInvalidate);
}
}
+
void CFWL_MonthCalendarImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_iHovered > 0) {
CFX_RectF rtInvalidate;
« no previous file with comments | « xfa/fwl/core/ifwl_monthcalendar.h ('k') | xfa/fwl/core/ifwl_picturebox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698