STR50 fix attemp. Added a new check_redraw_corresponding_parent() function to redraw the corresponding tab of a Fl_Tabs or Fl_Wizard group. tested with single, multiple selection. Compared to the proposed patch this version only add one function similar to redraw_overlays() without modifying the Fl_Type class.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6621 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Fabien Costantini 2009-01-03 15:44:06 +00:00
parent d7e4bfe777
commit 8a53f05688
2 changed files with 18 additions and 0 deletions

View File

@ -1808,6 +1808,7 @@ void Fl_Widget_Type::open() {
Fl_Type *Fl_Type::current;
extern void redraw_overlays();
extern void check_redraw_corresponding_parent(Fl_Type*);
extern void redraw_browser();
extern void update_sourceview_position();
@ -1839,6 +1840,7 @@ void selection_changed(Fl_Type *p) {
}
if (!p || !p->selected) p = q;
Fl_Type::current = p;
check_redraw_corresponding_parent(p);
redraw_overlays();
// load the panel with the new settings:
load_panel();

View File

@ -1065,6 +1065,22 @@ void Fl_Window_Type::fix_overlay() {
((Overlay_Window *)(this->o))->redraw_overlay();
}
// check if we must redraw any parent of tabs/wizard type
void check_redraw_corresponding_parent(Fl_Type *s) {
Fl_Widget_Type * prev_parent = 0;
if( !s || !s->selected || !s->is_widget()) return;
for (Fl_Type *i=s; i && i->parent; i=i->parent) {
if (i->is_group() && prev_parent &&
(!strcmp(i->type_name(), "Fl_Tabs") ||
!strcmp(i->type_name(), "Fl_Wizard"))) {
((Fl_Tabs*)((Fl_Widget_Type*)i)->o)->value(prev_parent->o);
return;
}
if (i->is_group() && s->is_widget())
prev_parent = (Fl_Widget_Type*)i;
}
}
// do that for every window (when selected set changes):
void redraw_overlays() {
for (Fl_Type *o=Fl_Type::first; o; o=o->next)