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 NWEB_DATE_TIME_CHOOSER_H 17 #define NWEB_DATE_TIME_CHOOSER_H 18 19 #include <memory> 20 #include <string> 21 #include <vector> 22 23 namespace OHOS::NWeb { 24 struct DateTime { 25 int32_t year; 26 int32_t month; 27 int32_t day; 28 int32_t hour; 29 int32_t minute; 30 int32_t second; 31 }; 32 33 struct DateTimeSuggestion { 34 DateTime value; 35 std::string localizedValue; 36 std::string label; 37 }; 38 39 enum DateTimeChooserType { 40 DTC_DATE, 41 DTC_DATETIME, 42 DTC_DATETIME_LOCAL, 43 DTC_TIME, 44 DTC_MONTH, 45 DTC_WEEK, 46 DTC_UNKNOWN 47 }; 48 49 struct DateTimeChooser { 50 DateTimeChooserType type; 51 DateTime dialogValue; 52 DateTime minimum; 53 DateTime maximum; 54 double step; 55 size_t suggestionIndex = 0; 56 bool hasSelected = false; 57 }; 58 59 class NWebDateTimeChooserCallback { 60 public: 61 virtual ~NWebDateTimeChooserCallback() = default; 62 63 virtual void Continue(bool success, const DateTime& value) = 0; 64 }; 65 } 66 #endif