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 WINDOW_DISPLAY_H 17 #define WINDOW_DISPLAY_H 18 19 #include <string> 20 #include <vector> 21 #include <functional> 22 23 #include "window.h" 24 #include "fold_screen_info.h" 25 26 namespace OHOS { 27 namespace Previewer { 28 using namespace OHOS::Rosen; 29 30 class WINDOW_EXPORT PreviewerDisplay { 31 using DisplayCallback = std::function<void(const FoldStatus&)>; 32 33 public: 34 static PreviewerDisplay& GetInstance(); 35 36 void SetFoldable(const bool foldable); 37 void SetFoldStatus(const FoldStatus foldStatus); 38 void SetCurrentFoldCreaseRegion(const sptr<FoldCreaseRegion> currentFoldCreaseRegion); 39 void ExecStatusChangedCallback(); 40 41 bool IsFoldable() const; 42 FoldStatus GetFoldStatus() const; 43 sptr<FoldCreaseRegion> GetCurrentFoldCreaseRegion() const; 44 void RegisterStatusChangedCallback(const DisplayCallback callback); 45 46 private: 47 PreviewerDisplay() = default; 48 ~PreviewerDisplay() = default; 49 50 bool foldable_ = false; 51 FoldStatus foldStatus_ = FoldStatus::UNKNOWN; 52 sptr<FoldCreaseRegion> currentFoldCreaseRegion_ = nullptr; 53 DisplayCallback displayCallback_; 54 }; 55 } // namespace Previewer 56 } // namespace OHOS 57 #endif // WINDOW_DISPLAY_H