FLUID: Adds missing code for Grid and Flex live: #1092
This commit is contained in:
parent
fb5c652200
commit
2228ec22d7
@ -303,13 +303,39 @@ void Fl_Grid_Type::copy_properties()
|
||||
{
|
||||
super::copy_properties();
|
||||
Fl_Grid *d = (Fl_Grid*)live_widget, *s =(Fl_Grid*)o;
|
||||
d->layout(s->rows(), s->cols());
|
||||
int lm, tm, rm, bm;
|
||||
s->margin(&lm, &tm, &rm, &bm);
|
||||
d->margin(lm, tm, rm, bm);
|
||||
int rg, cg;
|
||||
s->gap(&rg, &cg);
|
||||
d->gap(rg, cg);
|
||||
// TODO: lots to do!
|
||||
// copy col widths, heights, and gaps
|
||||
for (int c=0; c<s->cols(); c++) {
|
||||
d->col_width(c, s->col_width(c));
|
||||
d->col_gap(c, s->col_gap(c));
|
||||
d->col_weight(c, s->col_weight(c));
|
||||
}
|
||||
// copy row widths, heights, and gaps
|
||||
for (int r=0; r<s->rows(); r++) {
|
||||
d->row_height(r, s->row_height(r));
|
||||
d->row_gap(r, s->row_gap(r));
|
||||
d->row_weight(r, s->row_weight(r));
|
||||
}
|
||||
}
|
||||
|
||||
void Fl_Grid_Type::copy_properties_for_children() {
|
||||
Fl_Grid *d = (Fl_Grid*)live_widget, *s =(Fl_Grid*)o;
|
||||
for (int i=0; i<s->children(); i++) {
|
||||
Fl_Grid::Cell *cell = s->cell(s->child(i));
|
||||
if (cell && i<d->children()) {
|
||||
d->widget(d->child(i),
|
||||
cell->row(), cell->col(),
|
||||
cell->rowspan(), cell->colspan(),
|
||||
cell->align());
|
||||
}
|
||||
}
|
||||
d->layout();
|
||||
}
|
||||
|
||||
void Fl_Grid_Type::write_properties(Fd_Project_Writer &f)
|
||||
|
||||
@ -64,6 +64,7 @@ public:
|
||||
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
|
||||
void leave_live_mode() FL_OVERRIDE;
|
||||
void copy_properties() FL_OVERRIDE;
|
||||
void copy_properties_for_children() FL_OVERRIDE;
|
||||
void write_code1(Fd_Code_Writer& f) FL_OVERRIDE;
|
||||
void write_code2(Fd_Code_Writer& f) FL_OVERRIDE;
|
||||
void add_child(Fl_Type*, Fl_Type*) FL_OVERRIDE;
|
||||
|
||||
@ -334,6 +334,20 @@ void Fl_Flex_Type::copy_properties()
|
||||
d->gap( s->gap() );
|
||||
}
|
||||
|
||||
void Fl_Flex_Type::copy_properties_for_children() {
|
||||
Fl_Flex *d = (Fl_Flex*)live_widget, *s =(Fl_Flex*)o;
|
||||
for (int i=0; i<s->children(); i++) {
|
||||
if (s->fixed(s->child(i)) && i<d->children()) {
|
||||
if (s->horizontal()) {
|
||||
d->fixed(d->child(i), d->child(i)->w());
|
||||
} else {
|
||||
d->fixed(d->child(i), d->child(i)->h());
|
||||
}
|
||||
}
|
||||
}
|
||||
d->layout();
|
||||
}
|
||||
|
||||
void Fl_Flex_Type::write_properties(Fd_Project_Writer &f)
|
||||
{
|
||||
Fl_Group_Type::write_properties(f);
|
||||
|
||||
@ -118,6 +118,7 @@ public:
|
||||
void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE;
|
||||
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
|
||||
void copy_properties() FL_OVERRIDE;
|
||||
void copy_properties_for_children() FL_OVERRIDE;
|
||||
void postprocess_read() FL_OVERRIDE;
|
||||
void write_code2(Fd_Code_Writer& f) FL_OVERRIDE;
|
||||
// void add_child(Fl_Type*, Fl_Type*) FL_OVERRIDE;
|
||||
|
||||
@ -253,6 +253,7 @@ public:
|
||||
virtual Fl_Widget *enter_live_mode(int top=0); // build widgets needed for live mode
|
||||
virtual void leave_live_mode(); // free allocated resources
|
||||
virtual void copy_properties(); // copy properties from this type into a potential live object
|
||||
virtual void copy_properties_for_children() { } // copy remaining properties after children were added
|
||||
|
||||
// get message number for I18N
|
||||
int msgnum();
|
||||
|
||||
@ -3834,6 +3834,8 @@ Fl_Widget* Fl_Widget_Type::propagate_live_mode(Fl_Group* grp) {
|
||||
}
|
||||
}
|
||||
grp->end();
|
||||
live_widget = grp;
|
||||
copy_properties_for_children();
|
||||
return live_widget;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user