summaryrefslogtreecommitdiff
path: root/xfa/fwl/basewidget/ifwl_monthcalendar.h
blob: ad3ce1d62ebf65b61bf68c0149e45173e1e9fca3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// 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_BASEWIDGET_IFWL_MONTHCALENDAR_H_
#define XFA_FWL_BASEWIDGET_IFWL_MONTHCALENDAR_H_

#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fwl/core/cfwl_event.h"
#include "xfa/fwl/core/ifwl_dataprovider.h"
#include "xfa/fwl/core/cfwl_widgetimpproperties.h"

#define FWL_CLASS_MonthCalendar L"FWL_MONTHCALENDAR"
#define FWL_CLASSHASH_MonthCalendar 2733931374
#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)
#define FWL_NOTEHASH_MCD_DATASELECTED 1085596932
// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474
#define FWL_EVTHASH_MCD_DateChanged 54212227

BEGIN_FWL_EVENT_DEF(CFWL_Event_McdDateSelected, FWL_NOTEHASH_MCD_DATASELECTED)
int32_t m_iStartDay;
int32_t m_iEndDay;
END_FWL_EVENT_DEF

BEGIN_FWL_EVENT_DEF(CFWL_EventMcdDateChanged, FWL_EVTHASH_MCD_DateChanged)
int32_t m_iOldYear;
int32_t m_iOldMonth;
int32_t m_iStartDay;
int32_t m_iEndDay;
END_FWL_EVENT_DEF

class IFWL_MonthCalendarDP : public IFWL_DataProvider {
 public:
  virtual int32_t GetCurDay(IFWL_Widget* pWidget) = 0;
  virtual int32_t GetCurMonth(IFWL_Widget* pWidget) = 0;
  virtual int32_t GetCurYear(IFWL_Widget* pWidget) = 0;
};

class IFWL_MonthCalendar : public IFWL_Widget {
 public:
  static IFWL_MonthCalendar* Create(const CFWL_WidgetImpProperties& properties,
                                    IFWL_Widget* pOuter);

  int32_t CountSelect();
  FX_BOOL GetSelect(int32_t& iYear,
                    int32_t& iMonth,
                    int32_t& iDay,
                    int32_t nIndex = 0);
  FX_BOOL SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay);

 protected:
  IFWL_MonthCalendar();
};

#endif  // XFA_FWL_BASEWIDGET_IFWL_MONTHCALENDAR_H_