Author: manolo
Date: 2012-05-25 03:43:40 -0700 (Fri, 25 May 2012)
New Revision: 9546
Log:
Completed FLTK1 compatibility for Fl_File_Chooser when using Fl_File_Chooser
::add_extra().
Modified:
branches/branch-3.0/include/FL/Fl_File_Chooser.H
branches/branch-3.0/include/FL/Fl_Widget.H
Modified: branches/branch-3.0/include/FL/Fl_File_Chooser.H
===================================================================
--- branches/branch-3.0/include/FL/Fl_File_Chooser.H 2012-05-24 19:56:20 UTC
(rev 9545)
+++ branches/branch-3.0/include/FL/Fl_File_Chooser.H 2012-05-25 10:43:40 UTC
(rev 9546)
@@ -64,6 +64,11 @@
fltk3::FileChooser::cb_fileList(o,v);
}
+ static void window_cb(Fl_Widget *w1, void *v) {
+ fltk3::DoubleWindow* o = (fltk3::DoubleWindow*)(w1->_p);
+ fltk3::FileChooser::cb_window(o,v);
+ }
+
public:
enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 };
@@ -78,6 +83,14 @@
// when b3's callback will be called it will be sent b1 as 1st argument
// thus we change b3's callback accordingly
b3->callback((fltk3::Callback*)browser_cb);
+ // wrap the internal fltk3::Window object with an FLTK1 widget
+ fltk3::Window* w3 = b3->window();
+ Fl_Widget *w1 = new Fl_Window();
+ w3->wrapper(w1);
+ w1->_p = w3;
+ // when w3's callback will be called it will be sent w1 as 1st argument
+ // thus we change w3's callback accordingly
+ w3->callback((fltk3::Callback*)window_cb);
}
Fl_Widget* add_extra(Fl_Widget* gr) {
Modified: branches/branch-3.0/include/FL/Fl_Widget.H
===================================================================
--- branches/branch-3.0/include/FL/Fl_Widget.H 2012-05-24 19:56:20 UTC (rev
9545)
+++ branches/branch-3.0/include/FL/Fl_Widget.H 2012-05-25 10:43:40 UTC (rev
9546)
@@ -233,13 +233,7 @@
}
Fl_Window* window() const {
- fltk3::Window* win3 = ((fltk3::Widget_I*)_p)->window();
- if (win3 && !win3->wrapper()) {
- Fl_Widget* win1 = new Fl_Widget();
- win3->wrapper(win1);
- win1->_p = win3;
- }
- return fltk3::_3to1_window( win3 );
+ return fltk3::_3to1_window( ((fltk3::Widget_I*)_p)->window() );
}
uchar type() const {
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit