Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a tabbed component on-tab right mouse popup lambda #129

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions include/sst/jucegui/components/TabbedComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,23 @@ struct TabbedComponent : juce::TabbedComponent, style::StyleConsumer
hover = false;
repaint();
}
void mouseDown(const juce::MouseEvent &event) override
{
if (event.mods.isPopupMenu() && parentComp->onTabPopupMenu)
{
parentComp->onTabPopupMenu(idx);
return;
}
juce::TabBarButton::mouseDown(event);
}
void mouseUp(const juce::MouseEvent &event) override
{
if (event.mods.isPopupMenu() && parentComp->onTabPopupMenu)
{
return;
}
juce::TabBarButton::mouseUp(event);
}

public:
int getBestTabLength(int depth) override
Expand Down Expand Up @@ -157,6 +174,7 @@ struct TabbedComponent : juce::TabbedComponent, style::StyleConsumer
}

void onStyleChanged() override { resized(); }
std::function<void(size_t)> onTabPopupMenu{nullptr};
};
} // namespace sst::jucegui::components
#endif // SHORTCIRCUITXT_TABBEDCOMPONENT_H
Loading