1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_CALENDAR_CALENDAR_COMPONENT_V2_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_CALENDAR_CALENDAR_COMPONENT_V2_H
18 
19 #include "core/components/calendar/calendar_component.h"
20 #include "core/components/calendar/calendar_controller_v2.h"
21 #include "core/components_v2/common/common_def.h"
22 
23 namespace OHOS::Ace {
24 
25 class ACE_EXPORT CalendarComponentV2 : public CalendarComponent {
26     DECLARE_ACE_TYPE(CalendarComponentV2, CalendarComponent);
27 
28 public:
CalendarComponentV2(const ComposeId & id,const std::string & name)29     CalendarComponentV2(const ComposeId& id, const std::string& name) : CalendarComponent(id, name) {}
30     ~CalendarComponentV2() override = default;
31 
GetObtainedMonths()32     std::queue<ObtainedMonth>&& GetObtainedMonths()
33     {
34         return std::move(obtainedMonths_);
35     }
36 
SetCalendarData(const ObtainedMonth & days)37     void SetCalendarData(const ObtainedMonth& days)
38     {
39         obtainedMonths_.emplace(days);
40     }
41 
GetCalendarTheme()42     const RefPtr<CalendarTheme>& GetCalendarTheme()
43     {
44         return calendarTheme_;
45     }
46 
SetCalendarTheme(const RefPtr<CalendarTheme> & calendarTheme)47     void SetCalendarTheme(const RefPtr<CalendarTheme>& calendarTheme)
48     {
49         calendarTheme_ = calendarTheme;
50     }
51 
SetControllerV2(const RefPtr<CalendarControllerV2> & controllerV2)52     void SetControllerV2(const RefPtr<CalendarControllerV2>& controllerV2)
53     {
54         controllerV2_ = controllerV2;
55     }
56 
GetControllerV2()57     const RefPtr<CalendarControllerV2>& GetControllerV2()
58     {
59         return controllerV2_;
60     }
61 
62 private:
63     std::queue<ObtainedMonth> obtainedMonths_;
64     RefPtr<CalendarTheme> calendarTheme_;
65     RefPtr<CalendarControllerV2> controllerV2_;
66 };
67 
68 } // namespace OHOS::Ace
69 
70 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_CALENDAR_CALENDAR_COMPONENT_V2_H
71