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

Side by Side Diff: xfa/fwl/core/ifwl_datetimepicker.h

Issue 2480233003: Fold DataProviders into parent classes (Closed)
Patch Set: Review feedback Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/fwl_noteimp.cpp ('k') | xfa/fwl/core/ifwl_datetimepicker.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ 7 #ifndef XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_
8 #define XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ 8 #define XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_
9 9
10 #include "xfa/fwl/core/cfwl_event.h" 10 #include "xfa/fwl/core/cfwl_event.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 int32_t iDay;) 53 int32_t iDay;)
54 54
55 class IFWL_DateTimePickerDP : public IFWL_DataProvider { 55 class IFWL_DateTimePickerDP : public IFWL_DataProvider {
56 public: 56 public:
57 virtual FWL_Error GetToday(IFWL_Widget* pWidget, 57 virtual FWL_Error GetToday(IFWL_Widget* pWidget,
58 int32_t& iYear, 58 int32_t& iYear,
59 int32_t& iMonth, 59 int32_t& iMonth,
60 int32_t& iDay) = 0; 60 int32_t& iDay) = 0;
61 }; 61 };
62 62
63 class IFWL_DateTimePicker : public IFWL_Widget { 63 class IFWL_DateTimePicker : public IFWL_Widget, public IFWL_MonthCalendarDP {
64 public: 64 public:
65 explicit IFWL_DateTimePicker( 65 explicit IFWL_DateTimePicker(
66 const IFWL_App* app, 66 const IFWL_App* app,
67 std::unique_ptr<CFWL_WidgetProperties> properties); 67 std::unique_ptr<CFWL_WidgetProperties> properties);
68 ~IFWL_DateTimePicker() override; 68 ~IFWL_DateTimePicker() override;
69 69
70 // IFWL_Widget 70 // IFWL_Widget
71 FWL_Type GetClassID() const override; 71 FWL_Type GetClassID() const override;
72 FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; 72 FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override;
73 FWL_Error Update() override; 73 FWL_Error Update() override;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, 106 FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded,
107 uint32_t dwStylesExRemoved); 107 uint32_t dwStylesExRemoved);
108 IFWL_DateTimeEdit* GetDataTimeEdit(); 108 IFWL_DateTimeEdit* GetDataTimeEdit();
109 109
110 bool IsMonthCalendarShowed(); 110 bool IsMonthCalendarShowed();
111 void ShowMonthCalendar(bool bActivate); 111 void ShowMonthCalendar(bool bActivate);
112 void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay); 112 void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay);
113 113
114 IFWL_FormProxy* GetFormProxy() const { return m_pForm.get(); } 114 IFWL_FormProxy* GetFormProxy() const { return m_pForm.get(); }
115 115
116 // IFWL_DataProvider
117 FWL_Error GetCaption(IFWL_Widget* pWidget,
118 CFX_WideString& wsCaption) override;
119
120 // IFWL_MonthCalendarDP
121 int32_t GetCurDay(IFWL_Widget* pWidget) override;
122 int32_t GetCurMonth(IFWL_Widget* pWidget) override;
123 int32_t GetCurYear(IFWL_Widget* pWidget) override;
124
116 protected: 125 protected:
117 class CFWL_MonthCalendarImpDP : public IFWL_MonthCalendarDP {
118 public:
119 CFWL_MonthCalendarImpDP();
120
121 // IFWL_DataProvider
122 FWL_Error GetCaption(IFWL_Widget* pWidget,
123 CFX_WideString& wsCaption) override;
124
125 // IFWL_MonthCalendarDP
126 int32_t GetCurDay(IFWL_Widget* pWidget) override;
127 int32_t GetCurMonth(IFWL_Widget* pWidget) override;
128 int32_t GetCurYear(IFWL_Widget* pWidget) override;
129
130 int32_t m_iCurDay;
131 int32_t m_iCurYear;
132 int32_t m_iCurMonth;
133 };
134
135 void DrawDropDownButton(CFX_Graphics* pGraphics, 126 void DrawDropDownButton(CFX_Graphics* pGraphics,
136 IFWL_ThemeProvider* pTheme, 127 IFWL_ThemeProvider* pTheme,
137 const CFX_Matrix* pMatrix); 128 const CFX_Matrix* pMatrix);
138 void FormatDateString(int32_t iYear, 129 void FormatDateString(int32_t iYear,
139 int32_t iMonth, 130 int32_t iMonth,
140 int32_t iDay, 131 int32_t iDay,
141 CFX_WideString& wsText); 132 CFX_WideString& wsText);
142 void ReSetEditAlignment(); 133 void ReSetEditAlignment();
143 void InitProxyForm(); 134 void InitProxyForm();
144 135
145 CFX_RectF m_rtBtn; 136 CFX_RectF m_rtBtn;
146 CFX_RectF m_rtClient; 137 CFX_RectF m_rtClient;
147 int32_t m_iBtnState; 138 int32_t m_iBtnState;
148 int32_t m_iYear; 139 int32_t m_iYear;
149 int32_t m_iMonth; 140 int32_t m_iMonth;
150 int32_t m_iDay; 141 int32_t m_iDay;
151 bool m_bLBtnDown; 142 bool m_bLBtnDown;
152 std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; 143 std::unique_ptr<IFWL_DateTimeEdit> m_pEdit;
153 std::unique_ptr<IFWL_DateTimeCalendar> m_pMonthCal; 144 std::unique_ptr<IFWL_DateTimeCalendar> m_pMonthCal;
154 std::unique_ptr<IFWL_FormProxy> m_pForm; 145 std::unique_ptr<IFWL_FormProxy> m_pForm;
155 FX_FLOAT m_fBtn; 146 FX_FLOAT m_fBtn;
156 CFWL_MonthCalendarImpDP m_MonthCalendarDP;
157 147
158 private: 148 private:
159 FWL_Error DisForm_Initialize(); 149 FWL_Error DisForm_Initialize();
160 void DisForm_InitDateTimeCalendar(); 150 void DisForm_InitDateTimeCalendar();
161 void DisForm_InitDateTimeEdit(); 151 void DisForm_InitDateTimeEdit();
162 bool DisForm_IsMonthCalendarShowed(); 152 bool DisForm_IsMonthCalendarShowed();
163 void DisForm_ShowMonthCalendar(bool bActivate); 153 void DisForm_ShowMonthCalendar(bool bActivate);
164 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); 154 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy);
165 bool DisForm_IsNeedShowButton(); 155 bool DisForm_IsNeedShowButton();
166 FWL_Error DisForm_Update(); 156 FWL_Error DisForm_Update();
167 FWL_Error DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); 157 FWL_Error DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false);
168 FWL_Error DisForm_GetBBox(CFX_RectF& rect); 158 FWL_Error DisForm_GetBBox(CFX_RectF& rect);
169 FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, 159 FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics,
170 const CFX_Matrix* pMatrix = nullptr); 160 const CFX_Matrix* pMatrix = nullptr);
171 161
172 void OnFocusChanged(CFWL_Message* pMsg, bool bSet); 162 void OnFocusChanged(CFWL_Message* pMsg, bool bSet);
173 void OnLButtonDown(CFWL_MsgMouse* pMsg); 163 void OnLButtonDown(CFWL_MsgMouse* pMsg);
174 void OnLButtonUp(CFWL_MsgMouse* pMsg); 164 void OnLButtonUp(CFWL_MsgMouse* pMsg);
175 void OnMouseMove(CFWL_MsgMouse* pMsg); 165 void OnMouseMove(CFWL_MsgMouse* pMsg);
176 void OnMouseLeave(CFWL_MsgMouse* pMsg); 166 void OnMouseLeave(CFWL_MsgMouse* pMsg);
177 void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet); 167 void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet);
168
169 int32_t m_iCurYear;
170 int32_t m_iCurMonth;
171 int32_t m_iCurDay;
178 }; 172 };
179 173
180 #endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ 174 #endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_noteimp.cpp ('k') | xfa/fwl/core/ifwl_datetimepicker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698