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 INTERFACES_INNERKITS_WINDOW_MODEL_H
17#define INTERFACES_INNERKITS_WINDOW_MODEL_H
18
19#include "window.h"
20
21namespace OHOS {
22namespace Previewer {
23enum class Orientation : int32_t {
24    PORTRAIT,
25    LANDSCAPE,
26    ORIENTATION_UNDEFINED,
27};
28
29enum class DeviceType {
30    PHONE,
31    TV,
32    WATCH,
33    CAR,
34    TABLET,
35    UNKNOWN,
36};
37
38enum class ColorMode : int32_t {
39    LIGHT = 0,
40    DARK,
41    COLOR_MODE_UNDEFINED,
42};
43
44struct PreviewerWindowModel {
45    bool isRound = false; // shape rect(false) circle(true)
46    int32_t originWidth = 0; // or width
47    int32_t originHeight = 0; // or height
48    int32_t compressWidth = 0; // cr width
49    int32_t compressHeight = 0; // cr height
50    Orientation orientation = Orientation::PORTRAIT; // orientation
51    double density = 1.0; // dpi with calculate
52    DeviceType deviceType = DeviceType::PHONE; // device type
53    ColorMode colorMode = ColorMode::LIGHT; // color mode
54};
55
56class WINDOW_EXPORT PreviewerWindow {
57public:
58    PreviewerWindow(const PreviewerWindow&) = delete;
59    PreviewerWindow& operator=(const PreviewerWindow&) = delete;
60    ~PreviewerWindow() = default;
61
62    static PreviewerWindow& GetInstance();
63    static Rosen::Orientation TransOrientation(Previewer::Orientation orientation);
64    void SetWindowParams(const PreviewerWindowModel& windowModel);
65    PreviewerWindowModel& GetWindowParams();
66
67    void SetWindowObject(const Rosen::Window* window);
68    Rosen::Window* GetWindowObject();
69
70private:
71    PreviewerWindow();
72    PreviewerWindowModel windowModel_;
73    Rosen::Window* window_ = nullptr;
74};
75} // namespace Previewer
76} // namespace OHOS
77#endif // INTERFACES_INNERKITS_WINDOW_MODEL_H
78