diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2005-03-25 15:20:26 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2005-03-25 15:20:26 +0000 |
| commit | ce40d4a0e67b79b48471d6328f46817d2e064544 (patch) | |
| tree | 40d06e87549e71c4f2d6c606bc2067525a625b9d /src/Fl_File_Chooser.cxx | |
| parent | 6d65dcba88092bbff9979399a7d204bb0c88dd59 (diff) | |
The Fl_File_Chooser window now properly resizes its controls (STR
#766)
The Fl_Help_Dialog window now properly resizes its controls (STR
#768)
The Fl_File_Chooser favorites window is now resizable (STR #770)
Added more documentation on the file chooser filter pattern format
(in both functions.html and Fl_File_Chooser.html)
Added Fl_File_Chooser::save_label (for favorites dialog) and
Fl_File_Chooser::ok_label() to change the default "OK" button
label to something more appropriate according to the HIG.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4187 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_File_Chooser.cxx')
| -rw-r--r-- | src/Fl_File_Chooser.cxx | 115 |
1 files changed, 86 insertions, 29 deletions
diff --git a/src/Fl_File_Chooser.cxx b/src/Fl_File_Chooser.cxx index 4901f2ac8..085029031 100644 --- a/src/Fl_File_Chooser.cxx +++ b/src/Fl_File_Chooser.cxx @@ -1,3 +1,30 @@ +// +// "$Id$" +// +// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2005 by Bill Spitzak and others. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems on the following page: +// +// http://www.fltk.org/str.php +// + // generated by Fast Light User Interface Designer (fluid) version 1.0107 #include "../FL/Fl_File_Chooser.H" @@ -78,14 +105,14 @@ void Fl_File_Chooser::cb_okButton(Fl_Return_Button* o, void* v) { ((Fl_File_Chooser*)(o->parent()->parent()->parent()->user_data()))->cb_okButton_i(o,v); } -inline void Fl_File_Chooser::cb_Cancel_i(Fl_Button*, void*) { +inline void Fl_File_Chooser::cb_cancelButton_i(Fl_Button*, void*) { fileName->value(""); fileList->deselect(); Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this); window->hide(); } -void Fl_File_Chooser::cb_Cancel(Fl_Button* o, void* v) { - ((Fl_File_Chooser*)(o->parent()->parent()->parent()->user_data()))->cb_Cancel_i(o,v); +void Fl_File_Chooser::cb_cancelButton(Fl_Button* o, void* v) { + ((Fl_File_Chooser*)(o->parent()->parent()->parent()->user_data()))->cb_cancelButton_i(o,v); } inline void Fl_File_Chooser::cb_favList_i(Fl_File_Browser*, void*) { @@ -99,35 +126,35 @@ inline void Fl_File_Chooser::cb_favUpButton_i(Fl_Button*, void*) { favoritesCB(favUpButton); } void Fl_File_Chooser::cb_favUpButton(Fl_Button* o, void* v) { - ((Fl_File_Chooser*)(o->parent()->user_data()))->cb_favUpButton_i(o,v); + ((Fl_File_Chooser*)(o->parent()->parent()->user_data()))->cb_favUpButton_i(o,v); } inline void Fl_File_Chooser::cb_favDeleteButton_i(Fl_Button*, void*) { favoritesCB(favDeleteButton); } void Fl_File_Chooser::cb_favDeleteButton(Fl_Button* o, void* v) { - ((Fl_File_Chooser*)(o->parent()->user_data()))->cb_favDeleteButton_i(o,v); + ((Fl_File_Chooser*)(o->parent()->parent()->user_data()))->cb_favDeleteButton_i(o,v); } inline void Fl_File_Chooser::cb_favDownButton_i(Fl_Button*, void*) { favoritesCB(favDownButton); } void Fl_File_Chooser::cb_favDownButton(Fl_Button* o, void* v) { - ((Fl_File_Chooser*)(o->parent()->user_data()))->cb_favDownButton_i(o,v); + ((Fl_File_Chooser*)(o->parent()->parent()->user_data()))->cb_favDownButton_i(o,v); } inline void Fl_File_Chooser::cb_favCancelButton_i(Fl_Button*, void*) { favWindow->hide(); } void Fl_File_Chooser::cb_favCancelButton(Fl_Button* o, void* v) { - ((Fl_File_Chooser*)(o->parent()->user_data()))->cb_favCancelButton_i(o,v); + ((Fl_File_Chooser*)(o->parent()->parent()->user_data()))->cb_favCancelButton_i(o,v); } inline void Fl_File_Chooser::cb_favOkButton_i(Fl_Return_Button*, void*) { favoritesCB(favOkButton); } void Fl_File_Chooser::cb_favOkButton(Fl_Return_Button* o, void* v) { - ((Fl_File_Chooser*)(o->parent()->user_data()))->cb_favOkButton_i(o,v); + ((Fl_File_Chooser*)(o->parent()->parent()->user_data()))->cb_favOkButton_i(o,v); } Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char *title) { @@ -135,9 +162,10 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char { Fl_Double_Window* o = window = new Fl_Double_Window(490, 380, "Choose File"); w = o; o->callback((Fl_Callback*)cb_window, (void*)(this)); - { Fl_Group* o = new Fl_Group(65, 10, 415, 25); + { Fl_Group* o = new Fl_Group(10, 10, 470, 25); { Fl_Choice* o = showChoice = new Fl_Choice(65, 10, 215, 25, "Show:"); o->down_box(FL_BORDER_BOX); + o->labelfont(1); o->callback((Fl_Callback*)cb_showChoice); Fl_Group::current()->resizable(o); showChoice->label(show_label); @@ -186,25 +214,27 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char o->end(); } { Fl_File_Input* o = fileName = new Fl_File_Input(115, 300, 365, 35); + o->labelfont(1); o->callback((Fl_Callback*)cb_fileName); o->when(FL_WHEN_ENTER_KEY); Fl_Group::current()->resizable(o); fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS); } { Fl_Box* o = new Fl_Box(10, 310, 105, 25, "Filename:"); + o->labelfont(1); o->align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); o->label(filename_label); } { Fl_Group* o = new Fl_Group(10, 345, 470, 25); - { Fl_Return_Button* o = okButton = new Fl_Return_Button(300, 345, 85, 25, "OK"); + { Fl_Return_Button* o = okButton = new Fl_Return_Button(313, 345, 85, 25, "OK"); o->callback((Fl_Callback*)cb_okButton); okButton->label(fl_ok); } - { Fl_Button* o = new Fl_Button(395, 345, 85, 25, "Cancel"); - o->callback((Fl_Callback*)cb_Cancel); + { Fl_Button* o = cancelButton = new Fl_Button(408, 345, 72, 25, "Cancel"); + o->callback((Fl_Callback*)cb_cancelButton); o->label(fl_cancel); } - { Fl_Box* o = new Fl_Box(10, 345, 300, 25); + { Fl_Box* o = new Fl_Box(10, 345, 30, 25); Fl_Group::current()->resizable(o); } o->end(); @@ -221,24 +251,35 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char { Fl_File_Browser* o = favList = new Fl_File_Browser(10, 10, 300, 95); o->type(2); o->callback((Fl_Callback*)cb_favList); + Fl_Group::current()->resizable(o); } - { Fl_Button* o = favUpButton = new Fl_Button(320, 10, 25, 25, "@8>"); - o->callback((Fl_Callback*)cb_favUpButton); - } - { Fl_Button* o = favDeleteButton = new Fl_Button(320, 45, 25, 25, "X"); - o->labelfont(1); - o->callback((Fl_Callback*)cb_favDeleteButton); - } - { Fl_Button* o = favDownButton = new Fl_Button(320, 80, 25, 25, "@2>"); - o->callback((Fl_Callback*)cb_favDownButton); - } - { Fl_Button* o = favCancelButton = new Fl_Button(270, 115, 75, 25, "Cancel"); - o->callback((Fl_Callback*)cb_favCancelButton); - favCancelButton->label(fl_cancel); + { Fl_Group* o = new Fl_Group(320, 10, 25, 95); + { Fl_Button* o = favUpButton = new Fl_Button(320, 10, 25, 25, "@8>"); + o->callback((Fl_Callback*)cb_favUpButton); + } + { Fl_Button* o = favDeleteButton = new Fl_Button(320, 45, 25, 25, "X"); + o->labelfont(1); + o->callback((Fl_Callback*)cb_favDeleteButton); + Fl_Group::current()->resizable(o); + } + { Fl_Button* o = favDownButton = new Fl_Button(320, 80, 25, 25, "@2>"); + o->callback((Fl_Callback*)cb_favDownButton); + } + o->end(); } - { Fl_Return_Button* o = favOkButton = new Fl_Return_Button(185, 115, 75, 25, "OK"); - o->callback((Fl_Callback*)cb_favOkButton); - favOkButton->label(fl_ok); + { Fl_Group* o = new Fl_Group(10, 113, 335, 29); + { Fl_Button* o = favCancelButton = new Fl_Button(273, 115, 72, 25, "Cancel"); + o->callback((Fl_Callback*)cb_favCancelButton); + favCancelButton->label(fl_cancel); + } + { Fl_Return_Button* o = favOkButton = new Fl_Return_Button(181, 115, 79, 25, "Save"); + o->callback((Fl_Callback*)cb_favOkButton); + favOkButton->label(save_label); + } + { Fl_Box* o = new Fl_Box(10, 115, 161, 25); + Fl_Group::current()->resizable(o); + } + o->end(); } favWindow->label(manage_favorites_label); o->set_modal(); @@ -314,6 +355,18 @@ const char * Fl_File_Chooser::label() { return (window->label()); } +void Fl_File_Chooser::ok_label(const char *l) { + okButton->label(l); +int w, h; +okButton->measure_label(w, h); +okButton->resize(cancelButton->x() - 50 - w, cancelButton->y(), + w + 40, 25); +} + +const char * Fl_File_Chooser::ok_label() { + return (okButton->label()); +} + void Fl_File_Chooser::show() { window->hotspot(fileList); window->show(); @@ -372,3 +425,7 @@ int Fl_File_Chooser::type() { int Fl_File_Chooser::visible() { return window->visible(); } + +// +// End of "$Id$". +// |
