1 /* 2 * Copyright (c) 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_PATTERN_PICKER_PICKER_MODEL_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_PICKER_PICKER_MODEL_H 18 19 #include "core/components/picker/picker_data.h" 20 #include "core/components/picker/picker_theme.h" 21 22 namespace OHOS::Ace { 23 using DateChangeEvent = std::function<void(const BaseEventInfo* info)>; 24 class DatePickerModel { 25 public: 26 static DatePickerModel* GetInstance(); 27 virtual ~DatePickerModel() = default; 28 29 virtual void CreateDatePicker(RefPtr<PickerTheme> theme) = 0; 30 virtual void CreateTimePicker(RefPtr<PickerTheme> theme) = 0; 31 virtual void SetStartDate(const PickerDate& value) = 0; 32 virtual void SetEndDate(const PickerDate& value) = 0; 33 virtual void SetSelectedDate(const PickerDate& value) = 0; 34 virtual void SetShowLunar(bool lunar) = 0; 35 virtual void SetOnChange(DateChangeEvent&& onChange) = 0; 36 virtual void SetSelectedTime(const PickerTime& selectedTime) = 0; 37 virtual void SetHour24(bool value) = 0; 38 private: 39 static std::unique_ptr<DatePickerModel> datePickerInstance_; 40 }; 41 } // namespace OHOS::Ace 42 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_PICKER_PICKER_MODEL_H 43