1 /*
2  * Copyright (c) 2022 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_PANEL_SLIDING_EVENTS_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_PANEL_SLIDING_EVENTS_H
18 
19 #include "core/components/common/layout/constants.h"
20 
21 #include "core/event/ace_events.h"
22 
23 namespace OHOS::Ace {
24 
25 class ACE_EXPORT SlidingPanelSizeChangeEvent : public BaseEventInfo, public EventToJSONStringAdapter {
26     DECLARE_RELATIONSHIP_OF_CLASSES(SlidingPanelSizeChangeEvent, BaseEventInfo, EventToJSONStringAdapter);
27 
28 public:
SlidingPanelSizeChangeEvent(PanelMode mode,double width,double height)29     SlidingPanelSizeChangeEvent(PanelMode mode, double width, double height)
30         : BaseEventInfo("SlidingPanelSizeChangeEvent"), mode_(mode), width_(width), height_(height)
31     {}
32 
33     ~SlidingPanelSizeChangeEvent() = default;
34 
GetWidth()35     double GetWidth() const
36     {
37         return width_;
38     }
39 
GetHeight()40     double GetHeight() const
41     {
42         return height_;
43     }
44 
GetMode()45     PanelMode GetMode() const
46     {
47         return mode_;
48     }
49 
50     std::string ToJSONString() const override;
51 
52 private:
53     PanelMode mode_ = PanelMode::HALF;
54     double width_ = 0.0;
55     double height_ = 0.0;
56 };
57 
58 } // namespace OHOS::Ace
59 
60 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_PANEL_SLIDING_EVENTS_H
61