Author: matt
Date: 2010-04-02 13:52:20 -0700 (Fri, 02 Apr 2010)
New Revision: 7412
Log:
Implemented arc for FLTK1 via wrapper. This is a milestone, because this test
derives a new class from Fl_Widget and implements its own draw() function.
Using Wrapper::vcall as a flag of who originated the call, draw() works in both
directions in the wrapper and in the original code. Wheee!
Modified:
branches/branch-3.0/FL/Fl_Valuator.H
branches/branch-3.0/FL/Fl_Widget.H
branches/branch-3.0/fltk/Widget.h
branches/branch-3.0/fltk3/Widget.h
branches/branch-3.0/fltk3/Wrapper.h
branches/branch-3.0/src/Fl_Widget.cxx
branches/branch-3.0/test/arc.cxx
Modified: branches/branch-3.0/FL/Fl_Valuator.H
===================================================================
--- branches/branch-3.0/FL/Fl_Valuator.H 2010-04-02 20:25:44 UTC (rev
7411)
+++ branches/branch-3.0/FL/Fl_Valuator.H 2010-04-02 20:52:20 UTC (rev
7412)
@@ -29,14 +29,12 @@
#endif
public:
- void bounds(double a, double b) { ((fltk3::Valuator*)_p)->bounds(a, b); }
-#if 0 // fltk123:
- double minimum() const {return min;}
- void minimum(double a) {min = a;}
- double maximum() const {return max;}
- void maximum(double a) {max = a;}
- void range(double a, double b) {min = a; max = b;}
-#endif
+ void bounds(double a, double b) { ((fltk3::Valuator*)_p)->bounds(a, b); }
+ double minimum() const { return ((fltk3::Valuator*)_p)->minimum(); }
+ void minimum(double a) { ((fltk3::Valuator*)_p)->minimum(a); }
+ double maximum() const { return ((fltk3::Valuator*)_p)->maximum(); }
+ void maximum(double a) { ((fltk3::Valuator*)_p)->maximum(a); }
+ void range(double a, double b) { ((fltk3::Valuator*)_p)->range(a, b); }
void step(int a) { ((fltk3::Valuator*)_p)->step(a); }
void step(double a, int b) { ((fltk3::Valuator*)_p)->step(a, b); }
void step(double s) { ((fltk3::Valuator*)_p)->step(s); }
Modified: branches/branch-3.0/FL/Fl_Widget.H
===================================================================
--- branches/branch-3.0/FL/Fl_Widget.H 2010-04-02 20:25:44 UTC (rev 7411)
+++ branches/branch-3.0/FL/Fl_Widget.H 2010-04-02 20:52:20 UTC (rev 7412)
@@ -143,7 +143,7 @@
fltk3::Widget *fltk3Widget() { return (fltk3::Widget*)_p; }
virtual ~Fl_Widget() { }
- virtual void draw() { _p->draw(); }
+ virtual void draw() { vcall = 1; _p->fltk3::Widget::draw(); }
virtual int handle(int event) { return _p->handle(event); }
Fl_Group* parent() const { return (Fl_Group*)_p->parent()->wrapper(); }
void parent(Fl_Group* p) {
_p->parent((fltk3::Group*)(((Fl_Widget*)p)->fltk3Widget())); }
Modified: branches/branch-3.0/fltk/Widget.h
===================================================================
--- branches/branch-3.0/fltk/Widget.h 2010-04-02 20:25:44 UTC (rev 7411)
+++ branches/branch-3.0/fltk/Widget.h 2010-04-02 20:52:20 UTC (rev 7412)
@@ -43,8 +43,8 @@
fltk3::Widget *fltk3Widget() { return (fltk3::Widget*)_p; }
+ virtual void draw() { vcall = 1; _p->fltk3::Widget::draw(); }
#if 0
- virtual void draw();
virtual int handle(int);
int send(int event);
virtual void layout();
Modified: branches/branch-3.0/fltk3/Widget.h
===================================================================
--- branches/branch-3.0/fltk3/Widget.h 2010-04-02 20:25:44 UTC (rev 7411)
+++ branches/branch-3.0/fltk3/Widget.h 2010-04-02 20:52:20 UTC (rev 7412)
@@ -216,6 +216,9 @@
\endcode
*/
virtual void draw() {
+ if (wrapper() && !Wrapper::vcall) { wrapper()->draw(); }
+ Wrapper::vcall = 0;
+
draw_box();
draw_label();
}
Modified: branches/branch-3.0/fltk3/Wrapper.h
===================================================================
--- branches/branch-3.0/fltk3/Wrapper.h 2010-04-02 20:25:44 UTC (rev 7411)
+++ branches/branch-3.0/fltk3/Wrapper.h 2010-04-02 20:52:20 UTC (rev 7412)
@@ -45,6 +45,8 @@
Wrapper()
: _p(0L) { }
virtual ~Wrapper() { }
+ static char vcall;
+ virtual void draw() = 0;
};
}; // namespace fltk3
Modified: branches/branch-3.0/src/Fl_Widget.cxx
===================================================================
--- branches/branch-3.0/src/Fl_Widget.cxx 2010-04-02 20:25:44 UTC (rev
7411)
+++ branches/branch-3.0/src/Fl_Widget.cxx 2010-04-02 20:52:20 UTC (rev
7412)
@@ -42,6 +42,8 @@
const int QUEUE_SIZE = 20;
+char fltk3::Wrapper::vcall = 0;
+
static fltk3::Widget *obj_queue[QUEUE_SIZE];
static int obj_head, obj_tail;
Modified: branches/branch-3.0/test/arc.cxx
===================================================================
--- branches/branch-3.0/test/arc.cxx 2010-04-02 20:25:44 UTC (rev 7411)
+++ branches/branch-3.0/test/arc.cxx 2010-04-02 20:52:20 UTC (rev 7412)
@@ -28,7 +28,6 @@
#include <fltk3/run.h>
#include <fltk3/DoubleBufferWindow.h>
#include <fltk3/HorValueSlider.h>
-#include <fltk3/Button.h>
#include <fltk3/draw.h>
using namespace fltk3;
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit