# Custom Menu for IPlug2

**URL:** <https://iplug2.discourse.group/t/custom-menu-for-iplug2/554>\
**Category:** Uncategorized\
**Created:** [29 January 2022 08:50 UTC](https://iplug2.discourse.group/t/custom-menu-for-iplug2/554 "2022-01-29T08:50:48Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![vasyan](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/vasyan/32/82_2.png) [@vasyan](https://iplug2.discourse.group/u/vasyan)\
**Post date:** [29 January 2022 08:50 UTC](https://iplug2.discourse.group/t/custom-menu-for-iplug2/554/1 "2022-01-29T08:50:48Z")

</div>

I want to address the community of plug-in developers on the Iplug2 framework with a question that has been trembling for me for a long time.  
Its essence is the implementation of a custom menu, which should be fully customizable, similar in capabilities to PopupMenu from the JUCE library. Existing menu implementations that use both the native and the IPopupMenuControl class have their advantages and disadvantages.  
The IPopupMenuControl class is good for many, but in my opinion it is not capable of organizing a menu with several columns, and its main drawback is that the menu does not leave the plugin window borders. Native menu implementations can leave the plugin window borders, but customizing them is very difficult.

Now I’m porting my old [PolyGAS](https://www.kvraudio.com/forum/viewtopic.php?f=1&t=489334&p=6849927) plugin to the Iplug2 framework, and I ran into a problem with the implementation of the menu. I would like to have a translucent menu, with a frame and a shadow, which would not be limited by the size of the plugin window, as in the old version of PolyGAS:

 ![polygas](https://global.discourse-cdn.com/free1/uploads/iplug2/original/1X/d7e4ca69eb201fd1a175325b2652f6b0849159f8.png)

I would be glad to consider constructive advice on the implementation of such a menu. From myself, I’ll just add that I’m coming up with the idea of implementing an additional window using the API, which will contain menu items, but I would also like it to work on macOS, with whose API I’m unfortunately not so familiar with.

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [29 January 2022 16:11 UTC](https://iplug2.discourse.group/t/custom-menu-for-iplug2/554/2 "2022-01-29T16:11:48Z")

</div>

nice gui!

AFAIK NSMenu on macOS doesn’t support multiple columns, like the win32 menu does. I think your best option would be with IPopupMenuControl (which used to be able to do multiple columns… something seems to have broken with that). It’s quite a lot of work to make a “custom” NSWindow based menu that could extend beyond the bounds of the plug-in UI. If you want to port stuff to AUv3 or iPad you can’t create windows that go outside of the plug-in window IIRC, so IPopupMenuControl may be the best choice

---

<div class="post-metadata">

**Author:** ![vasyan](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/vasyan/32/82_2.png) [@vasyan](https://iplug2.discourse.group/u/vasyan)\
**Post date:** [29 January 2022 16:30 UTC](https://iplug2.discourse.group/t/custom-menu-for-iplug2/554/3 "2022-01-29T16:30:55Z")

</div>

> [@olilarkin](#):
>
> nice gui!

This GUI was created in Delphi. But as practice has shown, Delphi was not suitable for developing complex plugins, and besides, plugins could only be builded for Windows.

It makes sense to look at the source code of the JUCE library, files juce\_PopupMenu.cpp, juce\_win32\_Windowing.cpp, juce\_mac\_Windowing.mm and so. However, this library is quite difficult…

---

<div class="post-metadata">

**Author:** ![wcr\_hlo](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/wcr_hlo/32/231_2.png) [@wcr\_hlo](https://iplug2.discourse.group/u/wcr_hlo)\
**Post date:** [29 January 2022 18:30 UTC](https://iplug2.discourse.group/t/custom-menu-for-iplug2/554/4 "2022-01-29T18:30:09Z")

</div>

I think that a lot can be taken from these libraries and rewritten. In such a way as not to violate the rights of the license. In fact, there are key interceptions, copying from the clipboard, and much more. I don’t understand why it’s not implemented in this framework.

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [29 January 2022 20:24 UTC](https://iplug2.discourse.group/t/custom-menu-for-iplug2/554/5 "2022-01-29T20:24:25Z")

</div>

It’s really a lot of work and requires a fundamental change to the framework to work with multiple windows… in iPlug we have one IGraphics context, which is somewhat coupled to the plugin, and tied to one window. In JUCE a LowLevelGraphicsContext is a more lightweight object optionally used to draw into a window and the framework is designed for multiple windows.

---

<div class="post-metadata">

**Author:** ![wcr\_hlo](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/wcr_hlo/32/231_2.png) [@wcr\_hlo](https://iplug2.discourse.group/u/wcr_hlo)\
**Post date:** [30 January 2022 02:25 UTC](https://iplug2.discourse.group/t/custom-menu-for-iplug2/554/6 "2022-01-30T02:25:59Z")

</div>

If you are hungry for help/contribute , then you can create a open task-board for tasks so that everyone can help finish or improve the framework in the shortest possible time… 🥲

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [30 January 2022 11:00 UTC](https://iplug2.discourse.group/t/custom-menu-for-iplug2/554/7 "2022-01-30T11:00:06Z")

</div>

> **[Issues · iPlug2/iPlug2](https://github.com/iPlug2/iPlug2/labels/help%20wanted)**
>
> C++ Audio Plug-in Framework for desktop, mobile and web \[PRE-RELEASE\] - Issues · iPlug2/iPlug2

---

<div class="post-metadata">

**Author:** ![vasyan](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/vasyan/32/82_2.png) [@vasyan](https://iplug2.discourse.group/u/vasyan)\
**Post date:** [31 January 2022 04:10 UTC](https://iplug2.discourse.group/t/custom-menu-for-iplug2/554/8 "2022-01-31T04:10:41Z")

</div>

> [@wcr\_hlo](#):
>
> I think that a lot can be taken from these libraries and rewritten. In such a way as not to violate the rights of the license. In fact, there are key interceptions, copying from the clipboard, and much more. I don’t understand why it’s not implemented in this framework.

I’m not going to copy the JUCE code, but a detailed analysis of its work in the debugger is not copyright infringement. Therefore, you can safely make an additional component for IPlug2 that implements the menu, which will be integrated with the graphical tool IGraphics and other necessary classes of IPlug2. In particular, such a menu will be useful as a preset selector, especially when the number of presets is large enough.

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [31 January 2022 13:59 UTC](https://iplug2.discourse.group/t/custom-menu-for-iplug2/554/9 "2022-01-31T13:59:02Z")

</div>

You could also check GLFW, which has cross platform window creation code

---

<div class="post-metadata">

**Author:** ![vasyan](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/vasyan/32/82_2.png) [@vasyan](https://iplug2.discourse.group/u/vasyan)\
**Post date:** [1 February 2022 07:01 UTC](https://iplug2.discourse.group/t/custom-menu-for-iplug2/554/10 "2022-02-01T07:01:28Z")

</div>

By the way, for current projects, I had to finalize the IPopupMenuControl in order to display keyboard shortcuts with right text alignment.

![popup_menu](https://global.discourse-cdn.com/free1/uploads/iplug2/original/1X/8fb2adb6106ec7d53852e9789eab756252fdc195.png)

---

<div class="post-metadata">

**Author:** ![vasyan](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/vasyan/32/82_2.png) [@vasyan](https://iplug2.discourse.group/u/vasyan)\
**Post date:** [17 February 2022 05:42 UTC](https://iplug2.discourse.group/t/custom-menu-for-iplug2/554/11 "2022-02-17T05:42:30Z")

</div>

> [@olilarkin](#):
>
> You could also check GLFW, which has cross platform window creation code

It is also possible to explore the [inkscape source code](https://gitlab.com/inkscape/inkscape), it also uses the original cross-platform popup menu.
