summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/cfwl_monthcalendar.h
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-23 16:03:10 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-23 16:03:10 -0800
commit0ce11eef157b791c661d7e82e1c5641605b9f03d (patch)
treee5166163947824e52c417b4a65c2c7d965c00dad /xfa/fwl/core/cfwl_monthcalendar.h
parent2430b30088c3e3396ccf26a10d360d0553404bb0 (diff)
downloadpdfium-0ce11eef157b791c661d7e82e1c5641605b9f03d.tar.xz
Rename IFWL classes which do not have CFWL equivalents
This CL moves the IFWL classes that do not have CFWL class buddies to have the CFWL name. This CL leaves the tree in a weird state of having CFWL be two hierarchies, one of which is intertwined with the IFWL hierarchy. This should be commited just before the CL to move the rest of IFWL to CFWL. Review-Url: https://codereview.chromium.org/2525083002
Diffstat (limited to 'xfa/fwl/core/cfwl_monthcalendar.h')
-rw-r--r--xfa/fwl/core/cfwl_monthcalendar.h228
1 files changed, 228 insertions, 0 deletions
diff --git a/xfa/fwl/core/cfwl_monthcalendar.h b/xfa/fwl/core/cfwl_monthcalendar.h
new file mode 100644
index 0000000000..1acdf5c977
--- /dev/null
+++ b/xfa/fwl/core/cfwl_monthcalendar.h
@@ -0,0 +1,228 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FWL_CORE_CFWL_MONTHCALENDAR_H_
+#define XFA_FWL_CORE_CFWL_MONTHCALENDAR_H_
+
+#include <memory>
+
+#include "xfa/fgas/localization/fgas_datetime.h"
+#include "xfa/fwl/core/cfwl_event.h"
+#include "xfa/fwl/core/cfwl_widgetproperties.h"
+#include "xfa/fwl/core/ifwl_widget.h"
+
+#define FWL_STYLEEXT_MCD_MultiSelect (1L << 0)
+#define FWL_STYLEEXT_MCD_NoToday (1L << 1)
+#define FWL_STYLEEXT_MCD_NoTodayCircle (1L << 2)
+#define FWL_STYLEEXT_MCD_WeekNumbers (1L << 3)
+#define FWL_ITEMSTATE_MCD_Nomal (0L << 0)
+#define FWL_ITEMSTATE_MCD_Flag (1L << 0)
+#define FWL_ITEMSTATE_MCD_Selected (1L << 1)
+#define FWL_ITEMSTATE_MCD_Focused (1L << 2)
+
+class CFWL_MsgMouse;
+class IFWL_Widget;
+
+class CFWL_MonthCalendar : public IFWL_Widget {
+ public:
+ CFWL_MonthCalendar(const CFWL_App* app,
+ std::unique_ptr<CFWL_WidgetProperties> properties,
+ IFWL_Widget* pOuter);
+ ~CFWL_MonthCalendar() override;
+
+ // FWL_WidgetImp
+ FWL_Type GetClassID() const override;
+ void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override;
+ void Update() override;
+ void DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
+ void OnProcessMessage(CFWL_Message* pMessage) override;
+ void OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) override;
+
+ void SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay);
+
+ private:
+ 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) {}
+
+ bool operator<(const DATE& right) {
+ if (iYear < right.iYear)
+ return true;
+ if (iYear == right.iYear) {
+ if (iMonth < right.iMonth)
+ return true;
+ if (iMonth == right.iMonth)
+ return iDay < right.iDay;
+ }
+ return false;
+ }
+
+ bool operator>(const DATE& right) {
+ if (iYear > right.iYear)
+ return true;
+ if (iYear == right.iYear) {
+ if (iMonth > right.iMonth)
+ return true;
+ if (iMonth == right.iMonth)
+ return iDay > right.iDay;
+ }
+ return false;
+ }
+
+ int32_t iYear;
+ int32_t iMonth;
+ int32_t iDay;
+ };
+ struct DATEINFO {
+ DATEINFO(int32_t day,
+ int32_t dayofweek,
+ uint32_t dwSt,
+ CFX_RectF rc,
+ CFX_WideString& wsday);
+ ~DATEINFO();
+
+ int32_t iDay;
+ int32_t iDayOfWeek;
+ uint32_t dwStates;
+ CFX_RectF rect;
+ CFX_WideString wsDay;
+ };
+
+ void DrawBackground(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix);
+ void DrawHeadBK(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix);
+ void DrawLButton(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix);
+ void DrawRButton(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix);
+ void DrawCaption(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix);
+ void DrawSeperator(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix);
+ void DrawDatesInBK(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix);
+ void DrawWeek(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix);
+ void DrawWeekNumber(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix);
+ void DrawWeekNumberSep(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix);
+ void DrawToday(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix);
+ void DrawDatesIn(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix);
+ void DrawDatesOut(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix);
+ void DrawDatesInCircle(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix);
+ CFX_SizeF CalcSize(bool bAutoSize = false);
+ void Layout();
+ void CalcHeadSize();
+ void CalcTodaySize();
+ void CalDateItem();
+ void GetCapValue();
+ void InitDate();
+ void ClearDateItem();
+ void ResetDateItem();
+ void NextMonth();
+ void PrevMonth();
+ void ChangeToMonth(int32_t iYear, int32_t iMonth);
+ void RemoveSelDay(int32_t iDay, bool bAll = false);
+ void AddSelDay(int32_t iDay);
+ void JumpToToday();
+ void GetHeadText(int32_t iYear, int32_t iMonth, CFX_WideString& wsHead);
+ void GetTodayText(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay,
+ CFX_WideString& wsToday);
+ int32_t GetDayAtPoint(FX_FLOAT x, FX_FLOAT y);
+ void GetDayRect(int32_t iDay, CFX_RectF& rtDay);
+ void OnLButtonDown(CFWL_MsgMouse* pMsg);
+ void OnLButtonUp(CFWL_MsgMouse* pMsg);
+ void DisForm_OnLButtonUp(CFWL_MsgMouse* pMsg);
+ void OnMouseMove(CFWL_MsgMouse* pMsg);
+ void OnMouseLeave(CFWL_MsgMouse* pMsg);
+
+ bool m_bInitialized;
+ CFX_RectF m_rtHead;
+ CFX_RectF m_rtWeek;
+ CFX_RectF m_rtLBtn;
+ CFX_RectF m_rtRBtn;
+ CFX_RectF m_rtDates;
+ CFX_RectF m_rtHSep;
+ CFX_RectF m_rtHeadText;
+ CFX_RectF m_rtToday;
+ CFX_RectF m_rtTodayFlag;
+ CFX_RectF m_rtWeekNum;
+ CFX_RectF m_rtWeekNumSep;
+ CFX_WideString m_wsHead;
+ CFX_WideString m_wsToday;
+ std::unique_ptr<CFX_DateTime> m_pDateTime;
+ CFX_ArrayTemplate<DATEINFO*> m_arrDates;
+ int32_t m_iCurYear;
+ int32_t m_iCurMonth;
+ int32_t m_iYear;
+ int32_t m_iMonth;
+ int32_t m_iDay;
+ int32_t m_iHovered;
+ int32_t m_iLBtnPartStates;
+ int32_t m_iRBtnPartStates;
+ DATE m_dtMin;
+ DATE m_dtMax;
+ CFX_SizeF m_szHead;
+ CFX_SizeF m_szCell;
+ CFX_SizeF m_szToday;
+ CFX_ArrayTemplate<int32_t> m_arrSelDays;
+ CFX_RectF m_rtClient;
+ FX_FLOAT m_fHeadWid;
+ FX_FLOAT m_fHeadHei;
+ FX_FLOAT m_fHeadBtnWid;
+ FX_FLOAT m_fHeadBtnHei;
+ FX_FLOAT m_fHeadBtnHMargin;
+ FX_FLOAT m_fHeadBtnVMargin;
+ FX_FLOAT m_fHeadTextWid;
+ FX_FLOAT m_fHeadTextHei;
+ FX_FLOAT m_fHeadTextHMargin;
+ 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;
+ bool m_bFlag;
+};
+
+#endif // XFA_FWL_CORE_CFWL_MONTHCALENDAR_H_