STR #1062: updated code to resize the preview panel of the file chooser and hide it entirely if unused
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4643 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
1fe85a8c18
commit
0a41e770c3
@ -202,14 +202,14 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char
|
||||
}
|
||||
{ Fl_Group* o = new Fl_Group(10, 275, 470, 95);
|
||||
{ Fl_Group* o = new Fl_Group(10, 275, 470, 20);
|
||||
{ Fl_Check_Button* o = previewButton = new Fl_Check_Button(10, 275, 170, 20, "Preview");
|
||||
{ Fl_Check_Button* o = previewButton = new Fl_Check_Button(10, 275, 73, 20, "Preview");
|
||||
o->down_box(FL_DOWN_BOX);
|
||||
o->value(1);
|
||||
o->shortcut(0x80070);
|
||||
o->callback((Fl_Callback*)cb_previewButton);
|
||||
previewButton->label(preview_label);
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(10, 275, 395, 20);
|
||||
{ Fl_Box* o = new Fl_Box(115, 275, 365, 20);
|
||||
Fl_Group::current()->resizable(o);
|
||||
}
|
||||
o->end();
|
||||
|
@ -60,7 +60,7 @@ class FL_EXPORT Fl_File_Chooser {open
|
||||
callback {fileName->value("");
|
||||
fileList->deselect();
|
||||
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
|
||||
window->hide();} selected
|
||||
window->hide();}
|
||||
private xywh {387 242 490 380} type Double resizable
|
||||
code0 {if (title) window->label(title);}
|
||||
code1 {\#include <stdio.h>}
|
||||
@ -90,7 +90,7 @@ window->hide();} selected
|
||||
}
|
||||
}
|
||||
Fl_Tile {} {
|
||||
callback {update_preview();} open
|
||||
callback {update_preview();}
|
||||
private xywh {10 45 470 225} resizable
|
||||
} {
|
||||
Fl_File_Browser fileList {
|
||||
@ -106,17 +106,17 @@ window->hide();} selected
|
||||
Fl_Group {} {
|
||||
private xywh {10 275 470 95}
|
||||
} {
|
||||
Fl_Group {} {
|
||||
Fl_Group {} {open
|
||||
private xywh {10 275 470 20}
|
||||
} {
|
||||
Fl_Check_Button previewButton {
|
||||
label Preview
|
||||
callback {preview(previewButton->value());}
|
||||
xywh {10 275 170 20} down_box DOWN_BOX shortcut 0x80070 value 1
|
||||
xywh {10 275 73 20} down_box DOWN_BOX shortcut 0x80070 value 1
|
||||
code0 {previewButton->label(preview_label);}
|
||||
}
|
||||
Fl_Box {} {
|
||||
private xywh {10 275 395 20} resizable
|
||||
private xywh {115 275 365 20} resizable
|
||||
}
|
||||
}
|
||||
Fl_File_Input fileName {
|
||||
@ -138,7 +138,7 @@ window->hide();} selected
|
||||
if (callback_)
|
||||
(*callback_)(this, data_);
|
||||
|
||||
window->hide();}
|
||||
window->hide();} selected
|
||||
private xywh {313 345 85 25}
|
||||
code0 {\#include <FL/fl_ask.H>}
|
||||
code1 {okButton->label(fl_ok);}
|
||||
@ -299,7 +299,7 @@ okButton->parent()->init_sizes();} {}
|
||||
}
|
||||
decl {void rescan();} {public
|
||||
}
|
||||
Function {show()} {open return_type void
|
||||
Function {show()} {return_type void
|
||||
} {
|
||||
code {window->hotspot(fileList);
|
||||
window->show();
|
||||
@ -337,7 +337,7 @@ fileName->take_focus();} {}
|
||||
} {
|
||||
code {return (fileList->textsize());} {}
|
||||
}
|
||||
Function {type(int t)} {open return_type void
|
||||
Function {type(int t)} {return_type void
|
||||
} {
|
||||
code {type_ = t;
|
||||
if (t & MULTI)
|
||||
|
@ -788,20 +788,23 @@ Fl_File_Chooser::preview(int e)// I - 1 = enable preview, 0 = disable preview
|
||||
previewButton->value(e);
|
||||
prefs_.set("preview", e);
|
||||
|
||||
Fl_Group *p = previewBox->parent();
|
||||
if (e) {
|
||||
int w = previewBox->h() * 2 / 3;
|
||||
int w = p->w() * 2 / 3;
|
||||
fileList->resize(fileList->x(), fileList->y(),
|
||||
window->w() - 20 - w, fileList->h());
|
||||
previewBox->resize(window->w() - 10 - w, previewBox->y(),
|
||||
w, previewBox->h());
|
||||
|
||||
w, fileList->h());
|
||||
previewBox->resize(fileList->x()+w, previewBox->y(),
|
||||
p->w()-w, previewBox->h());
|
||||
previewBox->show();
|
||||
update_preview();
|
||||
} else {
|
||||
fileList->resize(fileList->x(), fileList->y(),
|
||||
window->w() - 20, fileList->h());
|
||||
previewBox->resize(window->w() - 10, previewBox->y(),
|
||||
p->w(), fileList->h());
|
||||
previewBox->resize(p->x()+p->w(), previewBox->y(),
|
||||
0, previewBox->h());
|
||||
previewBox->hide();
|
||||
}
|
||||
p->init_sizes();
|
||||
|
||||
fileList->parent()->redraw();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user