• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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_IMAGE_IMAGE_EVENT_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_IMAGE_IMAGE_EVENT_H
18 
19 namespace OHOS::Ace {
20 
21 class ACE_EXPORT LoadImageSuccessEvent : public BaseEventInfo {
22     DECLARE_RELATIONSHIP_OF_CLASSES(LoadImageSuccessEvent, BaseEventInfo);
23 
24 public:
25     LoadImageSuccessEvent(double width, double height, double componentWidth, double componentHeight,
26         int32_t loadingStatus = 1) : BaseEventInfo("LoadImageSuccessEvent"), width_(width), height_(height),
27         componentWidth_(componentWidth), componentHeight_(componentHeight), loadingStatus_(loadingStatus) {}
28 
29     ~LoadImageSuccessEvent() = default;
30 
GetWidth()31     double GetWidth() const
32     {
33         return width_;
34     }
35 
GetHeight()36     double GetHeight() const
37     {
38         return height_;
39     }
40 
GetComponentWidth()41     double GetComponentWidth() const
42     {
43         return componentWidth_;
44     }
45 
GetComponentHeight()46     double GetComponentHeight() const
47     {
48         return componentHeight_;
49     }
50 
GetLoadingStatus()51     int32_t GetLoadingStatus() const
52     {
53         return loadingStatus_;
54     }
55 
56 private:
57     double width_ = 0.0;
58     double height_ = 0.0;
59     double componentWidth_ = 0.0;
60     double componentHeight_ = 0.0;
61     int32_t loadingStatus_ = 1; // [0] means [done layout], [1] means [load success]
62 };
63 
64 class ACE_EXPORT LoadImageFailEvent : public BaseEventInfo {
65     DECLARE_RELATIONSHIP_OF_CLASSES(LoadImageFailEvent, BaseEventInfo);
66 
67 public:
LoadImageFailEvent(double componentWidth,double componentHeight)68     LoadImageFailEvent(double componentWidth, double componentHeight)
69         : BaseEventInfo("LoadImageFailEvent"), componentWidth_(componentWidth), componentHeight_(componentHeight) {}
70     ~LoadImageFailEvent() = default;
71 
GetComponentWidth()72     double GetComponentWidth() const
73     {
74         return componentWidth_;
75     }
76 
GetComponentHeight()77     double GetComponentHeight() const
78     {
79         return componentHeight_;
80     }
81 
82 private:
83     double componentWidth_ = 0.0;
84     double componentHeight_ = 0.0;
85 };
86 
87 } // namespace OHOS::Ace
88 
89 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_IMAGE_IMAGE_EVENT_H
90