summaryrefslogtreecommitdiff
path: root/test/file_chooser.cxx
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2018-10-29 19:59:57 +0000
committerGreg Ercolano <erco@seriss.com>2018-10-29 19:59:57 +0000
commitd65a5a073c8bed0e742925a58997c832d5431011 (patch)
tree57f05afa7969fdb0365a2fc8d21fd198901d3ecc /test/file_chooser.cxx
parent554d7d363903d0626cb9c9dfee54e55c71c6a5b7 (diff)
Control resizing behavior of UI buttons
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13099 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/file_chooser.cxx')
-rw-r--r--test/file_chooser.cxx98
1 files changed, 61 insertions, 37 deletions
diff --git a/test/file_chooser.cxx b/test/file_chooser.cxx
index 5421eaa1b..6a5b42bcc 100644
--- a/test/file_chooser.cxx
+++ b/test/file_chooser.cxx
@@ -89,6 +89,7 @@ main(int argc, // I - Number of command-line arguments
{
Fl_Double_Window *window;// Main window
Fl_Button *button;// Buttons
+ Fl_Group *grp; // Groups
Fl_File_Icon *icon; // New file icon
@@ -109,52 +110,75 @@ main(int argc, // I - Number of command-line arguments
tty = new Fl_Simple_Terminal(0,215,window->w(),TERMINAL_HEIGHT);
tty->ansi(true);
- filter = new Fl_Input(50, 10, 315, 25, "Filter:");
- // Process standard arguments and find filter argument if present
- int argn = 1;
- while (argn < argc) {
- if (Fl::arg(argc, argv, argn) == 0) break;
- }
- if (argc > argn)
- filter->value(argv[argn]);
- else
- filter->value("PDF Files (*.pdf)\t"
- "PostScript Files (*.ps)\t"
- "Image Files (*.{bmp,gif,jpg,png})\t"
- "C/C++ Source Files (*.{c,C,cc,cpp,cxx})");
-
- button = new Fl_Button(365, 10, 25, 25);
- button->tooltip("Click to open file browser..");
- button->callback((Fl_Callback *)show_callback);
- if ( (icon = Fl_File_Icon::find(".", Fl_File_Icon::DIRECTORY)) ) {
- // Icon found; assign it..
- button->labelcolor(FL_YELLOW);
- icon->label(button);
- } else {
- // Fallback if no icon found
- button->label("..");
+ // Group: limit resizing to filter input (not browse button)
+ grp = new Fl_Group(0,10,400,25);
+ grp->begin();
+ {
+ filter = new Fl_Input(50, 10, 315, 25, "Filter:");
+ // Process standard arguments and find filter argument if present
+ int argn = 1;
+ while (argn < argc) {
+ if (Fl::arg(argc, argv, argn) == 0) break;
+ }
+ if (argc > argn)
+ filter->value(argv[argn]);
+ else
+ filter->value("PDF Files (*.pdf)\t"
+ "PostScript Files (*.ps)\t"
+ "Image Files (*.{bmp,gif,jpg,png})\t"
+ "C/C++ Source Files (*.{c,C,cc,cpp,cxx})");
+
+ button = new Fl_Button(365, 10, 25, 25);
+ button->tooltip("Click to open file browser..");
+ button->callback((Fl_Callback *)show_callback);
+ if ( (icon = Fl_File_Icon::find(".", Fl_File_Icon::DIRECTORY)) ) {
+ // Icon found; assign it..
+ button->labelcolor(FL_YELLOW);
+ icon->label(button);
+ } else {
+ // Fallback if no icon found
+ button->label("..");
+ }
}
+ grp->end();
+ grp->resizable(filter);
- button = new Fl_Light_Button(50, 45, 80, 25, "MULTI");
- button->callback((Fl_Callback *)multi_callback);
+ // Group: prevent resizing of the light buttons
+ grp = new Fl_Group(0,45,400,55);
+ grp->begin();
+ {
+ button = new Fl_Light_Button(50, 45, 80, 25, "MULTI");
+ button->callback((Fl_Callback *)multi_callback);
- button = new Fl_Light_Button(140, 45, 90, 25, "CREATE");
- button->callback((Fl_Callback *)create_callback);
+ button = new Fl_Light_Button(140, 45, 90, 25, "CREATE");
+ button->callback((Fl_Callback *)create_callback);
- button = new Fl_Light_Button(240, 45, 115, 25, "DIRECTORY");
- button->callback((Fl_Callback *)dir_callback);
+ button = new Fl_Light_Button(240, 45, 115, 25, "DIRECTORY");
+ button->callback((Fl_Callback *)dir_callback);
- //
- ch_extra = new Fl_Choice(150, 75, 150, 25, "Extra Group:");
- ch_extra->add("none|encodings group|check button");
- ch_extra->value(0);
- ch_extra->callback((Fl_Callback *)extra_callback);
+ //
+ ch_extra = new Fl_Choice(150, 75, 150, 25, "Extra Group:");
+ ch_extra->add("none|encodings group|check button");
+ ch_extra->value(0);
+ ch_extra->callback((Fl_Callback *)extra_callback);
+ }
+ grp->end();
+ grp->resizable(0);
//
files = new Fl_File_Browser(50, 105, 340, 75, "Files:");
files->align(FL_ALIGN_LEFT);
- button = new Fl_Button(340, 185, 50, 25, "Close");
- button->callback((Fl_Callback *)close_callback);
+ // Prevent resizing close button, but keep at right edge of scrn
+ grp = new Fl_Group(0,185,400,25);
+ grp->begin();
+ {
+ Fl_Box *invis = new Fl_Box(100,185,1,1);
+ invis->box(FL_NO_BOX);
+ button = new Fl_Button(310, 185, 80, 25, "Close");
+ button->callback((Fl_Callback *)close_callback);
+ grp->resizable(invis);
+ }
+ grp->end();
window->resizable(files);
window->end();