impr: Make sidebars disableable and resizable

This commit is contained in:
WerWolv
2023-11-14 15:55:25 +01:00
parent 53c04a934e
commit 33e20df511
3 changed files with 45 additions and 9 deletions

View File

@@ -633,6 +633,7 @@ namespace hex {
struct SidebarItem {
std::string icon;
DrawCallback callback;
EnabledCallback enabledCallback;
};
struct TitleBarButton {
@@ -712,8 +713,9 @@ namespace hex {
* @brief Adds a new sidebar item
* @param icon The icon to use for the item
* @param function The function to call to draw the item
* @param enabledCallback The function
*/
void addSidebarItem(const std::string &icon, const impl::DrawCallback &function);
void addSidebarItem(const std::string &icon, const impl::DrawCallback &function, const impl::EnabledCallback &enabledCallback = []{ return true; });
/**
* @brief Adds a new title bar button

View File

@@ -748,8 +748,8 @@ namespace hex {
impl::getToolbarItems().push_back(function);
}
void addSidebarItem(const std::string &icon, const impl::DrawCallback &function) {
impl::getSidebarItems().push_back({ icon, function });
void addSidebarItem(const std::string &icon, const impl::DrawCallback &function, const impl::EnabledCallback &enabledCallback) {
impl::getSidebarItems().push_back({ icon, function, enabledCallback });
}
void addTitleBarButton(const std::string &icon, const std::string &unlocalizedTooltip, const impl::ClickCallback &function) {