• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 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_NG_PATTERNS_DATE_PICKER_DATE_PICKER_MODEL_NG_VIEW_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_DATE_PICKER_DATE_PICKER_MODEL_NG_VIEW_H
18 #include "base/utils/macros.h"
19 #include "core/components/common/layout/constants.h"
20 #include "core/components/picker/picker_base_component.h"
21 #include "core/components_ng/pattern/picker/datepicker_event_hub.h"
22 #include "core/components_ng/pattern/picker/datepicker_layout_property.h"
23 #include "core/components_ng/pattern/picker/picker_model.h"
24 
25 namespace OHOS::Ace::NG {
26 class ACE_EXPORT DatePickerModelNG : public DatePickerModel {
27 public:
28     void CreateDatePicker(RefPtr<PickerTheme> theme) override;
CreateTimePicker(RefPtr<PickerTheme> theme)29     void CreateTimePicker(RefPtr<PickerTheme> theme) override {};
30     void SetStartDate(const PickerDate& value) override;
31     void SetEndDate(const PickerDate& value) override;
32     void SetSelectedDate(const PickerDate& value) override;
33     void SetShowLunar(bool lunar) override;
34     void SetOnChange(DateChangeEvent&& onChange) override;
35     void SetOnDateChange(DateChangeEvent&& onChange) override;
SetSelectedTime(const PickerTime & selectedTime)36     void SetSelectedTime(const PickerTime& selectedTime) override {};
SetHour24(bool value)37     void SetHour24(bool value) override {};
38     void SetDisappearTextStyle(const RefPtr<PickerTheme>& theme, const PickerTextStyle& value) override;
39     void SetNormalTextStyle(const RefPtr<PickerTheme>& theme, const PickerTextStyle& value) override;
40     void SetSelectedTextStyle(const RefPtr<PickerTheme>& theme, const PickerTextStyle& value) override;
41     void SetBackgroundColor(const Color& color) override;
42     void SetChangeEvent(DateChangeEvent&& onChange) override;
43     static void SetSelectedTextStyle(
44         FrameNode* frameNode, const RefPtr<PickerTheme>& theme, const PickerTextStyle& value);
45     static void SetNormalTextStyle(
46         FrameNode* frameNode, const RefPtr<PickerTheme>& theme, const PickerTextStyle& value);
47     static void SetDisappearTextStyle(
48         FrameNode* frameNode, const RefPtr<PickerTheme>& theme, const PickerTextStyle& value);
49     static void SetShowLunar(FrameNode* frameNode, bool lunar);
50     static void SetBackgroundColor(FrameNode* frameNode, const Color& color);
51 
52 private:
53     static RefPtr<FrameNode> CreateStackNode();
54     static RefPtr<FrameNode> CreateButtonNode();
55 };
56 
57 class ACE_EXPORT DatePickerDialogModelNG : public DatePickerDialogModel {
58 public:
59     void SetDatePickerDialogShow(PickerDialogInfo& pickerDialog, NG::DatePickerSettingData& settingData,
60         std::function<void()>&& onCancel, std::function<void(const std::string&)>&& onAccept,
61         std::function<void(const std::string&)>&& onChange, std::function<void(const std::string&)>&& onDateAccept,
62         std::function<void(const std::string&)>&& onDateChange, DatePickerType pickerType) override;
63 };
64 } // namespace OHOS::Ace::NG
65 
66 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_DATE_PICKER_DATE_PICKER_MODEL_NG_VIEW_H
67