Browse Source

FLUID: New layout of Grid tab.

pull/800/head
Matthias Melcher 2 years ago
parent
commit
bf62959f1f
  1. 173
      fluid/Fl_Grid_Type.cxx
  2. 2
      fluid/Fl_Grid_Type.h
  3. 1
      fluid/custom_widgets.cxx
  4. 964
      fluid/widget_panel.cxx
  5. 703
      fluid/widget_panel.fl
  6. 32
      fluid/widget_panel.h

173
fluid/Fl_Grid_Type.cxx

@ -393,102 +393,11 @@ void Fl_Grid_Type::child_resized(Fl_Widget_Type *child_type) { @@ -393,102 +393,11 @@ void Fl_Grid_Type::child_resized(Fl_Widget_Type *child_type) {
// TODO: if the user resizes an FL_GRID_FILL widget, should we change the alignment?
}
void grid_cb(Fl_Value_Input* i, void* v, int what) {
if (v == LOAD) {
if (current_widget->is_a(ID_Grid)) {
int v;
Fl_Grid *g = ((Fl_Grid*)current_widget->o);
switch (what) {
case 0: g->margin(&v, NULL, NULL, NULL); break;
case 1: g->margin(NULL, &v, NULL, NULL); break;
case 2: g->margin(NULL, NULL, &v, NULL); break;
case 3: g->margin(NULL, NULL, NULL, &v); break;
case 4: g->gap(&v, NULL); break;
case 5: g->gap(NULL, &v); break;
}
i->value(v);
}
} else {
int mod = 0;
int v = (int)i->value();
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_a(ID_Grid)) {
Fl_Grid *g = ((Fl_Grid*)(((Fl_Widget_Type*)o)->o));
switch (what) {
case 0: g->margin(v, -1, -1, -1); break;
case 1: g->margin(-1, v, -1, -1); break;
case 2: g->margin(-1, -1, v, -1); break;
case 3: g->margin(-1, -1, -1, v); break;
case 4: g->gap(v, -1); break;
case 5: g->gap(-1, v); break;
}
g->need_layout(true);
g->redraw();
mod = 1;
}
}
if (mod) set_modflag(1);
}
}
void grid_margin_left_cb(Fl_Value_Input* i, void* v) {
grid_cb(i, v, 0);
}
void grid_margin_top_cb(Fl_Value_Input* i, void* v) {
grid_cb(i, v, 1);
}
void grid_margin_right_cb(Fl_Value_Input* i, void* v) {
grid_cb(i, v, 2);
}
void grid_margin_bottom_cb(Fl_Value_Input* i, void* v) {
grid_cb(i, v, 3);
}
void grid_row_gap_cb(Fl_Value_Input* i, void* v) {
grid_cb(i, v, 4);
}
void grid_col_gap_cb(Fl_Value_Input* i, void* v) {
grid_cb(i, v, 5);
}
void grid_cb(Fluid_Coord_Input* i, void* v, int what) {
if (v == LOAD) {
if (current_widget->is_a(ID_Grid)) {
int v = 0;
Fl_Grid *g = ((Fl_Grid*)current_widget->o);
switch (what) {
case 6: v = g->rows(); break;
case 7: v = g->cols(); break;
}
i->value(v);
}
} else {
int mod = 0;
int old_v = 0, v = (int)i->value();
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_a(ID_Grid)) {
Fl_Grid *g = ((Fl_Grid*)(((Fl_Widget_Type*)o)->o));
switch (what) {
case 6: old_v = g->rows(); break;
case 7: old_v = g->cols(); break;
}
if (old_v != v) {
switch (what) {
case 6: g->layout(v, g->cols()); break;
case 7: g->layout(g->rows(), v); break;
}
g->need_layout(true);
g->redraw();
mod = 1;
}
}
}
if (mod) set_modflag(1);
}
}
void grid_rows_cb(Fluid_Coord_Input* i, void* v) {
grid_cb(i, v, 6);
}
void grid_cols_cb(Fluid_Coord_Input* i, void* v) {
grid_cb(i, v, 7);
/** Return the currently selected Grid widget if is a Grid Type. */
Fl_Grid *Fl_Grid_Type::selected() {
if (current_widget && current_widget->is_a(ID_Grid))
return ((Fl_Grid*)((Fl_Grid_Type*)current_widget)->o);
return NULL;
}
extern Fluid_Coord_Input *widget_grid_row_input, *widget_grid_col_input;
@ -616,75 +525,3 @@ void grid_align_cb(Fl_Choice* i, void* v) { @@ -616,75 +525,3 @@ void grid_align_cb(Fl_Choice* i, void* v) {
}
}
}
void grid_row_col_cb(Fluid_Coord_Input* i, void* v, int what) {
if ( !current_widget
|| !current_widget->parent
|| !current_widget->parent->is_a(ID_Grid))
{
return;
}
Fl_Grid *g = ((Fl_Grid*)((Fl_Widget_Type*)current_widget->parent)->o);
Fl_Grid::Cell *cell = g->cell(current_widget->o);
if (v == LOAD) {
if (cell) {
int v = 0;
switch (what) {
case 0: v = g->row_height(cell->row()); break;
case 1: v = g->row_weight(cell->row()); break;
case 2: v = g->row_gap(cell->row()); break;
case 3: v = g->col_width(cell->col()); break;
case 4: v = g->col_weight(cell->col()); break;
case 5: v = g->col_gap(cell->col()); break;
}
i->value(v);
i->activate();
} else {
i->deactivate();
}
} else {
if (cell) {
int v = i->value(), old_v = 0;
switch (what) {
case 0: old_v = g->row_height(cell->row()); break;
case 1: old_v = g->row_weight(cell->row()); break;
case 2: old_v = g->row_gap(cell->row()); break;
case 3: old_v = g->col_width(cell->col()); break;
case 4: old_v = g->col_weight(cell->col()); break;
case 5: old_v = g->col_gap(cell->col()); break;
}
if (old_v != v) {
switch (what) {
case 0: g->row_height(cell->row(), v); break;
case 1: g->row_weight(cell->row(), v); break;
case 2: g->row_gap(cell->row(), v); break;
case 3: g->col_width(cell->col(), v); break;
case 4: g->col_weight(cell->col(), v); break;
case 5: g->col_gap(cell->col(), v); break;
}
g->need_layout(true);
g->redraw();
set_modflag(1);
}
}
}
}
void grid_row_height(Fluid_Coord_Input* i, void* v) {
grid_row_col_cb(i, v, 0);
}
void grid_row_weight(Fluid_Coord_Input* i, void* v) {
grid_row_col_cb(i, v, 1);
}
void grid_row_gap(Fluid_Coord_Input* i, void* v) {
grid_row_col_cb(i, v, 2);
}
void grid_col_width(Fluid_Coord_Input* i, void* v) {
grid_row_col_cb(i, v, 3);
}
void grid_col_weight(Fluid_Coord_Input* i, void* v) {
grid_row_col_cb(i, v, 4);
}
void grid_col_gap(Fluid_Coord_Input* i, void* v) {
grid_row_col_cb(i, v, 5);
}

2
fluid/Fl_Grid_Type.h

@ -45,6 +45,8 @@ public: @@ -45,6 +45,8 @@ public:
void move_child(Fl_Type*, Fl_Type*) FL_OVERRIDE;
void remove_child(Fl_Type*) FL_OVERRIDE;
void child_resized(Fl_Widget_Type *child);
static class Fl_Grid *selected();
};
#endif // _FLUID_FL_GRID_TYPE_H

1
fluid/custom_widgets.cxx

@ -142,6 +142,7 @@ vars_(0L), @@ -142,6 +142,7 @@ vars_(0L),
vars_user_data_(0L)
{
Fl_Input::callback((Fl_Callback*)callback_handler_cb);
text("0");
}
void Fluid_Coord_Input::callback_handler_cb(Fluid_Coord_Input *This, void *v) {

964
fluid/widget_panel.cxx

File diff suppressed because it is too large Load Diff

703
fluid/widget_panel.fl

@ -2,6 +2,11 @@ @@ -2,6 +2,11 @@
version 1.0400
header_name {.h}
code_name {.cxx}
snap {
ver 1
current_suite FLTK
current_preset 1
}
comment {//
// Widget panel for the Fast Light Tool Kit (FLTK).
//
@ -20,21 +25,54 @@ comment {// @@ -20,21 +25,54 @@ comment {//
} {in_source in_header
}
decl {\#include "undo.h"} {private global
}
decl {\#include "Fl_Widget_Type.h"} {private global
}
decl {\#include "Fl_Grid_Type.h"} {private global
}
decl {\#include <FL/Fl_Grid.H>} {private global
}
decl {\#include "custom_widgets.h"} {public global
}
decl {extern void set_modflag(int mf, int mfc=-1);} {private local
}
Function {make_window()} {open
} {
Fl_Window {} {open
xywh {867 441 480 320} type Double visible
} {
Fl_Grid {} {open
xywh {25 25 240 160} labelsize 11
dimensions {3 3} margin {10 8 11 12}
rowgaps { 3 -1 -1 }
colwidths { 0 100 0 }
colweights { 50 40 50 }
colgaps { 1 3 -1 }
} {
Fl_Button {} {
label Button
xywh {77 75 133 59} labelsize 11
parent_properties {
location {1 1}
}
}
}
}
}
Function {make_widget_panel()} {
comment {Create a panel that can be used with all known widgets} open
} {
Fl_Window {} {
comment {Use a Double Window to avoid flickering.} open
xywh {566 244 420 400} type Double labelsize 11 align 80 resizable hotspot
xywh {413 247 420 400} type Double labelsize 11 align 80 resizable hotspot
code0 {o->size_range(o->w(), o->h());} size_range {420 400 0 0} visible
} {
Fl_Tabs widget_tabs {
@ -44,7 +82,7 @@ Function {make_widget_panel()} { @@ -44,7 +82,7 @@ Function {make_widget_panel()} {
} {
Fl_Group {} {
label GUI
callback propagate_load open
callback propagate_load selected
xywh {10 30 400 330} labelsize 11 when 0 resizable
} {
Fl_Group {} {
@ -666,7 +704,7 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize @@ -666,7 +704,7 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize
}
Fl_Group {} {
label {C++}
callback propagate_load open
callback propagate_load
xywh {10 30 400 330} labelsize 11 when 0 hide
} {
Fl_Group {} {
@ -818,48 +856,64 @@ wCallback->do_callback(wCallback, v);} open @@ -818,48 +856,64 @@ wCallback->do_callback(wCallback, v);} open
}
}
}
}
Fl_Tabs widget_tabs_repo {open selected
xywh {10 10 400 350} hide
code0 {o->hide();}
} {
Fl_Group {} {open
xywh {10 30 400 330} hide resizable
} {}
Fl_Group widget_tab_grid_child {
label {Grid Child}
callback propagate_load open
xywh {10 30 400 330} labelsize 11 hide
} {
Fl_Box {} {
label {The Fl_Grid implementation in FLUID is still experimental!}
xywh {25 43 370 28} labelfont 1 labelsize 11 labelcolor 1
}
Fl_Box {} {
label {-- Widget --}
xywh {96 74 155 20} labelfont 1 labelsize 12 align 20
}
Fl_Group {} {
label {Location:}
callback propagate_load open
xywh {96 110 314 20} labelfont 1 labelsize 11 align 4
xywh {95 60 315 20} labelfont 1 labelsize 11 align 4
} {
Fl_Input widget_grid_row_input {
label {Row:}
callback grid_set_row_cb
xywh {96 110 55 20} labelsize 11 align 5 textsize 11
xywh {95 60 40 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Group {} {open
xywh {135 60 30 20}
} {
Fl_Button {} {
label {-}
xywh {135 60 15 20} labelsize 11 hide compact 1
}
Fl_Button {} {
label {+}
xywh {150 60 15 20} labelsize 11 hide compact 1
}
}
Fl_Input widget_grid_col_input {
label {Column:}
callback grid_set_col_cb
xywh {156 110 55 20} labelsize 11 align 5 textsize 11
xywh {175 60 40 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Group {} {open
xywh {215 60 30 20}
} {
Fl_Button {} {
label {-}
xywh {215 60 15 20} labelsize 11 hide compact 1
}
Fl_Button {} {
label {+}
xywh {230 60 15 20} labelsize 11 hide compact 1
}
}
Fl_Box {} {
xywh {395 60 1 20} hide resizable
}
}
Fl_Group {} {
label {Align:}
callback propagate_load open
xywh {95 90 315 20} labelfont 1 labelsize 11 align 4
} {
Fl_Choice {} {
label {Align:}
callback grid_align_cb
xywh {215 110 185 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11
xywh {95 90 160 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11
} {
MenuItem {} {
label GRID_CENTER
@ -923,181 +977,566 @@ wCallback->do_callback(wCallback, v);} open @@ -923,181 +977,566 @@ wCallback->do_callback(wCallback, v);} open
}
}
Fl_Box {} {
xywh {400 110 1 20} hide resizable
xywh {395 90 1 20} hide resizable
}
}
Fl_Group {} {
label {Cell Span:}
callback propagate_load
xywh {96 145 314 20} labelfont 1 labelsize 11 align 4
} {
Fl_Box {} {
xywh {400 145 1 20} hide resizable
}
Fl_Input {} {
label {Row Span:}
callback grid_set_rowspan_cb
xywh {96 145 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Input {} {
label {Col Span:}
callback grid_set_colspan_cb
xywh {156 145 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
}
Fl_Group {} {
label {Size:}
callback propagate_load
xywh {96 180 314 20} labelfont 1 labelsize 11 align 4
label {Min. Size:}
callback propagate_load open
xywh {95 125 315 20} labelfont 1 labelsize 11 align 4
} {
Fl_Box {} {
xywh {400 180 1 20} hide resizable
}
Fl_Input {} {
label {Min.Width:}
label {Width:}
callback grid_set_min_wdt_cb
xywh {96 180 55 20} labelsize 11 align 5 textsize 11
xywh {95 125 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Input {} {
label {Min.Height:}
label {Height:}
callback grid_set_min_hgt_cb
xywh {156 180 55 20} labelsize 11 align 5 textsize 11
xywh {155 125 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
}
}
Fl_Group widget_tab_grid {
label Grid
callback propagate_load open
xywh {10 30 400 330} labelsize 11
} {
Fl_Box {} {
label {The Fl_Grid implementation in FLUID is still experimental!}
xywh {25 43 370 28} labelfont 1 labelsize 11 labelcolor 1
Fl_Box {} {
xywh {395 125 1 20} hide resizable
}
}
Fl_Group {} {
label {Row:}
label {Cell Span:}
callback propagate_load open
xywh {96 170 314 20} labelfont 1 labelsize 11 align 4
xywh {95 160 315 20} labelfont 1 labelsize 11 align 4
} {
Fl_Input {} {
label Index
xywh {96 170 55 20} labelsize 11 align 5 textsize 11 deactivate
label {Rows:}
callback grid_set_rowspan_cb
xywh {95 160 40 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Input {} {
label {Height:}
callback grid_row_height
xywh {156 170 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
Fl_Group {} {open
xywh {135 160 30 20}
} {
Fl_Button {} {
label {-}
xywh {135 160 15 20} labelsize 11 hide compact 1
}
Fl_Button {} {
label {+}
xywh {150 160 15 20} labelsize 11 hide compact 1
}
}
Fl_Input {} {
label {Weight:}
callback grid_row_weight
xywh {216 170 55 20} labelsize 11 align 5 textsize 11
label {Columns:}
callback grid_set_colspan_cb
xywh {175 160 40 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Input {} {
label {Gap:}
callback grid_row_gap
xywh {276 170 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
Fl_Group {} {open
xywh {215 160 30 20}
} {
Fl_Button {} {
label {-}
xywh {215 160 15 20} labelsize 11 hide compact 1
}
Fl_Button {} {
label {+}
xywh {230 160 15 20} labelsize 11 hide compact 1
}
}
Fl_Box {} {
xywh {400 170 1 20} hide resizable
xywh {395 160 1 20} hide resizable
}
}
Fl_Box {} {
xywh {95 350 300 5} labelsize 11 hide resizable
}
}
Fl_Group widget_tab_grid {
label Grid
callback propagate_load open
xywh {10 30 400 330} labelsize 11 hide
} {
Fl_Group {} {
label {Column:}
label {Grid Layout:}
callback propagate_load open
xywh {96 205 314 20} labelfont 1 labelsize 11 align 4
xywh {95 60 315 20} labelfont 1 labelsize 11 align 4
} {
Fl_Input {} {
label Index
xywh {96 205 55 20} labelsize 11 align 5 textsize 11 deactivate
Fl_Input widget_grid_rows {
label {Rows:}
callback {// grid_rows_cb
Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
if (v == LOAD) {
o->value(grid->rows());
} else {
int m = o->value(), old_m = grid->rows();
if (m < 1) {
m = 1;
o->value(m);
}
if (m < old_m) {
// TODO: verify that this will not unlink existings cells
// Offer a dialog with "delete children", "unlink cells", "cancel"
}
if (m != old_m) {
undo_checkpoint();
grid->layout(m, grid->cols());
grid->need_layout(true);
set_modflag(1);
widget_tab_grid->do_callback(widget_tab_grid, LOAD);
}
}}
tooltip {Number of horizontal rows in the Grid group} xywh {95 60 40 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Input {} {
label {Width:}
callback grid_col_width
xywh {156 205 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
Fl_Group {} {open
xywh {135 60 30 20}
} {
Fl_Button {} {
label {-}
callback {if (v != LOAD) {
widget_grid_rows->value( widget_grid_rows->value()-1 );
widget_grid_rows->do_callback();
}}
xywh {135 60 15 20} labelsize 11
code0 {o->clear_visible_focus();} compact 1
}
Fl_Button {} {
label {+}
callback {if (v != LOAD) {
widget_grid_rows->value( widget_grid_rows->value()+1 );
widget_grid_rows->do_callback();
}}
xywh {150 60 15 20} labelsize 11
code0 {o->clear_visible_focus();} compact 1
}
}
Fl_Input {} {
label {Weight:}
callback grid_col_weight
xywh {216 205 55 20} labelsize 11 align 5 textsize 11
Fl_Input widget_grid_cols {
label {Columns:}
callback {// grid_rows_cb
Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
if (v == LOAD) {
o->value(grid->cols());
} else {
int m = o->value(), old_m = grid->cols();
if (m < 1) {
m = 1;
o->value(m);
}
if (m < old_m) {
// TODO: verify that this will not unlink existings cells
// Offer a dialog with "delete children", "unlink cells", "cancel"
}
if (m != old_m) {
undo_checkpoint();
grid->layout(grid->rows(), m);
grid->need_layout(true);
set_modflag(1);
widget_tab_grid->do_callback(widget_tab_grid, LOAD);
}
}}
tooltip {Number of vertical columns in the Grid group} xywh {175 60 40 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Input {} {
label {Gap:}
callback grid_col_gap
xywh {276 205 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
Fl_Group {} {open
xywh {215 60 30 20}
} {
Fl_Button {} {
label {-}
callback {if (v != LOAD) {
widget_grid_cols->value( widget_grid_cols->value()-1 );
widget_grid_cols->do_callback();
}}
xywh {215 60 15 20} labelsize 11
code0 {o->clear_visible_focus();} compact 1
}
Fl_Button {} {
label {+}
callback {if (v != LOAD) {
widget_grid_cols->value( widget_grid_cols->value()+1 );
widget_grid_cols->do_callback();
}}
xywh {230 60 15 20} labelsize 11
code0 {o->clear_visible_focus();} compact 1
}
}
Fl_Box {} {
xywh {400 205 1 20} hide resizable
xywh {396 60 0 20} resizable
}
}
Fl_Group {} {
label {Grid Margins:
Layout:}
label {Margin:}
callback propagate_load open
xywh {96 97 300 55} labelfont 1 labelsize 11 align 4
xywh {95 100 315 20} labelfont 1 labelsize 11 align 4
} {
Fl_Value_Input {} {
label {Left:}
callback grid_margin_left_cb
tooltip {Left margin in group.} xywh {96 97 45 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11
callback {Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
int m = 0;
if (v == LOAD) {
grid->margin(&m, NULL, NULL, NULL);
o->value(m);
} else {
int m = o->value(), old_m;
grid->margin(&old_m, NULL, NULL, NULL);
if (m != old_m) {
grid->margin(m, -1, -1, -1);
grid->need_layout(true);
set_modflag(1);
}
}}
tooltip {Left margin in group.} xywh {95 100 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11
}
Fl_Value_Input {} {
label {Top:}
callback grid_margin_top_cb
tooltip {Top margin in group.} xywh {145 97 45 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11
callback {Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
int m = 0;
if (v == LOAD) {
grid->margin(NULL, &m, NULL, NULL);
o->value(m);
} else {
int m = o->value(), old_m;
grid->margin(NULL, &old_m, NULL, NULL);
if (m != old_m) {
grid->margin(-1, m, -1, -1);
grid->need_layout(true);
set_modflag(1);
}
}}
tooltip {Top margin in group.} xywh {155 100 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11
}
Fl_Value_Input {} {
label {Right:}
callback grid_margin_right_cb
tooltip {Right margin in group.} xywh {194 97 45 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11
callback {Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
int m = 0;
if (v == LOAD) {
grid->margin(NULL, NULL, &m, NULL);
o->value(m);
} else {
int m = o->value(), old_m;
grid->margin(NULL, NULL, &old_m, NULL);
if (m != old_m) {
grid->margin(-1, -1, m, -1);
grid->need_layout(true);
set_modflag(1);
}
}}
tooltip {Right margin in group.} xywh {215 100 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11
}
Fl_Value_Input {} {
label {Bottom:}
callback grid_margin_bottom_cb
tooltip {Bottom margin in group.} xywh {243 97 45 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11
callback {Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
int m = 0;
if (v == LOAD) {
grid->margin(NULL, NULL, NULL, &m);
o->value(m);
} else {
int m = o->value(), old_m;
grid->margin(NULL, NULL, NULL, &old_m);
if (m != old_m) {
grid->margin(-1, -1, -1, m);
grid->need_layout(true);
set_modflag(1);
}
}}
tooltip {Bottom margin in group.} xywh {275 100 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11
}
Fl_Box {} {
xywh {396 100 0 20} resizable
}
}
Fl_Group {} {
label {Gaps:}
callback propagate_load open
xywh {95 135 315 20} labelfont 1 labelsize 11 align 4
} {
Fl_Value_Input {} {
label {RowGap:}
callback grid_row_gap_cb
tooltip {Gap between children.} xywh {292 97 45 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11
label {Row:}
callback {Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
int m = 0;
if (v == LOAD) {
grid->gap(&m, NULL);
o->value(m);
} else {
int m = o->value(), old_m;
grid->gap(&old_m, NULL);
if (m != old_m) {
grid->gap(m, -1);
grid->need_layout(true);
set_modflag(1);
}
}}
tooltip {Gap between children.} xywh {95 135 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11
}
Fl_Value_Input {} {
label {ColGap:}
callback grid_col_gap_cb
tooltip {Gap between children.} xywh {341 97 45 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11
label {Col:}
callback {Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
int m = 0;
if (v == LOAD) {
grid->gap(NULL, &m);
o->value(m);
} else {
int m = o->value(), old_m;
grid->gap(NULL, &old_m);
if (m != old_m) {
grid->gap(-1, m);
grid->need_layout(true);
set_modflag(1);
}
}}
tooltip {Gap between children.} xywh {155 135 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11
}
Fl_Box {} {
xywh {396 97 0 20} resizable
xywh {396 135 0 20} resizable
}
Fl_Input {} {
label {Rows:}
callback grid_rows_cb
tooltip {Number of horizontal rows in the Grid group} xywh {96 132 55 20} labelsize 11 align 5 textsize 11
}
Fl_Group {} {
label {Row:}
callback {if (v == LOAD) {
Fl_Grid *grid = Fl_Grid_Type::selected();
if (grid)
o->activate();
else
o->deactivate();
propagate_load(o, v);
}} open
xywh {95 175 315 20} labelfont 1 labelsize 11 align 4
} {
Fl_Input widget_grid_curr_row {
label Index
callback {Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
int r = o->value(), old_r = r;
if (r < 0) r = 0;
if (r >= grid->rows()) r = grid->rows()-1;
if (r != old_r) o->value(r);
if (v == LOAD) {
// will automatically propagate
} else {
widget_grid_curr_row_attributes->do_callback(widget_grid_curr_row_attributes, LOAD);
}}
xywh {95 175 40 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Input {} {
label {Columns:}
callback grid_cols_cb
tooltip {Number of vertical columns in the Grid group} xywh {155 132 55 20} labelsize 11 align 5 textsize 11
Fl_Group {} {
callback propagate_load open
xywh {135 175 30 20}
} {
Fl_Button {} {
label {-}
callback {if (v != LOAD) {
widget_grid_curr_row->value( widget_grid_curr_row->value()-1 );
widget_grid_curr_row->do_callback();
}}
xywh {135 175 15 20} labelsize 11
code0 {o->clear_visible_focus();} compact 1
}
Fl_Button {} {
label {+}
callback {if (v != LOAD) {
widget_grid_curr_row->value( widget_grid_curr_row->value()+1 );
widget_grid_curr_row->do_callback();
}}
xywh {150 175 15 20} labelsize 11
code0 {o->clear_visible_focus();} compact 1
}
}
Fl_Box {} {
label {:}
xywh {165 175 15 20} labelsize 11
}
Fl_Group widget_grid_curr_row_attributes {
callback propagate_load open
xywh {180 175 175 20}
} {
Fl_Input {} {
label {Height:}
callback {Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
int r = widget_grid_curr_row->value();
if (v == LOAD) {
o->value(grid->row_height(r));
} else {
int h = o->value(), old_h = grid->row_height(r);
if (h != old_h) {
grid->row_height(r, h);
grid->need_layout(true);
set_modflag(1);
}
}}
xywh {180 175 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Input {} {
label {Weight:}
callback {Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
int r = widget_grid_curr_row->value();
if (v == LOAD) {
o->value(grid->row_weight(r));
} else {
int h = o->value(), old_h = grid->row_weight(r);
if (h != old_h) {
grid->row_weight(r, h);
grid->need_layout(true);
set_modflag(1);
}
}}
xywh {240 175 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Input {} {
label {Gap:}
callback {Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
int r = widget_grid_curr_row->value();
if (v == LOAD) {
o->value(grid->row_gap(r));
} else {
int h = o->value(), old_h = grid->row_gap(r);
if (h != old_h) {
grid->row_gap(r, h);
grid->need_layout(true);
set_modflag(1);
}
}}
xywh {300 175 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
}
Fl_Box {} {
xywh {400 175 1 20} hide resizable
}
}
Fl_Group {} {
label {Column:}
callback propagate_load open
xywh {95 210 315 20} labelfont 1 labelsize 11 align 4
} {
Fl_Input widget_grid_curr_col {
label Index
callback {Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
int c = o->value(), old_c = c;
if (c < 0) c = 0;
if (c >= grid->cols()) c = grid->cols()-1;
if (c != old_c) o->value(c);
if (v == LOAD) {
// will automatically propagate
} else {
widget_grid_curr_col_attributes->do_callback(widget_grid_curr_col_attributes, LOAD);
}}
xywh {95 210 40 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Group {} {open
xywh {135 210 30 20}
} {
Fl_Button {} {
label {-}
callback {if (v != LOAD) {
widget_grid_curr_col->value( widget_grid_curr_col->value()-1 );
widget_grid_curr_col->do_callback();
}}
xywh {135 210 15 20} labelsize 11
code0 {o->clear_visible_focus();} compact 1
}
Fl_Button {} {
label {+}
callback {if (v != LOAD) {
widget_grid_curr_col->value( widget_grid_curr_col->value()+1 );
widget_grid_curr_col->do_callback();
}}
xywh {150 210 15 20} labelsize 11
code0 {o->clear_visible_focus();} compact 1
}
}
Fl_Box {} {
label {:}
xywh {165 210 15 20} labelsize 11
}
Fl_Group widget_grid_curr_col_attributes {
callback propagate_load open
xywh {180 210 175 20}
} {
Fl_Input {} {
label {Width:}
callback {Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
int c = widget_grid_curr_col->value();
if (v == LOAD) {
o->value(grid->col_width(c));
} else {
int h = o->value(), old_h = grid->col_width(c);
if (h != old_h) {
grid->col_width(c, h);
grid->need_layout(true);
set_modflag(1);
}
}}
xywh {180 210 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Input {} {
label {Weight:}
callback {Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
int c = widget_grid_curr_col->value();
if (v == LOAD) {
o->value(grid->col_weight(c));
} else {
int h = o->value(), old_h = grid->col_weight(c);
if (h != old_h) {
grid->col_weight(c, h);
grid->need_layout(true);
set_modflag(1);
}
}}
xywh {240 210 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Input {} {
label {Gap:}
callback {Fl_Grid *grid = Fl_Grid_Type::selected();
if (!grid) return;
int c = widget_grid_curr_col->value();
if (v == LOAD) {
o->value(grid->col_gap(c));
} else {
int h = o->value(), old_h = grid->col_gap(c);
if (h != old_h) {
grid->col_gap(c, h);
grid->need_layout(true);
set_modflag(1);
}
}}
xywh {300 210 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
}
Fl_Box {} {
xywh {400 210 1 20} hide resizable
}
}
Fl_Box {} {
xywh {95 350 300 5} labelsize 11 hide resizable
}
}
}
Fl_Tabs widget_tabs_repo {
xywh {10 10 400 350} hide
code0 {o->hide();}
} {
Fl_Group {} {open
xywh {10 30 400 330} resizable
} {}
}
Fl_Group {} {
xywh {10 370 400 20} labelsize 11
} {

32
fluid/widget_panel.h

@ -21,6 +21,9 @@ @@ -21,6 +21,9 @@
#include <FL/Fl.H>
#include "custom_widgets.h"
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Grid.H>
#include <FL/Fl_Button.H>
Fl_Double_Window* make_window();
#include <FL/Fl_Tabs.H>
extern Fl_Tabs *widget_tabs;
#include <FL/Fl_Group.H>
@ -31,7 +34,6 @@ extern void label_cb(Fl_Input*, void*); @@ -31,7 +34,6 @@ extern void label_cb(Fl_Input*, void*);
extern Fl_Menu_Item labeltypemenu[];
extern void labeltype_cb(Fl_Choice*, void*);
extern void image_cb(Fl_Input*, void*);
#include <FL/Fl_Button.H>
extern void image_browse_cb(Fl_Button*, void*);
#include "pixmaps.h"
extern void compress_image_cb(Fl_Button*, void*);
@ -134,32 +136,24 @@ extern void when_cb(Fl_Menu_Button*, void*); @@ -134,32 +136,24 @@ extern void when_cb(Fl_Menu_Button*, void*);
#include <FL/Fl_Input_Choice.H>
extern void user_data_type_cb(Fl_Input_Choice*, void*);
extern Fl_Box *w_when_box;
extern Fl_Tabs *widget_tabs_repo;
extern Fl_Group *widget_tab_grid_child;
extern void grid_set_row_cb(Fluid_Coord_Input*, void*);
extern Fluid_Coord_Input *widget_grid_row_input;
extern void grid_set_col_cb(Fluid_Coord_Input*, void*);
extern Fluid_Coord_Input *widget_grid_col_input;
extern void grid_align_cb(Fl_Choice*, void*);
extern void grid_set_rowspan_cb(Fluid_Coord_Input*, void*);
extern void grid_set_colspan_cb(Fluid_Coord_Input*, void*);
extern void grid_set_min_wdt_cb(Fluid_Coord_Input*, void*);
extern void grid_set_min_hgt_cb(Fluid_Coord_Input*, void*);
extern void grid_set_rowspan_cb(Fluid_Coord_Input*, void*);
extern void grid_set_colspan_cb(Fluid_Coord_Input*, void*);
extern Fl_Group *widget_tab_grid;
extern void grid_row_height(Fluid_Coord_Input*, void*);
extern void grid_row_weight(Fluid_Coord_Input*, void*);
extern void grid_row_gap(Fluid_Coord_Input*, void*);
extern void grid_col_width(Fluid_Coord_Input*, void*);
extern void grid_col_weight(Fluid_Coord_Input*, void*);
extern void grid_col_gap(Fluid_Coord_Input*, void*);
extern void grid_margin_left_cb(Fl_Value_Input*, void*);
extern void grid_margin_top_cb(Fl_Value_Input*, void*);
extern void grid_margin_right_cb(Fl_Value_Input*, void*);
extern void grid_margin_bottom_cb(Fl_Value_Input*, void*);
extern void grid_row_gap_cb(Fl_Value_Input*, void*);
extern void grid_col_gap_cb(Fl_Value_Input*, void*);
extern void grid_rows_cb(Fluid_Coord_Input*, void*);
extern void grid_cols_cb(Fluid_Coord_Input*, void*);
extern Fluid_Coord_Input *widget_grid_rows;
extern Fluid_Coord_Input *widget_grid_cols;
extern Fluid_Coord_Input *widget_grid_curr_row;
extern Fl_Group *widget_grid_curr_row_attributes;
extern Fluid_Coord_Input *widget_grid_curr_col;
extern Fl_Group *widget_grid_curr_col_attributes;
extern Fl_Tabs *widget_tabs_repo;
extern void live_mode_cb(Fl_Button*, void*);
extern Fl_Button *wLiveMode;
extern void overlay_cb(Fl_Button*, void*);
@ -173,5 +167,5 @@ extern Fl_Menu_Item menu_Children[]; @@ -173,5 +167,5 @@ extern Fl_Menu_Item menu_Children[];
extern Fl_Menu_Item menu_2[];
extern Fl_Menu_Item menu_3[];
extern Fl_Menu_Item menu_4[];
extern Fl_Menu_Item menu_Align[];
extern Fl_Menu_Item menu_5[];
#endif

Loading…
Cancel
Save