Open qPCR4vir opened 3 years ago
First of all, thanks for your efforet, very good idea!
no struct arg_menu ?
Because menu::item_proxy
is like a handle/proxy of a menu item, not an event_arg
.
really need 'linked'?
What does linked
mean? Does it mean that dropdown_item
directly refers to the shared command
?
I think it would be better to make dropdown_item
directly refers to the shared command
, in default, and make it Copy-on-Write. Then the redundant data members can be eliminated.
reuse renderer_interface?
Yes, the renderer is cloneable. We can make tiny changes based on the current renderer just with a small piece of code.
dropdown_item construct take a menu and vice ferse?
Sorry, I don't understand, would you please explain it.
really need 'linked'?
What does
linked
mean?
oh, sorry, I just wanted to know how menu_item_type::linked
member works.
Does it mean that
dropdown_item
directly refers to the sharedcommand
? I think it would be better to makedropdown_item
directly refers to the sharedcommand
, in default, and make it Copy-on-Write. Then the redundant data members can be eliminated.
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.
dropdown_item construct take a menu and vice verse?
Sorry, I don't understand, would you please explain it.
My bad. I mean that a sub-menu
and a toolbar
dropdown are both a kind of containers of "command-items" and it could be great if we could just pass a menu to toolbar::append or item_proxy::dropdown_append to add all the items in one instruction.
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:
menu
vs.toolbar
: toolbar is a widget, menu - not.menu
: hold a plain ptr to animplement
which use structures in adrawerbase::menu
namespace. The later includes amenu_type
,menu_item_type
, and the enumchecks
,menu_item_type
hold a plain pointer to amenu_type
and all the state-data of the item which can be acceded with anitem_proxy
which hold a pointer to themenu
and the position order of the item. A new item can be added withmenu::append
ormenu::insert
.toolbar
: thedrawer
hold a plain pointer to adrawer_impl_type
that hold anitem_container
oftoolbar_item
s. The later hold the state-data. A new item can be added withtoolbar::append
or withitem_proxy::dropdown_append
.button
: is awidget_object
class, which hold aDrawerTrigger
, a sharedEvents
and anscheme_type
scheme_
. The state-data is hold deeper in the windows structure (like the caption), and in these members. TheDrawerTrigger
holds aunique_ptr<impl>
that haveattributes
where the state-dataimage
,focused
,pushed
, etc are.checkbox
: is awidget_object
class, which hold aDrawerTrigger
, a sharedEvents
and anscheme_type
scheme_
. The state-data is hold deeper in the windows structure (like the caption), and in these members. TheDrawerTrigger
holds aunique_ptr<implement>
that haveelement::crook_interface::data data_;
where the state-datacheck_state { unchecked, checked, partial }
,radio
, etc are.[ ] Implement/use
checks
/tools
[x] create
command
: a no-widget class, wich state-data useful to set and to sharemenu
,toolbar
,button
andcheckbox
image
(a shared type),image
[ ] Make menu and toolbar API similar:
In
menu
:menu_type
menu_item_type
<---- real data here (generalize?)shared_command
shared_command
(to be used by other constructors)shared_command
(to be used by other constructors)image
In toolbar:
[ ] in
toolbar_item
<---- real data heretype, text, image and event
shared_command
shared_command
shared_command
(to be used by other constructors)[ ] in
dropdown_item
<---- real data heretype, text, image and event
shared_command
[x] add constructor that take a
shared_command
shared_command
(to be used by other constructors)[x] add
item_proxy& dropdown_append(shared_command command);
[x] add
item_proxy append(tools t, shared_command command);
[x] add
void insert(size_type pos, tools type, shared_command command)
item_proxy
[x] add
void push_back(tools type, shared_command command)
item_proxy
[ ]
dropdown_item
construct take amenu
and vice ferse?In
button
:[x] hold a
shared_command
[x] add constructor that take a
type, text, image and event
[x] create a
shared_command
[x] add constructor that take a
shared_command
[ ] set/get
shared_command
(to be used by other constructors)In
checkbox
:[ ] hold a shared_command
[ ] add constructor that take a
shared_command
[ ] set/get
shared_command
(to be used by other constructors)