Skip to content

Releases: reales/juce_native_macos_dialogs

v2.1.0 - Enhanced Menu Control

23 Oct 11:27
8638278

Choose a tag to compare

Enhanced Menu Control and Bug Fixes

This release adds more flexibility in menu positioning behavior and resolves naming conflicts with JUCE internals.


✨ New Features

Enhanced showPopupMenu() Control

  • New Parameter: centerOnCheckedItem (4th parameter)
    • When true: Centers the menu on any checked item at the cursor position
    • When false: Shows menu at cursor without repositioning (default behavior)
    • Perfect for preset browsers where you want the current selection centered at the cursor

Example:

juce::PopupMenu menu;
for (int i = 1; i <= 128; ++i)
{
    bool isCurrent = (i == currentPreset);
    menu.addItem(i, "Preset " + juce::String(i), true, isCurrent);
}

// Center the checked item at cursor position
int result = juce::NativeMacPopupMenu::showPopupMenu(menu, nullptr, false, true);

🐛 Bug Fixes

Fixed JUCE Naming Conflicts

  • Renamed: MenuItemTargetNativeMacMenuItemTarget
  • Reason: Prevents conflicts with JUCE's internal MenuItemTarget class
  • Impact: Resolves compilation errors in projects using JUCE's menu internals

📚 Documentation

  • Updated README with clearer installation instructions
  • Enhanced API documentation for the new centerOnCheckedItem parameter
  • Added comparison table showing when to use each menu function
  • Added MIT LICENSE file

📦 Installation

git submodule add https://github.com/reales/juce_native_macos_dialogs.git Modules/juce_native_macos_dialogs
git submodule update --init --recursive
cd Modules/juce_native_macos_dialogs
git checkout v2.1.0

🎯 Menu Function Comparison

Function Use Case Auto-Scroll/Center Example
showPopupMenu() Context menus, right-click Optional (via parameter) Right-click menu
showPopupMenu(..., true) Preset browser at cursor Yes (centers on checked) 128 presets, center #64
showPopupMenuAt() Preset browsers at position Yes (auto-scroll) Below button, scroll to #64
showPopupMenuAtFixed() ComboBox dropdowns No (exact position) Voice count: 1/2/4/6/8

📖 Full Documentation

See the README for complete API reference and examples.


Previous Releases

v2.0.0

  • Native popup menu support (NativeMacPopupMenu)
  • Three menu display modes
  • Auto-scroll to checked items
  • 16 comprehensive examples

v1.0.0

  • Native dialog boxes (text input, info, confirm)
  • Custom clipboard support with UTI types
  • Plugin-friendly focus restoration

v2.0.0 - Native macOS Popup Menus

22 Oct 07:42

Choose a tag to compare

🎉 Major Release: Native Popup Menu Support

This release adds comprehensive native macOS popup menu support to complement the existing dialog and clipboard functionality.


✨ New Features

Native Popup Menus (NativeMacPopupMenu)

  • Three Display Modes:

    • showPopupMenu() - Standard context menus at mouse position
    • showPopupMenuAt() - Auto-scroll to checked items (perfect for preset browsers)
    • showPopupMenuAtFixed() - Fixed position without auto-scroll (ideal for ComboBox-style dropdowns)
  • Full Feature Set:

    • Native NSMenu integration for authentic macOS look and feel
    • Support for hierarchical menus and submenus
    • Automatic coordinate system conversion (JUCE ↔ macOS)
    • Native checkmark display for selected items
    • Intelligent auto-scrolling to show checked items
    • Compact menu size option with useSmallSize parameter

Performance Improvements

Native menus significantly outperform JUCE's custom-rendered menus:

  • 10 items: 2.5x faster
  • 50 items: 8x faster
  • 128 items: 16x faster
  • 256 items: 26x faster

🐛 Bug Fixes

  • Fixed critical crash when positioning checked items in submenus
  • Fixed Carbon type conflicts with proper #define guards
  • Improved thread safety and error handling

📚 Documentation

  • Added 16 comprehensive usage examples in examples.cpp
  • Extensive API documentation for all menu functions
  • Migration guide from JUCE PopupMenu
  • Real-world implementation examples

📦 Installation

Git Submodule (Recommended)

git submodule add https://github.com/reales/juce_native_macos_dialogs.git Modules/juce_native_macos_dialogs

Requirements

  • macOS only
  • JUCE 7.x or JUCE 8.x
  • C++17 or later
  • Dependencies: juce_core, juce_gui_basics

🚀 Quick Example

// Create a preset browser with auto-scroll
juce::PopupMenu menu;
for (int i = 1; i <= 128; ++i)
{
    bool isCurrent = (i == currentPreset);
    menu.addItem(i, "Preset " + juce::String(i), true, isCurrent);
}

#if JUCE_MAC
    auto pos = presetButton->getScreenBounds().getBottomLeft();
    int result = juce::NativeMacPopupMenu::showPopupMenuAt(menu, pos);
#else
    int result = menu.showAt(presetButton);
#endif

📖 Full Documentation

See the README for complete API reference and examples.


Previous Version (1.0.0)

  • Native dialog boxes (text input, info, confirm)
  • Custom clipboard support with UTI types
  • Plugin-friendly focus restoration