• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_NG_MANAGER_SELECT_OVERLAY_SELECT_OVERLAY_PROXY_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MANAGER_SELECT_OVERLAY_SELECT_OVERLAY_PROXY_H
18 
19 #include <cstdint>
20 
21 #include "base/geometry/ng/rect_t.h"
22 #include "base/memory/ace_type.h"
23 #include "base/memory/referenced.h"
24 #include "base/utils/noncopyable.h"
25 #include "core/components_ng/pattern/select_overlay/select_overlay_property.h"
26 
27 namespace OHOS::Ace::NG {
28 
29 // SelectOverlayProxy is the class to control select handle and select menu.
30 class ACE_EXPORT SelectOverlayProxy : public virtual AceType {
31     DECLARE_ACE_TYPE(SelectOverlayProxy, AceType);
32 
33 public:
SelectOverlayProxy(int32_t selectOverlayId)34     explicit SelectOverlayProxy(int32_t selectOverlayId) : selectOverlayId_(selectOverlayId) {}
35     ~SelectOverlayProxy() override = default;
36 
37     void UpdateFirstSelectHandleInfo(const SelectHandleInfo& info) const;
38 
39     void UpdateSecondSelectHandleInfo(const SelectHandleInfo& info) const;
40 
41     void UpdateFirstAndSecondHandleInfo(const SelectHandleInfo& firstInfo, const SelectHandleInfo& secondInfo) const;
42 
43     void UpdateSelectMenuInfo(const SelectMenuInfo& info) const;
44 
45     void UpdateShowArea(const RectF& area) const;
46 
47     void SetHandleReverse(bool reverse);
48 
49     bool IsClosed() const;
50 
51     void Close(bool animation = false) const;
52 
GetSelectOverlayId()53     int32_t GetSelectOverlayId() const
54     {
55         return selectOverlayId_;
56     }
57 
58     void SetSelectInfo(const std::string& selectInfo) const;
59     void ShowOrHiddenMenu(bool isHidden);
60     void DisableMenu(bool isDisabled);
61     bool IsMenuShow();
62     bool IsHandleShow();
63 
64 private:
65     int32_t selectOverlayId_ = 0;
66 
67     ACE_DISALLOW_COPY_AND_MOVE(SelectOverlayProxy);
68 };
69 } // namespace OHOS::Ace::NG
70 
71 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MANAGER_SELECT_OVERLAY_SELECT_OVERLAY_PROXY_H
72