Dyalog / ewc

Experiments with JavaScript-based GUI
MIT License
1 stars 3 forks source link

WIP: Sketch demo for new RibbonDropDown classes #60

Closed cursork closed 3 weeks ago

cursork commented 1 month ago

Work in progress - opening for tracking this.

Copy-paste of the notes from the Demo file:

⍝ Drop down buttons
⍝ Sample existing code is roughly:
⍝   btn←bar.CreateSplitButton((1⊃B)(menu←⎕NEW PopupMenu))
⍝ with these attributes:
⍝   Description, Hint, Id, LargeImageIndex/ImageIndex (choose how to display based on which provided), Name,
⍝   RibbonStyle, ShortcutDisplayString, ItemShortcut (to add the shortcut), Tag, onItemClick
⍝ I think we'll want to keep Select as our 'click' action here.
⍝ Main deviation from customer code is that we're using DropDownButton as a
⍝ name, but this lines up with Windows32 era documentation for this. So it's OK.

 (rb,'.DropDownGrp')eWC'RibbonGroup' 'DropDown' bordercol
 (rb,'.DropDownGrp.GrpItem')eWC'RibbonGroupItem' 12
 (rb,'.DropDownGrp.GrpItem.DDBtn')eWC'RibbonDropDownButton' 'Genre' 'FcLibrary' 12 sel
 (rb,'.DropDownGrp.GrpItem.DDBtn.MItem')eWC'RibbonMenuItem' 'Romance'('Event' 'Select' 'CB_Issue242_243SelectRomance')
 (rb,'.DropDownGrp.GrpItem.DDBtn.MItem')eWC'RibbonMenuItem' 'Thriller'('Event' 'Select' 'CB_Issue242_243SelectThriller')

⍝ Gallery _in_ the ribbon itself
⍝ NB that a full replication of all Windows ribbon functionality over time
⍝ would allow a gallery to be nested to an arbitrary depth within in a dropdown
⍝ button's menu of menus of menus.
⍝ Sample existing code shown uses plenty of convenience functions and is approx.
⍝ as follows (simplified for demonstration)
⍝  ⍝ Convenience function for new 'gallery bar' in Ribbon
⍝   btn←someRibbonControl CreateGalleryBar ⍝ ... options as positioned arguments
⍝  ⍝ Add button to group
⍝   btn.Gallery.Groups.Add(someGroup←⎕NEW GalleryItemGroup)
⍝ I think conceptually the below is close. The difference being the normal way
⍝ we have, so far, approached writing eWC code.
 (rb,'.GalleryGrp')eWC'RibbonGroup' 'Gallery' ('Size' 2) bordercol
 (rb,'.GalleryGrp.GrpItem')eWC'RibbonGroupItem' 12
 (rb,'.GalleryGrp.GrpItem.Gallery')eWC'RibbonGallery' 'Other' 'FcLock' 12 sel
 (rb,'.GalleryGrp.GrpItem.Gallery.MItem')eWC'RibbonMenuItem' 'Foobar' ('Rows' 2)('Cols' 3)('Event' 'Select' 'CB_Issue242_243GalleryItem')

⍝ NOTES:
⍝ Notably missing, and worth considering that they'll likely be required:
⍝  * A concept of a RibbonMenuGroup which wraps RibbonMenuItems - A menu may or
⍝    may not be split into groups. I believe bare items is fine.
⍝ Warnings on needing to reconcile with the Windows API:
⍝  * Almost all the ribbon components can be embedded within one another. For
⍝    example: DropDownButton can be a parent and a child of DropDownButton. It's
⍝    possible (theoretically) to recursive to any depth. Evidence of this being
⍝    actively used is probably necessary before we support this arbitrary
⍝    nesting.
cursork commented 3 weeks ago

Replaced by #69 which has more fixes