QtNovelUI/libSplitView/baseview.h

64 lines
1.7 KiB
C
Raw Normal View History

2023-08-26 12:40:57 +00:00
#ifndef BASEVIEW_H
#define BASEVIEW_H
2023-12-30 05:04:51 +00:00
#include "splitview_interface.h"
2023-08-26 12:40:57 +00:00
#include <QFrame>
#include <QIcon>
#include <QLabel>
#include <QString>
2023-12-30 05:04:51 +00:00
namespace base_view {
2023-08-26 12:40:57 +00:00
class BaseView;
/**
* @brief
*/
2023-12-30 05:04:51 +00:00
class SPLITVIEW_EXPORT DragHeader : public QLabel {
2023-08-26 12:40:57 +00:00
public:
DragHeader(BaseView *bind);
private:
2023-12-30 05:04:51 +00:00
BaseView *view_core;
2023-08-26 12:40:57 +00:00
std::tuple<bool, QPointF> press_flag = std::make_tuple(false, QPointF());
// QWidget interface
protected:
virtual void mousePressEvent(QMouseEvent *event) override;
virtual void mouseReleaseEvent(QMouseEvent *event) override;
virtual void mouseMoveEvent(QMouseEvent *event) override;
};
/**
* @brief
*/
2023-12-30 05:04:51 +00:00
class SPLITVIEW_EXPORT BaseView : public QWidget, public split_frame::ViewBase {
2023-08-26 12:40:57 +00:00
public:
2023-12-30 05:04:51 +00:00
BaseView(bool replace, bool retrieve, bool close);
2023-08-26 12:40:57 +00:00
2023-12-30 05:04:51 +00:00
void setParent(ViewRes *pinst);
2023-08-26 12:40:57 +00:00
// ViewRes interface
public:
2023-12-30 05:04:51 +00:00
virtual split_frame::ResManager *splitManager() const override;
virtual split_frame::ViewRes *parentRes() const override;
virtual QWidget *widget() const override;
virtual bool canRetrieve() const override;
virtual bool canClose() const override;
virtual bool canReplace() const override;
2023-08-26 12:40:57 +00:00
2023-12-30 05:04:51 +00:00
// ViewBase interface
2023-08-26 12:40:57 +00:00
public:
2023-12-30 05:04:51 +00:00
virtual QIcon icon() const override;
virtual QString title() const override;
virtual QSizeF viewSize() const override;
virtual void resizeView(const QSizeF &outline) override;
2023-08-26 12:40:57 +00:00
private:
2023-12-30 05:04:51 +00:00
ViewRes *parent_res = nullptr;
bool m_replace = false, m_retrieve = false, m_close = false;
2023-08-26 12:40:57 +00:00
};
} // namespace SplitFrame
#endif // BASEVIEW_H