Introduce command to share with menu and toolbar#609
Introduce command to share with menu and toolbar#609qPCR4vir wants to merge 19 commits intocnjinhao:develop-1.8from
Conversation
|
First of all, thanks for your efforet, very good idea!
Because
What does
Yes, the renderer is cloneable. We can make tiny changes based on the current renderer just with a small piece of code.
Sorry, I don't understand, would you please explain it. |
oh, sorry, I just wanted to know how
yes, something like that is a good solution! It is not trivial to have a really good solution. I only implemented the simplest possibility, and then, maybe, you will have some day time to make it better! I will try to implement a few more details, but for a robust design one need more experience.
My bad. I mean that a sub- |
# Conflicts: # build/vc2022/nana.vcxproj # build/vc2022/nana.vcxproj.filters
Hi,
The goal of this PR is to:
Introduce command to share with menu, toolbar, button and checkbox
please, compare: widget_show2 manual item creation
with: widget_show2 created with command
This is my first version, and you will need to review and redesign a few thing in it, but I hope this is the first draft of what we wanted. Maybe the correct way is to create a command "interface" to add to any of the supported classes?
First just I will try to compare/document the possible affected parts:
menuvs.toolbar:toolbar is a widget, menu - not.
menu: hold a plain ptr to animplementwhich use structures in adrawerbase::menunamespace.The later includes a
menu_type,menu_item_type, and the enumchecks,menu_item_typehold a plain pointer to amenu_typeand all the state-data of the item which can be acceded with anitem_proxywhich hold a pointer to themenuand the position order of the item.A new item can be added with
menu::appendormenu::insert.toolbar: thedrawerhold a plain pointer to adrawer_impl_typethat hold anitem_containeroftoolbar_items. The later hold the state-data.A new item can be added with
toolbar::appendor withitem_proxy::dropdown_append.button: is awidget_objectclass, which hold aDrawerTrigger, a sharedEventsand anscheme_typescheme_. The state-data is hold deeper in the windows structure (like the caption), and in these members. TheDrawerTriggerholds aunique_ptr<impl>that haveattributeswhere the state-dataimage,focused,pushed, etc are.checkbox: is awidget_objectclass, which hold aDrawerTrigger, a sharedEventsand anscheme_typescheme_. The state-data is hold deeper in the windows structure (like the caption), and in these members. TheDrawerTriggerholds aunique_ptr<implement>that haveelement::crook_interface::data data_;where the state-datacheck_state { unchecked, checked, partial },radio, etc are.Implement/use
checks/toolscreate
command: a no-widget class, wich state-data useful to set and to sharemenu,toolbar,buttonandcheckboximage(a shared type),imageMake menu and toolbar API similar:
menu:menu_typemenu_item_type<---- real data here (generalize?)shared_commandshared_command(to be used by other constructors)shared_command(to be used by other constructors)imagetoolbar_item<---- real data heretype, text, image and eventshared_commandshared_commandshared_command(to be used by other constructors)dropdown_item<---- real data heretype, text, image and eventshared_commandshared_commandshared_command(to be used by other constructors)item_proxy& dropdown_append(shared_command command);item_proxy append(tools t, shared_command command);void insert(size_type pos, tools type, shared_command command)item_proxyvoid push_back(tools type, shared_command command)item_proxydropdown_itemconstruct take amenuand vice ferse?button:shared_commandtype, text, image and eventshared_commandshared_commandshared_command(to be used by other constructors)checkbox:shared_commandshared_command(to be used by other constructors)