summaryrefslogtreecommitdiff
path: root/xfa/src/fwl
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/src/fwl')
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp12
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp30
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h93
-rw-r--r--xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp10
4 files changed, 70 insertions, 75 deletions
diff --git a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp
index b42b43f9e9..8c957db965 100644
--- a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp
@@ -301,11 +301,11 @@ void CFWL_DateTimeCalendarImpDelegate::OnLButtonUpEx(CFWL_MsgMouse* pMsg) {
pPicker->m_pForm->GetWidgetRect(rt);
rt.Set(0, 0, rt.width, rt.height);
if (iCurSel > 0) {
- LPDATEINFO lpDatesInfo =
- (LPDATEINFO)m_pOwner->m_arrDates.GetAt(iCurSel - 1);
+ FWL_DATEINFO* lpDatesInfo =
+ (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iCurSel - 1);
CFX_RectF rtInvalidate(lpDatesInfo->rect);
if (iOldSel > 0 && iOldSel <= m_pOwner->m_arrDates.GetSize()) {
- lpDatesInfo = (LPDATEINFO)m_pOwner->m_arrDates.GetAt(iOldSel - 1);
+ lpDatesInfo = (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iOldSel - 1);
rtInvalidate.Union(lpDatesInfo->rect);
}
m_pOwner->AddSelDay(iCurSel);
@@ -394,11 +394,11 @@ void CFWL_DateTimeCalendarImpDelegate::DisForm_OnLButtonUpEx(
}
int32_t iCurSel = m_pOwner->GetDayAtPoint(pMsg->m_fx, pMsg->m_fy);
if (iCurSel > 0) {
- LPDATEINFO lpDatesInfo =
- (LPDATEINFO)m_pOwner->m_arrDates.GetAt(iCurSel - 1);
+ FWL_DATEINFO* lpDatesInfo =
+ (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iCurSel - 1);
CFX_RectF rtInvalidate(lpDatesInfo->rect);
if (iOldSel > 0 && iOldSel <= m_pOwner->m_arrDates.GetSize()) {
- lpDatesInfo = (LPDATEINFO)m_pOwner->m_arrDates.GetAt(iOldSel - 1);
+ lpDatesInfo = (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iOldSel - 1);
rtInvalidate.Union(lpDatesInfo->rect);
}
m_pOwner->AddSelDay(iCurSel);
diff --git a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp
index 04ac358026..e9ac2af900 100644
--- a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp
@@ -288,7 +288,7 @@ void CFWL_MonthCalendarImp::DrawDatesInBK(CFX_Graphics* pGraphics,
}
int32_t iCount = m_arrDates.GetSize();
for (int32_t j = 0; j < iCount; j++) {
- LPDATEINFO pDataInfo = (LPDATEINFO)m_arrDates.GetAt(j);
+ FWL_DATEINFO* pDataInfo = (FWL_DATEINFO*)m_arrDates.GetAt(j);
if (pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Selected) {
params.m_dwStates |= FWL_PARTSTATE_MCD_Selected;
if (((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoTodayCircle) ==
@@ -422,7 +422,7 @@ void CFWL_MonthCalendarImp::DrawDatesIn(CFX_Graphics* pGraphics,
}
int32_t iCount = m_arrDates.GetSize();
for (int32_t j = 0; j < iCount; j++) {
- LPDATEINFO pDataInfo = (LPDATEINFO)m_arrDates.GetAt(j);
+ FWL_DATEINFO* pDataInfo = (FWL_DATEINFO*)m_arrDates.GetAt(j);
params.m_wsText = pDataInfo->wsDay;
params.m_rtPart = pDataInfo->rect;
params.m_dwStates = pDataInfo->dwStates;
@@ -459,7 +459,7 @@ void CFWL_MonthCalendarImp::DrawDatesInCircle(CFX_Graphics* pGraphics,
if (m_iDay < 1 || m_iDay > m_arrDates.GetSize()) {
return;
}
- LPDATEINFO pDate = (LPDATEINFO)m_arrDates[m_iDay - 1];
+ FWL_DATEINFO* pDate = (FWL_DATEINFO*)m_arrDates[m_iDay - 1];
if (!pDate)
return;
CFWL_ThemeBackground params;
@@ -617,7 +617,7 @@ void CFWL_MonthCalendarImp::CalDateItem() {
FX_FLOAT fTop = m_rtDates.top;
int32_t iCount = m_arrDates.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- LPDATEINFO pDateInfo = (LPDATEINFO)m_arrDates.GetAt(i);
+ FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(i);
if (bNewWeek) {
iWeekOfMonth++;
bNewWeek = FALSE;
@@ -756,7 +756,7 @@ FX_BOOL CFWL_MonthCalendarImp::InitDate() {
void CFWL_MonthCalendarImp::ClearDateItem() {
int32_t iCount = m_arrDates.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- LPDATEINFO pData = (LPDATEINFO)m_arrDates.GetAt(i);
+ FWL_DATEINFO* pData = (FWL_DATEINFO*)m_arrDates.GetAt(i);
delete pData;
}
m_arrDates.RemoveAll();
@@ -780,8 +780,8 @@ void CFWL_MonthCalendarImp::ReSetDateItem() {
}
CFX_RectF rtDate;
rtDate.Set(0, 0, 0, 0);
- LPDATEINFO pData = new DATEINFO(i + 1, iDayOfWeek, dwStates, rtDate, wsDay);
- m_arrDates.Add(pData);
+ m_arrDates.Add(
+ new FWL_DATEINFO(i + 1, iDayOfWeek, dwStates, rtDate, wsDay));
iDayOfWeek++;
}
}
@@ -836,7 +836,7 @@ FX_BOOL CFWL_MonthCalendarImp::RemoveSelDay(int32_t iDay, FX_BOOL bAll) {
for (int32_t i = 0; i < iCount; i++) {
int32_t iSelDay = m_arrSelDays.GetAt(i);
if (iSelDay <= iDatesCount) {
- LPDATEINFO pDateInfo = (LPDATEINFO)m_arrDates.GetAt(iSelDay - 1);
+ FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(iSelDay - 1);
pDateInfo->dwStates &= ~FWL_ITEMSTATE_MCD_Selected;
}
}
@@ -849,7 +849,7 @@ FX_BOOL CFWL_MonthCalendarImp::RemoveSelDay(int32_t iDay, FX_BOOL bAll) {
int32_t iSelDay = m_arrSelDays.GetAt(iDay);
int32_t iDatesCount = m_arrDates.GetSize();
if (iSelDay <= iDatesCount) {
- LPDATEINFO pDateInfo = (LPDATEINFO)m_arrDates.GetAt(iSelDay - 1);
+ FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(iSelDay - 1);
pDateInfo->dwStates &= ~FWL_ITEMSTATE_MCD_Selected;
}
m_arrSelDays.RemoveAt(index);
@@ -863,7 +863,7 @@ FX_BOOL CFWL_MonthCalendarImp::AddSelDay(int32_t iDay) {
if (m_arrSelDays.Find(iDay) == -1) {
RemoveSelDay(-1, TRUE);
if (iDay <= m_arrDates.GetSize()) {
- LPDATEINFO pDateInfo = (LPDATEINFO)m_arrDates.GetAt(iDay - 1);
+ FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(iDay - 1);
pDateInfo->dwStates |= FWL_ITEMSTATE_MCD_Selected;
}
m_arrSelDays.Add(iDay);
@@ -903,7 +903,7 @@ void CFWL_MonthCalendarImp::GetTodayText(int32_t iYear,
int32_t CFWL_MonthCalendarImp::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) {
int32_t iCount = m_arrDates.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- LPDATEINFO pDateInfo = (LPDATEINFO)m_arrDates.GetAt(i);
+ FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(i);
if (pDateInfo->rect.Contains(x, y)) {
return ++i;
}
@@ -914,7 +914,7 @@ FX_BOOL CFWL_MonthCalendarImp::GetDayRect(int32_t iDay, CFX_RectF& rtDay) {
if (iDay <= 0 || iDay > m_arrDates.GetSize()) {
return FALSE;
}
- LPDATEINFO pDateInfo = (LPDATEINFO)m_arrDates[iDay - 1];
+ FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates[iDay - 1];
if (!pDateInfo)
return FALSE;
rtDay = pDateInfo->rect;
@@ -1014,11 +1014,11 @@ void CFWL_MonthCalendarImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
int32_t iCurSel = m_pOwner->GetDayAtPoint(pMsg->m_fx, pMsg->m_fy);
FX_BOOL bSelChanged = iCurSel > 0 && iCurSel != iOldSel;
if (bSelChanged) {
- LPDATEINFO lpDatesInfo =
- (LPDATEINFO)m_pOwner->m_arrDates.GetAt(iCurSel - 1);
+ FWL_DATEINFO* lpDatesInfo =
+ (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iCurSel - 1);
CFX_RectF rtInvalidate(lpDatesInfo->rect);
if (iOldSel > 0) {
- lpDatesInfo = (LPDATEINFO)m_pOwner->m_arrDates.GetAt(iOldSel - 1);
+ lpDatesInfo = (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iOldSel - 1);
rtInvalidate.Union(lpDatesInfo->rect);
}
m_pOwner->AddSelDay(iCurSel);
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h b/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h
index aba3355e25..26a472b17b 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h
@@ -37,6 +37,39 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp {
virtual FX_BOOL SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay);
protected:
+ struct DATE {
+ DATE() : iYear(0), iMonth(0), iDay(0) {}
+ DATE(int32_t year, int32_t month, int32_t day)
+ : iYear(year), iMonth(month), iDay(day) {}
+ FX_BOOL operator<(const DATE& right) {
+ if (iYear < right.iYear) {
+ return TRUE;
+ } else if (iYear == right.iYear) {
+ if (iMonth < right.iMonth) {
+ return TRUE;
+ } else if (iMonth == right.iMonth) {
+ return iDay < right.iDay;
+ }
+ }
+ return FALSE;
+ }
+ FX_BOOL operator>(const DATE& right) {
+ if (iYear > right.iYear) {
+ return TRUE;
+ } else if (iYear == right.iYear) {
+ if (iMonth > right.iMonth) {
+ return TRUE;
+ } else if (iMonth == right.iMonth) {
+ return iDay > right.iDay;
+ }
+ }
+ return FALSE;
+ }
+ int32_t iYear;
+ int32_t iMonth;
+ int32_t iDay;
+ };
+
void DrawBkground(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix);
@@ -89,7 +122,6 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp {
void CalDateItem();
void GetCapValue();
int32_t CalWeekNumber(int32_t iYear, int32_t iMonth, int32_t iDay);
-
FX_BOOL GetMinDate(int32_t& iYear, int32_t& iMonth, int32_t& iDay);
FX_BOOL SetMinDate(int32_t iYear, int32_t iMonth, int32_t iDay);
FX_BOOL GetMaxDate(int32_t& iYear, int32_t& iMonth, int32_t& iDay);
@@ -110,43 +142,7 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp {
CFX_WideString& wsToday);
int32_t GetDayAtPoint(FX_FLOAT x, FX_FLOAT y);
FX_BOOL GetDayRect(int32_t iDay, CFX_RectF& rtDay);
- typedef struct _DATE {
- _DATE() {
- iYear = 0;
- iMonth = 0;
- iDay = 0;
- }
- _DATE(int32_t year, int32_t month, int32_t day)
- : iYear(year), iMonth(month), iDay(day) {}
- FX_BOOL operator<(const _DATE& right) {
- if (iYear < right.iYear) {
- return TRUE;
- } else if (iYear == right.iYear) {
- if (iMonth < right.iMonth) {
- return TRUE;
- } else if (iMonth == right.iMonth) {
- return iDay < right.iDay;
- }
- }
- return FALSE;
- }
- FX_BOOL operator>(const _DATE& right) {
- if (iYear > right.iYear) {
- return TRUE;
- } else if (iYear == right.iYear) {
- if (iMonth > right.iMonth) {
- return TRUE;
- } else if (iMonth == right.iMonth) {
- return iDay > right.iDay;
- }
- }
- return FALSE;
- }
- int32_t iYear;
- int32_t iMonth;
- int32_t iDay;
- } DATE, *LPDATE;
FX_BOOL m_bInit;
CFX_RectF m_rtHead;
CFX_RectF m_rtWeek;
@@ -177,8 +173,7 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp {
CFX_SizeF m_szHead;
CFX_SizeF m_szCell;
CFX_SizeF m_szToday;
- typedef CFX_ArrayTemplate<int32_t> CFWL_Int32Array;
- CFWL_Int32Array m_arrSelDays;
+ CFX_ArrayTemplate<int32_t> m_arrSelDays;
int32_t m_iMaxSel;
CFX_RectF m_rtClient;
FX_FLOAT m_fHeadWid;
@@ -193,32 +188,29 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp {
FX_FLOAT m_fHeadTextVMargin;
FX_FLOAT m_fHSepWid;
FX_FLOAT m_fHSepHei;
-
FX_FLOAT m_fWeekNumWid;
FX_FLOAT m_fSepDOffset;
FX_FLOAT m_fSepX;
FX_FLOAT m_fSepY;
-
FX_FLOAT m_fWeekNumHeigh;
FX_FLOAT m_fWeekWid;
FX_FLOAT m_fWeekHei;
FX_FLOAT m_fDateCellWid;
FX_FLOAT m_fDateCellHei;
-
FX_FLOAT m_fTodayWid;
FX_FLOAT m_fTodayHei;
FX_FLOAT m_fTodayFlagWid;
-
FX_FLOAT m_fMCWid;
FX_FLOAT m_fMCHei;
friend class CFWL_MonthCalendarImpDelegate;
};
-typedef struct _DATEINFO {
- _DATEINFO(int32_t day,
- int32_t dayofweek,
- FX_DWORD dwSt,
- CFX_RectF rc,
- CFX_WideString& wsday)
+
+struct FWL_DATEINFO {
+ FWL_DATEINFO(int32_t day,
+ int32_t dayofweek,
+ FX_DWORD dwSt,
+ CFX_RectF rc,
+ CFX_WideString& wsday)
: iDay(day),
iDayOfWeek(dayofweek),
dwStates(dwSt),
@@ -229,7 +221,8 @@ typedef struct _DATEINFO {
FX_DWORD dwStates;
CFX_RectF rect;
CFX_WideString wsDay;
-} DATEINFO, *LPDATEINFO;
+};
+
class CFWL_MonthCalendarImpDelegate : public CFWL_WidgetImpDelegate {
public:
CFWL_MonthCalendarImpDelegate(CFWL_MonthCalendarImp* pOwner);
diff --git a/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp b/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp
index 866d6a6a08..9464776a68 100644
--- a/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp
@@ -856,13 +856,15 @@ void CFWL_WidgetMgrDelegate::DrawWidgetAfter(IFWL_Widget* pWidget,
CFWL_WidgetMgrItem* pItem = m_pWidgetMgr->GetWidgetMgrItem(pWidget);
pItem->iRedrawCounter = 0;
}
+
#define FWL_NEEDREPAINTHIT_Point 12
#define FWL_NEEDREPAINTHIT_Piece 3
-typedef struct _FWL_NeedRepaintHitData {
+struct FWL_NEEDREPAINTHITDATA {
CFX_PointF hitPoint;
FX_BOOL bNotNeedRepaint;
FX_BOOL bNotContainByDirty;
-} FWL_NeedRepaintHitData;
+};
+
FX_BOOL CFWL_WidgetMgrDelegate::IsNeedRepaint(IFWL_Widget* pWidget,
CFX_Matrix* pMatrix,
const CFX_RectF& rtDirty) {
@@ -900,8 +902,8 @@ FX_BOOL CFWL_WidgetMgrDelegate::IsNeedRepaint(IFWL_Widget* pWidget,
FX_BOOL bOrginPtIntersectWidthChild = FALSE;
FX_BOOL bOrginPtIntersectWidthDirty =
rtDirty.Contains(rtWidget.left, rtWidget.top);
- static FWL_NeedRepaintHitData hitPoint[FWL_NEEDREPAINTHIT_Point];
- static int32_t iSize = sizeof(FWL_NeedRepaintHitData);
+ static FWL_NEEDREPAINTHITDATA hitPoint[FWL_NEEDREPAINTHIT_Point];
+ int32_t iSize = sizeof(FWL_NEEDREPAINTHITDATA);
FXSYS_memset(hitPoint, 0, iSize);
FX_FLOAT fxPiece = rtWidget.width / FWL_NEEDREPAINTHIT_Piece;
FX_FLOAT fyPiece = rtWidget.height / FWL_NEEDREPAINTHIT_Piece;