1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef _FWL_MONTHCALENDAR_H
8 #define _FWL_MONTHCALENDAR_H
9 class IFWL_MonthCalendarDP;
10 class IFWL_MonthCalendar;
11 #define FWL_CLASS_MonthCalendar L"FWL_MONTHCALENDAR"
12 #define FWL_CLASSHASH_MonthCalendar 2733931374
13 #define FWL_STYLEEXT_MCD_MultiSelect (1L << 0)
14 #define FWL_STYLEEXT_MCD_NoToday (1L << 1)
15 #define FWL_STYLEEXT_MCD_NoTodayCircle (1L << 2)
16 #define FWL_STYLEEXT_MCD_WeekNumbers (1L << 3)
17 #define FWL_WGTCAPACITY_MC_HEADER_WIDTH 12
18 #define FWL_WGTCAPACITY_MC_HEADER_Height 13
19 #define FWL_WGTCAPACITY_MC_HEADER_BTN_WIDTH 14
20 #define FWL_WGTCAPACITY_MC_HEADER_BTN_HEIGHT 15
21 #define FWL_WGTCAPACITY_MC_HEADER_BTN_HMARGIN 16
22 #define FWL_WGTCAPACITY_MC_HEADER_BTN_VMARGIN 17
23 #define FWL_WGTCAPACITY_MC_HEADER_TEXTWIDHT 18
24 #define FWL_WGTCAPACITY_MC_HEADER_TEXTHEIGHT 19
25 #define FWL_WGTCAPACITY_MC_HEADER_TEXT_HMARGIN 20
26 #define FWL_WGTCAPACITY_MC_HEADER_TEXT_VMARGIN 21
27 #define FWL_WGTCAPACITY_MC_HSEP_WIDTH 22
28 #define FWL_WGTCAPACITY_MC_HSEP_HEIGHT 23
29 #define FWL_WGTCAPACITY_MC_VSEP_WIDTH 24
30 #define FWL_WGTCAPACITY_MC_VSEP_HEIGHT 25
31 #define FWL_WGTCAPACITY_MC_WEEKNUM_WIDTH 26
32 #define FWL_WGTCAPACITY_MC_SEP_DOFFSET 40
33 #define FWL_WGTCAPACITY_MC_SEP_X 27
34 #define FWL_WGTCAPACITY_MC_SEP_Y 28
35 #define FWL_WGTCAPACITY_MC_WEEKNUM_HEIGHT 29
36 #define FWL_WGTCAPACITY_MC_WEEK_WIDTH 30
37 #define FWL_WGTCAPACITY_MC_WEEK_HEIGHT 31
38 #define FWL_WGTCAPACITY_MC_DATES_CELL_WIDTH 32
39 #define FWL_WGTCAPACITY_MC_DATES_CELL_HEIGHT 33
40 #define FWL_WGTCAPACITY_MC_TODAY_WIDHT 34
41 #define FWL_WGTCAPACITY_MC_TODAY_HEIGHT 35
42 #define FWL_WGTCAPACITY_MC_TODAY_FLAG_WIDHT 36
43 #define FWL_WGTCAPACITY_MC_WIDTH 37
44 #define FWL_WGTCAPACITY_MC_HEIGHT 38
45 #define FWL_ITEMSTATE_MCD_Nomal (0L << 0)
46 #define FWL_ITEMSTATE_MCD_Flag (1L << 0)
47 #define FWL_ITEMSTATE_MCD_Selected (1L << 1)
48 #define FWL_ITEMSTATE_MCD_Focused (1L << 2)
49 #define FWL_PART_MCD_Border 1
50 #define FWL_PART_MCD_Edge 2
51 #define FWL_PART_MCD_Background 3
52 #define FWL_PART_MCD_LBtn 4
53 #define FWL_PART_MCD_RBtn 5
54 #define FWL_PART_MCD_HSeparator 6
55 #define FWL_PART_MCD_VSeparator 7
56 #define FWL_PART_MCD_TodayCircle 8
57 #define FWL_PART_MCD_DateInCircle 9
58 #define FWL_PART_MCD_DateInBK 10
59 #define FWL_PART_MCD_Caption 9
60 #define FWL_PART_MCD_DatesIn 10
61 #define FWL_PART_MCD_DatesOut 11
62 #define FWL_PART_MCD_Week 12
63 #define FWL_PART_MCD_Today 13
64 #define FWL_PART_MCD_Header 14
65 #define FWL_PART_MCD_WeekNum 15
66 #define FWL_PART_MCD_WeekNumSep 16
67 #define FWL_PARTSTATE_MCD_Normal (0L << 0)
68 #define FWL_PARTSTATE_MCD_Pressed (1L << 0)
69 #define FWL_PARTSTATE_MCD_Hovered (2L << 0)
70 #define FWL_PARTSTATE_MCD_Selected (3L << 0)
71 #define FWL_PARTSTATE_MCD_LSelected (1L << 2)
72 #define FWL_PARTSTATE_MCD_RSelected (2L << 2)
73 #define FWL_PARTSTATE_MCD_Flagged (1L << 3)
74 #define FWL_PARTSTATE_MCD_Focused (1L << 4)
75 #define FWL_MCCAPACITY_Sun FWL_WGTCAPACITY_MAX + 5
76 #define FWL_MCCAPACITY_Mon FWL_WGTCAPACITY_MAX + 6
77 #define FWL_MCCAPACITY_Tue FWL_WGTCAPACITY_MAX + 7
78 #define FWL_MCCAPACITY_Wed FWL_WGTCAPACITY_MAX + 8
79 #define FWL_MCCAPACITY_Thu FWL_WGTCAPACITY_MAX + 9
80 #define FWL_MCCAPACITY_Fri FWL_WGTCAPACITY_MAX + 10
81 #define FWL_MCCAPACITY_Sat FWL_WGTCAPACITY_MAX + 11
82 #define FWL_MCCAPACITY_January FWL_WGTCAPACITY_MAX + 12
83 #define FWL_MCCAPACITY_February FWL_WGTCAPACITY_MAX + 13
84 #define FWL_MCCAPACITY_March FWL_WGTCAPACITY_MAX + 14
85 #define FWL_MCCAPACITY_April FWL_WGTCAPACITY_MAX + 15
86 #define FWL_MCCAPACITY_May FWL_WGTCAPACITY_MAX + 16
87 #define FWL_MCCAPACITY_June FWL_WGTCAPACITY_MAX + 17
88 #define FWL_MCCAPACITY_July FWL_WGTCAPACITY_MAX + 18
89 #define FWL_MCCAPACITY_August FWL_WGTCAPACITY_MAX + 19
90 #define FWL_MCCAPACITY_September FWL_WGTCAPACITY_MAX + 20
91 #define FWL_MCCAPACITY_October FWL_WGTCAPACITY_MAX + 21
92 #define FWL_MCCAPACITY_November FWL_WGTCAPACITY_MAX + 22
93 #define FWL_MCCAPACITY_December FWL_WGTCAPACITY_MAX + 23
94 #define FWL_MCCAPACITY_Today FWL_WGTCAPACITY_MAX + 24
95 #define FWL_EVENT_MCD_DATESELECTED L"FWL_EVENT_MCD_DateSelected"
96 #define FWL_EVT_MCD_DateChanged L"FWL_EVENT_MCD_DateChanged"
97 #define FWL_NOTEHASH_MCD_DATASELECTED 1085596932
98 #define FWL_EVTHASH_MCD_DateChanged 54212227
99 BEGIN_FWL_EVENT_DEF(CFWL_Event_McdDateSelected, FWL_NOTEHASH_MCD_DATASELECTED)
100 int32_t m_iStartDay;
101 int32_t m_iEndDay;
102 END_FWL_EVENT_DEF
103 BEGIN_FWL_EVENT_DEF(CFWL_EventMcdDateChanged, FWL_EVTHASH_MCD_DateChanged)
104 int32_t m_iOldYear;
105 int32_t m_iOldMonth;
106 int32_t m_iStartDay;
107 int32_t m_iEndDay;
108 END_FWL_EVENT_DEF
109 class IFWL_MonthCalendarDP : public IFWL_DataProvider {
110  public:
111   virtual int32_t GetCurDay(IFWL_Widget* pWidget) = 0;
112   virtual int32_t GetCurMonth(IFWL_Widget* pWidget) = 0;
113   virtual int32_t GetCurYear(IFWL_Widget* pWidget) = 0;
114 };
115 class IFWL_MonthCalendar : public IFWL_Widget {
116  public:
117   static IFWL_MonthCalendar* Create(const CFWL_WidgetImpProperties& properties,
118                                     IFWL_Widget* pOuter);
119 
120   int32_t CountSelect();
121   FX_BOOL GetSelect(int32_t& iYear,
122                     int32_t& iMonth,
123                     int32_t& iDay,
124                     int32_t nIndex = 0);
125   FX_BOOL SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay);
126 
127  protected:
128   IFWL_MonthCalendar();
129 };
130 #endif
131