mirror of
https://github.com/openharmony/ace_ace_engine.git
synced 2026-07-16 02:28:20 -04:00
6b5f05cda1
Change-Id: Id6e7f9669a92e8457492c4675341f981e204b09e Signed-off-by: zhangxiao72 <zhangxiao72@huawei.com>
100 lines
3.1 KiB
C++
100 lines
3.1 KiB
C++
/*
|
|
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#ifndef FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_UI_CONTENT_H
|
|
#define FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_UI_CONTENT_H
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include "viewport_config.h"
|
|
|
|
namespace OHOS {
|
|
|
|
namespace AbilityRuntime {
|
|
class Context;
|
|
}
|
|
|
|
namespace AppExecFwk {
|
|
class Configuration;
|
|
class Ability;
|
|
}
|
|
|
|
namespace Rosen {
|
|
class Window;
|
|
enum class WindowSizeChangeReason : uint32_t;
|
|
enum class WindowMode : uint32_t;
|
|
}
|
|
|
|
namespace AAFwk {
|
|
class Want;
|
|
}
|
|
|
|
namespace MMI {
|
|
class PointerEvent;
|
|
class KeyEvent;
|
|
class AxisEvent;
|
|
} // namespace MMI
|
|
|
|
} // namespace OHOS
|
|
|
|
class NativeEngine;
|
|
class NativeValue;
|
|
|
|
namespace OHOS::Ace {
|
|
|
|
#define ACE_EXPORT __attribute__((visibility("default")))
|
|
|
|
class ACE_EXPORT UIContent {
|
|
public:
|
|
static std::unique_ptr<UIContent> Create(OHOS::AbilityRuntime::Context* context, NativeEngine* runtime);
|
|
static std::unique_ptr<UIContent> Create(OHOS::AppExecFwk::Ability* ability);
|
|
|
|
virtual ~UIContent() = default;
|
|
|
|
// UI content life-cycles
|
|
virtual void Initialize(OHOS::Rosen::Window* window, const std::string& url, NativeValue* storage) = 0;
|
|
virtual void Foreground() = 0;
|
|
virtual void Background() = 0;
|
|
virtual void Focus() = 0;
|
|
virtual void UnFocus() = 0;
|
|
virtual void Destroy() = 0;
|
|
virtual void OnNewWant(const OHOS::AAFwk::Want& want) = 0;
|
|
|
|
// distribute
|
|
virtual void Restore(OHOS::Rosen::Window* window, const std::string& contentInfo, NativeValue* storage) = 0;
|
|
virtual std::string GetContentInfo() const = 0;
|
|
|
|
// UI content event process
|
|
virtual bool ProcessBackPressed() = 0;
|
|
virtual bool ProcessPointerEvent(const std::shared_ptr<OHOS::MMI::PointerEvent>& pointerEvent) = 0;
|
|
virtual bool ProcessKeyEvent(const std::shared_ptr<OHOS::MMI::KeyEvent>& keyEvent) = 0;
|
|
virtual bool ProcessAxisEvent(const std::shared_ptr<OHOS::MMI::AxisEvent>& axisEvent) = 0;
|
|
virtual bool ProcessVsyncEvent(uint64_t timeStampNanos) = 0;
|
|
virtual void UpdateConfiguration(const std::shared_ptr<OHOS::AppExecFwk::Configuration>& config) = 0;
|
|
virtual void UpdateViewportConfig(const ViewportConfig& config, OHOS::Rosen::WindowSizeChangeReason reason) = 0;
|
|
virtual void UpdateWindowMode(OHOS::Rosen::WindowMode mode) = 0;
|
|
|
|
// Window color
|
|
virtual uint32_t GetBackgroundColor() = 0;
|
|
virtual void SetBackgroundColor(uint32_t color) = 0;
|
|
|
|
virtual void DumpInfo(const std::vector<std::string>& params, std::vector<std::string>& info) = 0;
|
|
};
|
|
|
|
} // namespace OHOS::Ace
|
|
|
|
#endif // FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_UI_CONTENT_H
|