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

Context Menu (aka ClickDownMenu) Draft #394

Open
libfud opened this issue Apr 21, 2015 · 10 comments
Open

Context Menu (aka ClickDownMenu) Draft #394

libfud opened this issue Apr 21, 2015 · 10 comments

Comments

@libfud
Copy link

libfud commented Apr 21, 2015

There should be something like a Contextual trait, where right clicking on a widget which implements it reveals a context menu. I think this shares some overlap with a drop down menu.

@mitchmindtree
Copy link
Contributor

I think this might even be best as its own Widget. A user could provide either a specific clickable area, or the ID of a widget that can be clicked to activate it. Usage could be something like:

RightClickMenu::new(some_menu)
    .click_area(position, dimensions) // A user could either use this
    .click_widget(SOME_WIDGET_ID) // or this.
    .react(...)
    .set(MY_CLICK_MENU, ui);

@mitchmindtree mitchmindtree added this to the 1.0.0 milestone Jul 11, 2015
@mitchmindtree mitchmindtree changed the title Context Menu Draft Context Menu (aka RightClickMenu) Draft Jul 11, 2015
@mitchmindtree
Copy link
Contributor

It would be cool if a user could specify which mouse button activates the menu. Perhaps ClickDownMenu is a better name.

@mitchmindtree mitchmindtree changed the title Context Menu (aka RightClickMenu) Draft Context Menu (aka ClickDownMenu) Draft Jul 11, 2015
@mitchmindtree
Copy link
Contributor

There should be a single Menu type/trait which can be shared between this and the Menu/ToolBar #417 and perhaps even the DropDownList (could be changed to DropDownMenu).

@flying-sheep
Copy link

in existing UI frameworks, both are rendered by creating a floating titlebarless window which is able to extend outside of the main window.

@agraven
Copy link

agraven commented Jun 13, 2019

GTK3 applications using client side decoration actually draw the vast majority of popup menus in the actual application window instead of in a floating one. Electron applications do this as well (but that's because they simply can't make floating windows, I think).

@flying-sheep
Copy link

Interesting! Do they detect if the menu would fit into the window boundaries and only create a floating window if it doesn’t?

@agraven
Copy link

agraven commented Jun 28, 2019

Most applications like this change which side of the cursor the menu appears on, usually the menu is position so the cursor is at its top-left, but this is changed to bottom or right corner if necessary.

@flying-sheep
Copy link

Sure, but what if you have a very small parent window or a very long menu? Will it still render in the window (with scrollbars or so) or will it pop out as its own window?

@agraven
Copy link

agraven commented Jul 3, 2019

It'll stay inside the window.

@mitchmindtree
Copy link
Contributor

@flying-sheep yes unfortunately conrod will have the same restriction as GTK in this sense (at least for widgets that are generic across platforms). In our case, conrod_core does not have ownership over the windowing context or know anything about it - it just receives input events and outputs widget primitives for rendering and widget events for updating state.

That said, you might be able to implement a popup style menu for a specific windowing backend (e.g. winit) - it would require a custom widget implementation and might be better off as a downstream crate. It may even be possible to make a generic one that worked with windowing from different platforms, but this would likely involve much greater design considerations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants