iced_aw icon indicating copy to clipboard operation
iced_aw copied to clipboard

[WIP] Menu widget

Open Kaiden42 opened this issue 3 years ago • 4 comments

First draft of a Menu widget.

menu

Open TODOs:

  • [x] Disable entries. This could be achieved by changing Message to Optional<Message>.
  • [x] Toggle-able entries. This could be achieved by adding a Entry::Toggle or something to Entry.
  • [x] Cool looking separators between the entries.
  • [x] Bouncing on the edge of the window or else the menu is cut off.
  • [ ] ~Add some internal scrollable if the list of entries is to high for the window.~ This seems to be realy hacky to implement. Nevertheless it would require for the scrollable::State to be hashable and maybe to fix this first.
  • [ ] Maybe a cooler default style. Some suggestions?
  • [ ] Add some way of keyboard control. In common, the Alt + [First character of section label] combination is used to pop up the content of the specific section. This would require to change the Text label of the Section to a normal String (or &str) to be able to know the first character of the label.

Kaiden42 avatar Mar 05 '21 15:03 Kaiden42

This is very nice! I was thinking of making something like this for my chat app since using a PickList as a menu was hacky, but looks like you were faster :P

It seems we can use anything that can Into<Element<_>> for menu entries which is appreciated. Something that would be nice is methods on Menu that would help with prototyping, eg. perhaps a method that takes an array of strings for easier creation of text-only Menus etc.

yusdacra avatar Mar 06 '21 16:03 yusdacra

Hmm for styling lets just stick with a workable default. Also scroll-able stuff should be fixed to render properly since a few versions back. a few keyboard controls would be nice probably can try to help implement them later. Also the pure edition might also fix the state hashing requirements for the scrollbars.

genusistimelord avatar May 31 '22 14:05 genusistimelord

@genusistimelord For now, I would prefer to wait for the support of the real system menus (iced#1047, iced#114). What do you say?

Kaiden42 avatar Jun 05 '22 17:06 Kaiden42

@genusistimelord For now, I would prefer to wait for the support of the real system menus (iced#1047, iced#114). What do you say?

yeah thats fine. was more or less stating how the current changes in iced have already changed some of the requirements.

genusistimelord avatar Jun 05 '22 20:06 genusistimelord

I am closing this since menu now exists. Decided to allow it since this cant be supported fully in other ways. we might not see its support for a long time if any.

genusistimelord avatar Feb 23 '23 01:02 genusistimelord