Inv(#1020): erase arbitrary child widgets
This commit is contained in:
parent
8348696a56
commit
e4bf84657c
4 changed files with 34 additions and 5 deletions
|
|
@ -78,22 +78,29 @@ namespace panel {
|
|||
twoParts_.pack_start(buttons_, Gtk::PACK_SHRINK);
|
||||
twoParts_.pack_start(frame_);
|
||||
|
||||
buttons_.add(button_1_);
|
||||
buttons_.add(button_2_);
|
||||
buttons_.add(button_3_);
|
||||
buttons_.set_layout(Gtk::BUTTONBOX_START);
|
||||
|
||||
// buttons to trigger experiments
|
||||
button_1_.set_label("Experiment _1");
|
||||
button_1_.signal_clicked().connect(
|
||||
mem_fun(*this, &TimelinePanel::experiment_1));
|
||||
buttons_.add(button_1_);
|
||||
|
||||
button_2_.set_label("Experiment _2");
|
||||
button_2_.signal_clicked().connect(
|
||||
mem_fun(*this, &TimelinePanel::experiment_2));
|
||||
buttons_.add(button_2_);
|
||||
|
||||
button_3_.set_label("Experiment _3");
|
||||
button_3_.signal_clicked().connect(
|
||||
mem_fun(*this, &TimelinePanel::experiment_3));
|
||||
buttons_.add(button_3_);
|
||||
|
||||
button_4_.set_label("Experiment _4");
|
||||
button_4_.signal_clicked().connect(
|
||||
mem_fun(*this, &TimelinePanel::experiment_4));
|
||||
buttons_.add(button_4_);
|
||||
//(End)buttons...
|
||||
|
||||
frame_.add(scroller_);
|
||||
frame_.set_border_width(5);
|
||||
|
|
@ -170,6 +177,19 @@ namespace panel {
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
TimelinePanel::experiment_4()
|
||||
{
|
||||
frame_.set_label("Experiment 4...");
|
||||
uint killPos = rand() % childz_.size();
|
||||
ChildV::iterator killThat(&childz_[killPos]);
|
||||
ChildEx* victim = *killThat;
|
||||
childz_.erase (killThat);
|
||||
canvas_.remove (*victim);
|
||||
delete victim;
|
||||
}
|
||||
|
||||
|
||||
/* === Support for Investigation === */
|
||||
|
||||
namespace {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ namespace panel {
|
|||
* 5. bind signals to those widgets, to verify event dispatching
|
||||
* 6. bind some further signal(s) to the ~GtkLayout container
|
||||
* 7. hide and re-show a partially and a totally overlapped widget
|
||||
* 8. find a way to move a widget ✔
|
||||
* 8. find a way to move a widget ✔ and delete arbitrary widgets ✔
|
||||
* 9. expand an existing widget (text change)
|
||||
* 10. build a custom "clip" widget
|
||||
* 11. retrofit all preceding tests to use this "clip" widget
|
||||
|
|
@ -108,6 +108,7 @@ namespace panel {
|
|||
Gtk::Button button_1_;
|
||||
Gtk::Button button_2_;
|
||||
Gtk::Button button_3_;
|
||||
Gtk::Button button_4_;
|
||||
Gtk::Frame frame_;
|
||||
Gtk::ScrolledWindow scroller_;
|
||||
Gtk::Layout canvas_;
|
||||
|
|
@ -120,6 +121,7 @@ namespace panel {
|
|||
void experiment_1();
|
||||
void experiment_2();
|
||||
void experiment_3();
|
||||
void experiment_4();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2635,7 +2635,7 @@ In the most general case, there can be per-track content and nested content at t
|
|||
→ important question: how to [[organise the widgets|GuiTimelineWidgetStructure]]
|
||||
</pre>
|
||||
</div>
|
||||
<div title="GuiTimelineWidgetStructure" creator="Ichthyostega" modifier="Ichthyostega" created="201410250002" modified="201610290124" tags="GuiPattern discuss decision impl" changecount="44">
|
||||
<div title="GuiTimelineWidgetStructure" creator="Ichthyostega" modifier="Ichthyostega" created="201410250002" modified="201610291403" tags="GuiPattern discuss decision impl" changecount="45">
|
||||
<pre>The Timeline is probably the most prominent place in the GUI where we need to come up with a custom UI design.
|
||||
Instead of combining standard components in one of the well-known ways, here we need to come up with our own handling solution -- which also means to write one or several custom GTK widgets. Thus the question of layout and screen space division and organisation becomes a crucial design decision. The ~GTK-2 Gui, as implemented currently, did already take some steps along this route, yet this kind of decision should be cast and documented explicitly (be it after the fact).
|
||||
|
||||
|
|
@ -2702,6 +2702,10 @@ In order to build a sensible plan for our timeline structure, we need to investi
|
|||
:children added later are always on top.
|
||||
;moving child widgets
|
||||
:works as expected
|
||||
;delete child widgets
|
||||
:is possible by the {{{Container::remove(Widget*)}}} function
|
||||
:removed child widgets will also removed from display (hidden)
|
||||
:but the widget object needs to be deleted manually, because detached widgets are no longer managed by GTK
|
||||
;iteration over child widgets
|
||||
:problematic
|
||||
:* the signal based {{{foreach}}} does not work -- there seems to be a problem with the slot's signature causing a wrong address to be passed in
|
||||
|
|
|
|||
|
|
@ -9401,6 +9401,9 @@
|
|||
<node CREATED="1477748350140" ID="ID_1672717051" MODIFIED="1477748361823" TEXT="align all in a row">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node CREATED="1477749635577" ID="ID_592134506" MODIFIED="1477749644284" TEXT="delete arbitrary children">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1477595418670" ID="ID_1275908576" MODIFIED="1477596119218" TEXT="# expand an existing widget (text change)">
|
||||
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue