mcu_hi3321_watch/tjd/ui/app/shutdown/TjdUiAppShutdownView.h
2025-05-26 20:15:20 +08:00

97 lines
2.3 KiB
C++

/*----------------------------------------------------------------------------
* Copyright (c) TJD Technologies Co., Ltd. 2025. All rights reserved.
*
* Description: TjdUiAppShutdownView.h
*
* Author: luziquan@ss-tjd.com
*
* Create: 2024-06-13
*--------------------------------------------------------------------------*/
#ifndef TJD_UI_APP_SHUTDOWN_VIEW_H
#define TJD_UI_APP_SHUTDOWN_VIEW_H
#include "TjdUiAppShutdownPresenter.h"
#include "View.h"
#include "components/ui_image_view.h"
#include "components/ui_label.h"
#include "components/ui_view_group.h"
#include "components/ui_scroll_view.h"
namespace TJD {
enum ShutdownViewIndex
{
CHOOSE_SHUTDOWN_VIEW,
RESTART_VIEW,
SHUTDOWN_VIEW,
SHUTDOWN_UNKNOWN
};
class ShutdownViewBase : public OHOS::UIScrollView
{
public:
ShutdownViewBase() { SetHorizontalScrollState(false); }
virtual ~ShutdownViewBase() {}
virtual void ShowView() { SetVisible(true); };
virtual void HideView() { SetVisible(false); };
};
class ChooseShutdownView : public ShutdownViewBase
{
public:
ChooseShutdownView();
~ChooseShutdownView() { RemoveAll(); }
private:
OHOS::UIImageView restart_;
OHOS::UILabel restartDesc_;
OHOS::UIImageView shutdown_;
OHOS::UILabel shutdownDesc_;
};
class RestartView : public ShutdownViewBase
{
public:
RestartView();
~RestartView() { RemoveAll(); }
private:
OHOS::UIImageView restart_;
OHOS::UILabel restartDesc_;
};
class ShutdownView : public ShutdownViewBase
{
public:
ShutdownView();
~ShutdownView() { RemoveAll(); }
private:
OHOS::UIImageView shutdown;
OHOS::UILabel shutdownDesc_;
};
class TjdUiAppShutdownView
{
public:
TjdUiAppShutdownView();
~TjdUiAppShutdownView();
static TjdUiAppShutdownView *GetInstance(void);
OHOS::UIScrollView *InitView();
void ShowView(ShutdownViewIndex showIndex);
static ShutdownViewIndex currentViewIndex_;
private:
OHOS::UIViewGroup *shutdownView[SHUTDOWN_UNKNOWN];
OHOS::UIViewGroup *mainContainer_{nullptr};
ShutdownViewBase *viewManager_[ShutdownViewIndex::SHUTDOWN_UNKNOWN]{nullptr};
OHOS::UIScrollView *mainView_{nullptr};
void InitTargetView(ShutdownViewIndex index);
};
} // namespace TJD
#endif