• 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_TIME_PICKER_TIME_PICKER_DIALOG_VIEW_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_TIME_PICKER_TIME_PICKER_DIALOG_VIEW_H
18 
19 #include "base/utils/macros.h"
20 #include "core/components/common/layout/constants.h"
21 #include "core/components/picker/picker_base_component.h"
22 #include "core/components_ng/pattern/time_picker/timepicker_row_pattern.h"
23 
24 namespace OHOS::Ace::NG {
25 
26 class ACE_EXPORT TimePickerDialogView {
27 public:
28     static RefPtr<FrameNode> Show(const DialogProperties& dialogProperties, const TimePickerSettingData& settingData,
29         std::map<std::string, PickerTime> timePickerProperty,
30         std::map<std::string, NG::DialogEvent> dialogEvent,
31         std::map<std::string, NG::DialogGestureEvent> dialogCancelEvent);
32     static void SetSelectedTime(const RefPtr<TimePickerRowPattern>& timePickerRowPattern, const PickerTime& value);
33     static void SetDialogTitleDate(const RefPtr<TimePickerRowPattern>& timePickerRowPattern, const PickerDate& value);
34     static void SetHour24(const RefPtr<TimePickerRowPattern>& timePickerRowPattern, bool isUseMilitaryTime = false);
35     static void SetDialogChange(const RefPtr<FrameNode>& frameNode, DialogEvent&& onChange);
36     static RefPtr<FrameNode> CreateButtonNode(const RefPtr<FrameNode>& dateNode,
37         const RefPtr<FrameNode>& timePickerNode,
38         std::map<std::string, NG::DialogEvent> dialogEvent,
39         std::map<std::string, NG::DialogGestureEvent> dialogCancelEvent);
40     static void SetDialogAcceptEvent(const RefPtr<FrameNode>& frameNode, DialogEvent&& onChange);
41     static RefPtr<FrameNode> CreateTitleButtonNode(const RefPtr<FrameNode>& dateNode);
42     static RefPtr<FrameNode> CreateDividerNode(const RefPtr<FrameNode>& dateNode);
43     static RefPtr<FrameNode> CreateConfirmNode(const RefPtr<FrameNode>& dateNode,
44         const RefPtr<FrameNode>& timePickerNode,
45         DialogEvent& acceptEvent);
46     static RefPtr<FrameNode> CreateCancelNode(NG::DialogGestureEvent& cancelEvent,
47         const RefPtr<FrameNode>& timePickerNode);
48     static RefPtr<FrameNode> CreateBoxNode();
49 
50 private:
51     static RefPtr<FrameNode> CreateStackNode();
52     static RefPtr<FrameNode> CreateButtonNode();
53     static void SetTextProperties(const RefPtr<PickerTheme>& pickerTheme, const PickerTextProperties& properties);
54 };
55 } // namespace OHOS::Ace::NG
56 
57 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_TIME_PICKER_TIME_PICKER_DIALOG_VIEW_H
58