Browse Source

Add Menu::cornerFlags.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
287e06eb08
3 changed files with 8 additions and 1 deletions
  1. +1
    -0
      include/ui/Menu.hpp
  2. +6
    -0
      src/app/MenuBar.cpp
  3. +1
    -1
      src/ui/Menu.cpp

+ 1
- 0
include/ui/Menu.hpp View File

@@ -13,6 +13,7 @@ struct Menu : widget::OpaqueWidget {
Menu* childMenu = NULL; Menu* childMenu = NULL;
/** The entry which created the child menu */ /** The entry which created the child menu */
MenuEntry* activeEntry = NULL; MenuEntry* activeEntry = NULL;
BNDcornerFlags cornerFlags = BND_CORNER_NONE;


Menu(); Menu();
~Menu(); ~Menu();


+ 6
- 0
src/app/MenuBar.cpp View File

@@ -67,6 +67,7 @@ struct NotificationIcon : widget::Widget {
struct FileButton : MenuButton { struct FileButton : MenuButton {
void onAction(const ActionEvent& e) override { void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->cornerFlags = BND_CORNER_TOP;
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));


menu->addChild(createMenuItem("New", RACK_MOD_CTRL_NAME "+N", []() { menu->addChild(createMenuItem("New", RACK_MOD_CTRL_NAME "+N", []() {
@@ -117,6 +118,7 @@ struct FileButton : MenuButton {
struct EditButton : MenuButton { struct EditButton : MenuButton {
void onAction(const ActionEvent& e) override { void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->cornerFlags = BND_CORNER_TOP;
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));


struct UndoItem : ui::MenuItem { struct UndoItem : ui::MenuItem {
@@ -326,6 +328,7 @@ struct HaloBrightnessSlider : ui::Slider {
struct ViewButton : MenuButton { struct ViewButton : MenuButton {
void onAction(const ActionEvent& e) override { void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->cornerFlags = BND_CORNER_TOP;
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));


menu->addChild(createBoolPtrMenuItem("Show tooltips", &settings::tooltips)); menu->addChild(createBoolPtrMenuItem("Show tooltips", &settings::tooltips));
@@ -439,6 +442,7 @@ struct SampleRateItem : ui::MenuItem {
struct EngineButton : MenuButton { struct EngineButton : MenuButton {
void onAction(const ActionEvent& e) override { void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->cornerFlags = BND_CORNER_TOP;
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));


std::string cpuMeterText = "F3"; std::string cpuMeterText = "F3";
@@ -708,6 +712,7 @@ struct LibraryButton : MenuButton {


void onAction(const ActionEvent& e) override { void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu<LibraryMenu>(); ui::Menu* menu = createMenu<LibraryMenu>();
menu->cornerFlags = BND_CORNER_TOP;
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
} }


@@ -741,6 +746,7 @@ struct HelpButton : MenuButton {


void onAction(const ActionEvent& e) override { void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->cornerFlags = BND_CORNER_TOP;
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));


menu->addChild(createMenuItem("Tips", "", [=]() { menu->addChild(createMenuItem("Tips", "", [=]() {


+ 1
- 1
src/ui/Menu.cpp View File

@@ -54,7 +54,7 @@ void Menu::step() {
} }


void Menu::draw(const DrawArgs& args) { void Menu::draw(const DrawArgs& args) {
bndMenuBackground(args.vg, 0.0, 0.0, box.size.x, box.size.y, BND_CORNER_NONE);
bndMenuBackground(args.vg, 0.0, 0.0, box.size.x, box.size.y, cornerFlags);
Widget::draw(args); Widget::draw(args);
} }




Loading…
Cancel
Save