mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
ui/api: Added sidebar
This commit is contained in:
@@ -232,6 +232,11 @@ namespace hex {
|
||||
DrawCallback callback;
|
||||
};
|
||||
|
||||
struct SidebarItem {
|
||||
std::string icon;
|
||||
DrawCallback callback;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
u32 getDockSpaceId();
|
||||
@@ -240,6 +245,7 @@ namespace hex {
|
||||
void addWelcomeScreenEntry(const impl::DrawCallback &function);
|
||||
void addFooterItem(const impl::DrawCallback &function);
|
||||
void addToolbarItem(const impl::DrawCallback &function);
|
||||
void addSidebarItem(const std::string &icon, const impl::DrawCallback &function);
|
||||
|
||||
void addLayout(const std::string &unlocalizedName, const impl::LayoutFunction &function);
|
||||
|
||||
@@ -247,6 +253,7 @@ namespace hex {
|
||||
std::vector<impl::DrawCallback>& getWelcomeScreenEntries();
|
||||
std::vector<impl::DrawCallback>& getFooterItems();
|
||||
std::vector<impl::DrawCallback>& getToolbarItems();
|
||||
std::vector<impl::SidebarItem>& getSidebarItems();
|
||||
|
||||
std::vector<impl::Layout>& getLayouts();
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ namespace hex {
|
||||
static std::vector<ContentRegistry::Interface::impl::DrawCallback> welcomeScreenEntries;
|
||||
static std::vector<ContentRegistry::Interface::impl::DrawCallback> footerItems;
|
||||
static std::vector<ContentRegistry::Interface::impl::DrawCallback> toolbarItems;
|
||||
static std::vector<ContentRegistry::Interface::impl::SidebarItem> sidebarItems;
|
||||
static std::vector<ContentRegistry::Interface::impl::Layout> layouts;
|
||||
|
||||
static std::map<Shortcut, std::function<void()>> globalShortcuts;
|
||||
|
||||
@@ -312,6 +312,10 @@ namespace hex {
|
||||
getToolbarItems().push_back(function);
|
||||
}
|
||||
|
||||
void ContentRegistry::Interface::addSidebarItem(const std::string &icon, const impl::DrawCallback &function) {
|
||||
getSidebarItems().push_back({ icon, function });
|
||||
}
|
||||
|
||||
void ContentRegistry::Interface::addLayout(const std::string &unlocalizedName, const impl::LayoutFunction &function) {
|
||||
log::info("Added new layout: {}", unlocalizedName);
|
||||
|
||||
@@ -332,6 +336,9 @@ namespace hex {
|
||||
std::vector<ContentRegistry::Interface::impl::DrawCallback>& ContentRegistry::Interface::getToolbarItems() {
|
||||
return SharedData::toolbarItems;
|
||||
}
|
||||
std::vector<ContentRegistry::Interface::impl::SidebarItem>& ContentRegistry::Interface::getSidebarItems() {
|
||||
return SharedData::sidebarItems;
|
||||
}
|
||||
|
||||
std::vector<ContentRegistry::Interface::impl::Layout>& ContentRegistry::Interface::getLayouts() {
|
||||
return SharedData::layouts;
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace hex {
|
||||
std::vector<ContentRegistry::Interface::impl::MainMenuItem> SharedData::mainMenuItems;
|
||||
std::vector<ContentRegistry::Interface::impl::DrawCallback> SharedData::welcomeScreenEntries;
|
||||
std::vector<ContentRegistry::Interface::impl::DrawCallback> SharedData::footerItems;
|
||||
std::vector<ContentRegistry::Interface::impl::SidebarItem> SharedData::sidebarItems;
|
||||
std::vector<ContentRegistry::Interface::impl::DrawCallback> SharedData::toolbarItems;
|
||||
std::vector<ContentRegistry::Interface::impl::Layout> SharedData::layouts;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user