mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:30:05 +00:00
Replacing ImGui Manager with ImGui Model
This commit is contained in:
parent
0f8b8d73f9
commit
9684aa4cdc
7 changed files with 156 additions and 113 deletions
60
scwx-qt/source/scwx/qt/model/imgui_context_model.hpp
Normal file
60
scwx-qt/source/scwx/qt/model/imgui_context_model.hpp
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <QAbstractListModel>
|
||||
|
||||
struct ImGuiContext;
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace model
|
||||
{
|
||||
|
||||
class ImGuiContextModelImpl;
|
||||
|
||||
struct ImGuiContextInfo
|
||||
{
|
||||
size_t id_ {};
|
||||
std::string name_ {};
|
||||
ImGuiContext* context_ {};
|
||||
|
||||
bool operator==(const ImGuiContextInfo& o) const;
|
||||
};
|
||||
|
||||
class ImGuiContextModel : public QAbstractListModel
|
||||
{
|
||||
private:
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(ImGuiContextModel)
|
||||
|
||||
public:
|
||||
explicit ImGuiContextModel();
|
||||
~ImGuiContextModel();
|
||||
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex& index,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
|
||||
ImGuiContext* CreateContext(const std::string& name);
|
||||
void DestroyContext(const std::string& name);
|
||||
|
||||
std::vector<ImGuiContextInfo> contexts() const;
|
||||
|
||||
static ImGuiContextModel& Instance();
|
||||
|
||||
signals:
|
||||
void ContextsUpdated();
|
||||
|
||||
private:
|
||||
friend class ImGuiContextModelImpl;
|
||||
std::unique_ptr<ImGuiContextModelImpl> p;
|
||||
};
|
||||
|
||||
} // namespace model
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
Loading…
Add table
Add a link
Reference in a new issue