Author: matt
Date: 2012-06-01 14:38:52 -0700 (Fri, 01 Jun 2012)
New Revision: 9569
Log:
Tryig to wrap FLTK2 graphics calls: the FLTK2 naming seems nice!

Added:
   branches/branch-3.0/include/fltk3/NumericInput.h
Modified:
   branches/branch-3.0/include/fltk/FloatInput.h
   branches/branch-3.0/include/fltk/Input.h
   branches/branch-3.0/include/fltk/NumericInput.h
   branches/branch-3.0/include/fltk/Rectangle.h
   branches/branch-3.0/include/fltk/Slider.h
   branches/branch-3.0/include/fltk/Valuator.h
   branches/branch-3.0/include/fltk/ValueSlider.h
   branches/branch-3.0/include/fltk/Widget.h
   branches/branch-3.0/include/fltk/draw.h
   branches/branch-3.0/include/fltk3/FloatInput.h
   branches/branch-3.0/src/fltk3/Input.cxx
   branches/branch-3.0/test2/arc.cxx

Modified: branches/branch-3.0/include/fltk/FloatInput.h
===================================================================
--- branches/branch-3.0/include/fltk/FloatInput.h       2012-06-01 12:16:23 UTC 
(rev 9568)
+++ branches/branch-3.0/include/fltk/FloatInput.h       2012-06-01 21:38:52 UTC 
(rev 9569)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
 //
 // "$Id$"
 //
@@ -6,7 +5,7 @@
 // typed. Currently this is implemented by the base class by checking
 // type() but this may change in the future.
 //
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2012 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
@@ -31,21 +30,43 @@
 #ifndef fltk_FloatInput_h
 #define fltk_FloatInput_h
 
+#include <fltk3/FloatInput.h>
 #include "NumericInput.h"
 
+
+FLTK2_WRAPPER_INTERFACE_BEGIN(FloatInput, FloatInput)
+FLTK2_WRAPPER_INTERFACE_WIDGET(FloatInput, FloatInput)
+FLTK2_WRAPPER_INTERFACE_END()
+
+
 namespace fltk {
+  
+  class FloatInput : public NumericInput {
+    
+  public:
 
-class FL_API FloatInput : public NumericInput {
-  virtual bool replace(int, int, const char*, int);
-public:
-  enum { FLOAT = 1, INT = 2 };
-  FloatInput(int x,int y,int w,int h,const char *l = 0)
+    FLTK2_WIDGET_VCALLS(FloatInput, FloatInput)
+    
+    FloatInput() {}
+    
+    FloatInput(int x,int y,int w,int h, const char *l = 0) {
+      _p = new fltk3::FloatInput_I(x, y, w, h, l);
+      _p->wrapper(this);
+    }
+
+#if 0
+    virtual bool replace(int, int, const char*, int);
+  public:
+    enum { FLOAT = 1, INT = 2 };
+    FloatInput(int x,int y,int w,int h,const char *l = 0)
     : NumericInput(x,y,w,h,l) { type(FLOAT); }
-  long lvalue() const;
-  int ivalue() const { return int(lvalue()); }
-  double fvalue() const;
-};
-
+    long lvalue() const;
+    int ivalue() const { return int(lvalue()); }
+    double fvalue() const;
+#endif
+    
+  };
+  
 }
 #endif
 

Modified: branches/branch-3.0/include/fltk/Input.h
===================================================================
--- branches/branch-3.0/include/fltk/Input.h    2012-06-01 12:16:23 UTC (rev 
9568)
+++ branches/branch-3.0/include/fltk/Input.h    2012-06-01 21:38:52 UTC (rev 
9569)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
 //
 // "$Id$"
 //
@@ -29,103 +28,97 @@
 #ifndef fltk_Input_h
 #define fltk_Input_h
 
-#ifndef fltk_Widget_h
+#include <fltk3/Input.h>
 #include "Widget.h"
-#endif
 
-namespace fltk {
 
-class FL_API Input : public Widget {
-public:
-  enum { // values for type()
-    NORMAL     = 0,
-    FLOAT_INPUT = 1,
-    INT_INPUT  = 2,
-    SECRET     = 3,
-    MULTILINE  = 4,
-    WORDWRAP   = 5
-  };
+FLTK2_WRAPPER_INTERFACE_BEGIN(Input, Input)
+FLTK2_WRAPPER_INTERFACE_WIDGET(Input, Input)
+FLTK2_WRAPPER_INTERFACE_END()
 
-  Input(int, int, int, int, const char* = 0);
-  ~Input();
-  static NamedStyle* default_style;
 
-  void draw();
-  void draw(const Rectangle&);
-  int handle(int);
-  int handle(int event, const Rectangle&);
-  bool handle_key();
+namespace fltk {
+  
+  class Input : public Widget {
+    
+  public:
 
-  bool text(const char*);
-  bool text(const char*, int);
-  bool static_text(const char*);
-  bool static_text(const char*, int);
-  const char* text() const {return text_;}
-  char at(int i) const {return text_[i];}
+    FLTK2_WIDGET_VCALLS(Input, Input)
+    
+    Input() {}
+    
+    Input(int x,int y,int w,int h, const char *l = 0) {
+      _p = new fltk3::Input_I(x, y, w, h, l);
+      _p->wrapper(this);
+    }
+
+#if 0
+    enum { // values for type()
+      NORMAL   = 0,
+      FLOAT_INPUT = 1,
+      INT_INPUT        = 2,
+      SECRET   = 3,
+      MULTILINE        = 4,
+      WORDWRAP = 5
+    };
+    
+    Input(int, int, int, int, const char* = 0);
+    ~Input();
+    static NamedStyle* default_style;
+    
+    void draw();
+    void draw(const Rectangle&);
+    int handle(int);
+    int handle(int event, const Rectangle&);
+    bool handle_key();
+    
+    bool text(const char*);
+    bool text(const char*, int);
+    bool static_text(const char*);
+    bool static_text(const char*, int);
+    const char* text() const {return text_;}
+    char at(int i) const {return text_[i];}
 #ifdef FLTK_1_WIDGET  // back-compatability section:
-  char index(int i) const {return text_[i];}
+    char index(int i) const {return text_[i];}
 #endif
 #ifndef SKIP_DEPRECIATED
-  bool value(const char* v) {return text(v);}
-  bool value(const char* v, int n) {return text(v,n);}
-  bool static_value(const char* v) {return static_text(v);}
-  const char* value() const {return text_;}
+    bool value(const char* v) {return text(v);}
+    bool value(const char* v, int n) {return text(v,n);}
+    bool static_value(const char* v) {return static_text(v);}
+    const char* value() const {return text_;}
 #endif
-  int size() const {return size_;}
-  void reserve(int newsize);
-
-  int position() const {return position_;}
-  int mark() const {return mark_;}
-  void position(int p, int m);
-  void position(int p) {position(p, p);}
-  void up_down_position(int position, bool extend);
-  void mark(int m) { position(position(), m);}
-
-  virtual bool replace(int, int, const char*, int);
-  bool cut() {return replace(position(), mark(), 0, 0);}
-  bool cut(int n) {return replace(position(), position()+n, 0, 0);}
-  bool cut(int a, int b) {return replace(a, b, 0, 0);}
-  bool insert(const char* t);
-  bool insert(const char* t, int l){return replace(position_, mark_, t, l);}
-  bool replace(int a, int b, char c) {return replace(a,b,&c,1);}
-  bool copy(bool clipboard = true);
-  bool undo();
-  void maybe_do_callback();
-
-  int word_start(int i) const;
-  int word_end(int i) const;
-  int line_start(int i) const;
-  int line_end(int i) const;
-  int mouse_position(const Rectangle&) const;
-  int xscroll() const {return xscroll_;}
-  int yscroll() const {return yscroll_;}
-
-private:
-
-  const char* text_;
-  char* buffer;
-
-  int size_;
-  int bufsize;
-  int position_;
-  int mark_;
-  int xscroll_, yscroll_;
-  int mu_p;
-  int label_width;
-
-  const char* expand(const char*, char*, int) const;
-  float expandpos(const char*, const char*, const char*, int*) const;
-  void minimal_update(int, int);
-  void minimal_update(int p);
-  void erase_cursor_at(int p);
-
-  void setfont() const;
-
-  void shift_position(int p);
-  void shift_up_down_position(int p);
-
-};
-
+    int size() const {return size_;}
+    void reserve(int newsize);
+    
+    int position() const {return position_;}
+    int mark() const {return mark_;}
+    void position(int p, int m);
+    void position(int p) {position(p, p);}
+    void up_down_position(int position, bool extend);
+    void mark(int m) { position(position(), m);}
+    
+    virtual bool replace(int, int, const char*, int);
+    bool cut() {return replace(position(), mark(), 0, 0);}
+    bool cut(int n) {return replace(position(), position()+n, 0, 0);}
+    bool cut(int a, int b) {return replace(a, b, 0, 0);}
+    bool insert(const char* t);
+    bool insert(const char* t, int l){return replace(position_, mark_, t, l);}
+    bool replace(int a, int b, char c) {return replace(a,b,&c,1);}
+    bool copy(bool clipboard = true);
+    bool undo();
+    void maybe_do_callback();
+    
+    int word_start(int i) const;
+    int word_end(int i) const;
+    int line_start(int i) const;
+    int line_end(int i) const;
+    int mouse_position(const Rectangle&) const;
+    int xscroll() const {return xscroll_;}
+    int yscroll() const {return yscroll_;}
+    
+#endif
+  };
+  
 }
 
 #endif

Modified: branches/branch-3.0/include/fltk/NumericInput.h
===================================================================
--- branches/branch-3.0/include/fltk/NumericInput.h     2012-06-01 12:16:23 UTC 
(rev 9568)
+++ branches/branch-3.0/include/fltk/NumericInput.h     2012-06-01 21:38:52 UTC 
(rev 9569)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
 //
 // "$Id$"
 //
@@ -7,7 +6,7 @@
 // arbitrary text such as a math expression to be typed, if you
 // want to restrict the user to a number use FloatInput or IntInput.
 //
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2010 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
@@ -32,21 +31,44 @@
 #ifndef fltk_NumericInput_h
 #define fltk_NumericInput_h
 
+#include <fltk3/NumericInput.h>
 #include "Input.h"
 
+
+FLTK2_WRAPPER_INTERFACE_BEGIN(NumericInput, NumericInput)
+FLTK2_WRAPPER_INTERFACE_WIDGET(NumericInput, NumericInput)
+FLTK2_WRAPPER_INTERFACE_END()
+
+
 namespace fltk {
+  
+  class FL_API NumericInput : public Input {
+    
+#if 0
+  protected:
+    int handle_arrow(int);
+#endif
+    
+  public:
+    
+    FLTK2_WIDGET_VCALLS(NumericInput, NumericInput)
+    
+    NumericInput() {}
+    
+    NumericInput(int x,int y,int w,int h, const char *l = 0) {
+      _p = new fltk3::NumericInput_I(x, y, w, h, l);
+      _p->wrapper(this);
+    }
 
-class FL_API NumericInput : public Input {
- protected:
-  int handle_arrow(int);
- public:
-  NumericInput(int x,int y, int w,int h,const char* l = 0) :
+#if 0
+    NumericInput(int x,int y, int w,int h,const char* l = 0) :
     Input(x,y,w,h,l) {when(WHEN_ENTER_KEY|WHEN_RELEASE);}
-  void value(double);
-  void value(int);
-  int handle(int);
-};
-
+    void value(double);
+    void value(int);
+    int handle(int);
+#endif
+  };
+  
 }
 #endif
 

Modified: branches/branch-3.0/include/fltk/Rectangle.h
===================================================================
--- branches/branch-3.0/include/fltk/Rectangle.h        2012-06-01 12:16:23 UTC 
(rev 9568)
+++ branches/branch-3.0/include/fltk/Rectangle.h        2012-06-01 21:38:52 UTC 
(rev 9569)
@@ -39,40 +39,61 @@
 //#define FLTK_CENTER_X(coord, length)  (coord + (length>>1))
 //#define FLTK_CENTER_Y(coord, length)  (coord + (length>>1))
 
+
 namespace fltk {
   
 
-  class FL_API Rectangle : public fltk3::WidgetWrapper {
+  class Rectangle : public fltk3::WidgetWrapper {
   protected:
     // FIXME: 123 - this should be public, but then it must initialize _p, 
which 
     // in turn means that we must create a different constructor that is 
called 
     // for a derived class (Widget).
     Rectangle() {}
     
-#if 0 // FIXME: 123
-
  public:
 
-  /*! Left edge */
-  int x() const {return x_;}
-  /*! Top edge */
-  int y() const {return y_;}
-  /*! Distance between left and right edges */
-  int w() const {return w_;}
-  /*! Distance between top and bottom edges */
-  int h() const {return h_;}
+    int x() {
+      return ((fltk3::Rectangle*)_p)->x();
+    }
+    
+    int y() {
+      return ((fltk3::Rectangle*)_p)->y();
+    }
+    
+    int w() {
+      return ((fltk3::Rectangle*)_p)->w();
+    }
+    
+    int h() {
+      return ((fltk3::Rectangle*)_p)->h();
+    }
+    
+    
+#if 0 // FIXME: 123
+    
   /*! Return x()+w(), the right edge of the rectangle. */
   int r() const {return x_+w_;}
   /*! Return y()+h(), the bottom edge of the rectangle. */
   int b() const {return y_+h_;}
-  /*! Move the rectangle so the left edge is at \a v. */
-  void x(int v) {x_ = v;}
-  /*! Move the rectangle so the top edge is at \a v. */
-  void y(int v) {y_ = v;}
-  /*! Change w() by moving the right edge. x() does not change. */
-  void w(int v) {w_ = v;}
-  /*! Change h() by moving the bottom edge. y() does not change. */
-  void h(int v) {h_ = v;}
+#endif
+    
+    void x(int v) {
+      ((fltk3::Rectangle*)_p)->x(v);
+    }
+    
+    void y(int v) {
+      ((fltk3::Rectangle*)_p)->y(v);
+    }
+    
+    void w(int v) {
+      ((fltk3::Rectangle*)_p)->w(v);
+    }
+    
+    void h(int v) {
+      ((fltk3::Rectangle*)_p)->h(v);
+    }
+    
+#if 0
   /*! Change x() without changing r(), by changing the width. */
   void set_x(int v) {w_ -= v-x_; x_ = v;}
   /*! Change y() without changing b(), by changing the height. */
@@ -108,11 +129,15 @@
   /*! Where to put baseline to center current font nicely */
   int baseline_y() const;
 
-  Rectangle() {}
-
-  /*! Constructor that sets x(), y(), w(), and h(). */
-  Rectangle(int x, int y, int w, int h) : x_(x), y_(y), w_(w), h_(h) {}
-
+#endif
+    
+    /*! Constructor that sets x(), y(), w(), and h(). */
+    Rectangle(int x, int y, int w, int h) {
+      _p = new fltk3::Rectangle(x, y, w, h);
+      _p->wrapper(this);
+    }
+    
+#if 0
   /*! Constructor that sets x() and y() to zero, and sets w() and h(). */
   Rectangle(int w, int h) : x_(0), y_(0), w_(w), h_(h) {}
 

Modified: branches/branch-3.0/include/fltk/Slider.h
===================================================================
--- branches/branch-3.0/include/fltk/Slider.h   2012-06-01 12:16:23 UTC (rev 
9568)
+++ branches/branch-3.0/include/fltk/Slider.h   2012-06-01 21:38:52 UTC (rev 
9569)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
 //
 // "$Id$"
 //
@@ -31,64 +30,78 @@
 #ifndef fltk_Slider_h
 #define fltk_Slider_h
 
-#ifndef fltk_Valuator_h
+
+#include <fltk3/Slider.h>
 #include "Valuator.h"
-#endif
 
-namespace fltk {
 
-class FL_API Slider : public Valuator {
+FLTK2_WRAPPER_INTERFACE_BEGIN(Slider, Slider)
+FLTK2_WRAPPER_INTERFACE_WIDGET(Slider, Slider)
+FLTK2_WRAPPER_INTERFACE_END()
 
-  unsigned short slider_size_;
-  unsigned short tick_size_;
 
-public:
+namespace fltk {
+  
+  class Slider : public Valuator {
+    
+  public:
 
-  enum { // bit flags for type():
-    LINEAR             = 0,
-    TICK_ABOVE         = 2,
-    TICK_LEFT          = TICK_ABOVE,
-    TICK_BELOW         = 4,
-    TICK_RIGHT         = TICK_BELOW,
-    TICK_BOTH          = TICK_ABOVE|TICK_BELOW,
-    LOG                        = 8
+    FLTK2_WIDGET_VCALLS(Slider, Slider)
+    
+    Slider() {}
+    
+    Slider(int x,int y,int w,int h, const char *l = 0) {
+      _p = new fltk3::Slider_I(x, y, w, h, l);
+      _p->wrapper(this);
+    }
+
+#if 0
+    enum { // bit flags for type():
+      LINEAR           = 0,
+      TICK_ABOVE               = 2,
+      TICK_LEFT                = TICK_ABOVE,
+      TICK_BELOW               = 4,
+      TICK_RIGHT               = TICK_BELOW,
+      TICK_BOTH                = TICK_ABOVE|TICK_BELOW,
+      LOG                      = 8
 #ifdef FLTK_1_SLIDER
-    // for back-compatability only
-    ,VERTICAL          = 0,
-    HORIZONTAL         = 1,
-    FILL               = 16
+      // for back-compatability only
+      ,VERTICAL                = 0,
+      HORIZONTAL               = 1,
+      FILL             = 16
 #endif
+    };
+    bool horizontal() const {return !flag(LAYOUT_VERTICAL) || (type()&1);}
+    bool log() const {return (type()&LOG)!=0;}
+    
+    void draw();
+    int handle(int);
+    
+    static NamedStyle* default_style;
+    
+    unsigned short slider_size() const {return slider_size_;}
+    void slider_size(int n) {slider_size_ = (unsigned short)n;}
+    unsigned short tick_size() const {return tick_size_;}
+    void tick_size(int n) {tick_size_ = (unsigned short)n;}
+    
+#ifdef FLTK_1_SLIDER
+    // back comptability:
+    Box* slider() const {return buttonbox();}
+    void slider(Box* b) {buttonbox(b);}
+    void slider_size(double v) {slider_size(int(v*w()));}
+#endif
+    
+    //protected:
+    
+    int slider_position(double value, int w);
+    double position_value(int x, int w);
+    int handle(int event, const Rectangle&);
+    void draw_ticks(const Rectangle&, int min_spacing);
+    bool draw(const Rectangle&, Flags flags, bool slot);
+#endif
+    
   };
-  bool horizontal() const {return !flag(LAYOUT_VERTICAL) || (type()&1);}
-  bool log() const {return (type()&LOG)!=0;}
-
-  void draw();
-  int handle(int);
-
-  Slider(int x,int y,int w,int h, const char *l = 0);
-  static NamedStyle* default_style;
-
-  unsigned short slider_size() const {return slider_size_;}
-  void slider_size(int n) {slider_size_ = (unsigned short)n;}
-  unsigned short tick_size() const {return tick_size_;}
-  void tick_size(int n) {tick_size_ = (unsigned short)n;}
   
-#ifdef FLTK_1_SLIDER
-  // back comptability:
-  Box* slider() const {return buttonbox();}
-  void slider(Box* b) {buttonbox(b);}
-  void slider_size(double v) {slider_size(int(v*w()));}
-#endif
-
-  //protected:
-
-  int slider_position(double value, int w);
-  double position_value(int x, int w);
-  int handle(int event, const Rectangle&);
-  void draw_ticks(const Rectangle&, int min_spacing);
-  bool draw(const Rectangle&, Flags flags, bool slot);
-};
-
 }
 
 #endif

Modified: branches/branch-3.0/include/fltk/Valuator.h
===================================================================
--- branches/branch-3.0/include/fltk/Valuator.h 2012-06-01 12:16:23 UTC (rev 
9568)
+++ branches/branch-3.0/include/fltk/Valuator.h 2012-06-01 21:38:52 UTC (rev 
9569)
@@ -57,18 +57,35 @@
       return ((fltk3::Valuator_I*)_p)->value(v);
     }
         
-#if 0
-    double minimum() const {return minimum_;}
-    void minimum(double a) {minimum_ = a;}
+    double minimum() const {
+      return ((fltk3::Valuator_I*)_p)->minimum();
+    }
+      
+    void minimum(double a) {
+      ((fltk3::Valuator_I*)_p)->minimum(a);
+    }
     
-    double maximum() const {return maximum_;}
-    void maximum(double a) {maximum_ = a;}
+    double maximum() const {
+      return ((fltk3::Valuator_I*)_p)->maximum();
+    }
     
-    void range(double a, double b) {minimum_ = a; maximum_ = b;}
+    void maximum(double a) {
+      ((fltk3::Valuator_I*)_p)->maximum(a);
+    }
     
-    double step() const {return step_;}
-    void step(double a) {step_ = a;}
+    void range(double a, double b) {
+      ((fltk3::Valuator_I*)_p)->range(a, b);
+    }
     
+    double step() const {
+      return ((fltk3::Valuator_I*)_p)->step();
+    }
+    
+    void step(double a) {
+      ((fltk3::Valuator_I*)_p)->step(a);
+    }
+    
+#if 0
     double linesize() const;
     void linesize(double a) {linesize_ = a;}
     double linesize_setting() const {return linesize_;}
@@ -102,15 +119,6 @@
     
     virtual void value_damage(); // callback whenever value changes
     void set_value(double v) {value_ = v;} // change w/o doing value_damage
-    
-  private:
-    
-    double value_;
-    double previous_value_;
-    double minimum_;
-    double maximum_;
-    double step_;
-    double linesize_;
 #endif
     
   };

Modified: branches/branch-3.0/include/fltk/ValueSlider.h
===================================================================
--- branches/branch-3.0/include/fltk/ValueSlider.h      2012-06-01 12:16:23 UTC 
(rev 9568)
+++ branches/branch-3.0/include/fltk/ValueSlider.h      2012-06-01 21:38:52 UTC 
(rev 9569)
@@ -1,8 +1,7 @@
-#error header has not been ported to 3.0 yet
 //
 // "$Id$"
 //
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2012 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
@@ -27,26 +26,43 @@
 #ifndef fltk_Value_Slider_h
 #define fltk_Value_Slider_h
 
+
+#include <fltk3/ValueSlider.h>
 #include "Slider.h"
 #include "FloatInput.h"
 
-namespace fltk {
 
-class FL_API ValueSlider : public Slider {
-public:
-  FloatInput input;
-  int handle(int);
-  void draw();
-  ValueSlider(int x,int y,int w,int h, const char *l = 0);
-  ~ValueSlider();
-  void layout();
-  virtual void value_damage(); // cause damage() due to value() changing
+FLTK2_WRAPPER_INTERFACE_BEGIN(ValueSlider, ValueSlider)
+FLTK2_WRAPPER_INTERFACE_WIDGET(ValueSlider, ValueSlider)
+FLTK2_WRAPPER_INTERFACE_END()
 
-private:
-  static void input_cb(Widget*,void*);
-  void slider_rect(Rectangle&);
-};
 
+namespace fltk {
+  
+  class ValueSlider : public Slider {
+    
+  public:
+    
+    FLTK2_WIDGET_VCALLS(ValueSlider, ValueSlider)
+    
+    ValueSlider() {}
+    
+    ValueSlider(int x,int y,int w,int h, const char *l = 0) {
+      _p = new fltk3::ValueSlider_I(x, y, w, h, l);
+      _p->wrapper(this);
+    }
+    
+#if 0
+    FloatInput input;
+    int handle(int);
+    void draw();
+    ~ValueSlider();
+    void layout();
+    virtual void value_damage(); // cause damage() due to value() changing
+#endif
+    
+  };
+  
 }
 #endif
 

Modified: branches/branch-3.0/include/fltk/Widget.h
===================================================================
--- branches/branch-3.0/include/fltk/Widget.h   2012-06-01 12:16:23 UTC (rev 
9568)
+++ branches/branch-3.0/include/fltk/Widget.h   2012-06-01 21:38:52 UTC (rev 
9569)
@@ -97,9 +97,17 @@
       GROUP_TYPE         = 0xe0,
       WINDOW_TYPE        = 0xf0
     };
+#endif
     
-    uchar      type() const            { return type_; }
-    void       type(uchar t)           { type_ = t; }
+    uchar type() const { 
+      return ((fltk3::Widget_I*)_p)->type();
+    }
+    
+    void type(uchar t) {
+      ((fltk3::Widget_I*)_p)->type(t);
+    }
+
+#if 0
     bool       is_group() const        { return type_ >= GROUP_TYPE; }
     bool       is_window() const       { return type_ >= WINDOW_TYPE; }
     

Modified: branches/branch-3.0/include/fltk/draw.h
===================================================================
--- branches/branch-3.0/include/fltk/draw.h     2012-06-01 12:16:23 UTC (rev 
9568)
+++ branches/branch-3.0/include/fltk/draw.h     2012-06-01 21:38:52 UTC (rev 
9569)
@@ -1,7 +1,6 @@
-#error header has not been ported to 3.0 yet
 // "$Id$"
 //
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2012 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
@@ -37,13 +36,18 @@
 #ifndef fltk_draw_h
 #define fltk_draw_h
 
+#include <fltk3/draw.h>
+
+#if 0
 #include "Flags.h" // for alignment values
 #include "Color.h"
 #include "Rectangle.h"
 #include "PixelType.h"
+#endif
 
 namespace fltk {
 
+#if 0
 /// \name fltk/draw.h
 //@{
 
@@ -56,15 +60,37 @@
   GSave();
   ~GSave();
 };
-
-// Transformation
-FL_API void push_matrix();
-FL_API void pop_matrix();
-FL_API void scale(float x, float y);
-FL_API void scale(float x);
-FL_API void translate(float x, float y);
-FL_API void translate(int x, int y);
-FL_API void rotate(float d);
+#endif
+  
+  void push_matrix() {
+    fltk3::push_matrix();
+  }
+  
+  void pop_matrix() {
+    fltk3::pop_matrix();
+  }
+  
+  void scale(float x, float y) {
+    fltk3::scale(x, y);
+  }
+  
+  void scale(float x) {
+    fltk3::scale(x);
+  }
+  
+  void translate(float x, float y) {
+    fltk3::translate(x, y);
+  }
+  
+  void translate(int x, int y) {
+    fltk3::translate(x, y);
+  }
+  
+  void rotate(float d) {
+    fltk3::rotate(d);
+  }
+  
+#if 0
 FL_API void concat(float, float, float, float, float, float);
 FL_API void load_identity();
 
@@ -78,15 +104,34 @@
 // Clipping
 FL_API void push_clip(const Rectangle&);
 //! Same as push_clip(Rectangle(x,y,w,h)) but faster:
-FL_API void push_clip(int X,int Y, int W, int H);
+#endif
+  
+  void push_clip(int X,int Y, int W, int H) {
+    fltk3::push_clip(X, Y, W, H);
+  }
+  
+#if 0
 FL_API void clipout(const Rectangle&);
-FL_API void pop_clip();
+#endif
+  
+  void pop_clip() {
+    fltk3::pop_clip();
+  }
+  
+#if 0
 FL_API void push_no_clip();
 FL_API bool not_clipped(const Rectangle&);
 FL_API int intersect_with_clip(Rectangle&);
 
 FL_API void setcolor(Color);
-FL_API void setcolor_alpha(Color, float alpha);
+#endif
+  
+  // FIXME: no alpha yet!
+  void setcolor_alpha(Color c, float alpha) {
+    fltk3::color(c);
+  }
+  
+#if 0
 extern FL_API Color current_color_;
 inline Color getcolor() {return current_color_;}
 
@@ -135,17 +180,37 @@
 FL_API void addvertices(int n, const int v[][2]);
 FL_API void addvertices_transformed(int n, const float v[][2]);
 FL_API void addcurve(float,float, float,float, float,float, float,float);
-FL_API void addarc(float x,float y,float w,float h, float a1, float a2);
+#endif
+  
+  void addarc(float x,float y,float w,float h, float a1, float a2) {
+    // FIXME: I like the FLTK2 naming convention much more!
+    fltk3::arc(x, y, w, h, a1, a2);
+  }
+  
+#if 0
 FL_API void addpie(const Rectangle& r, float a, float a2);
 FL_API void addchord(const Rectangle& r,float a,float a2);
-FL_API void closepath();
+#endif
+  
+  void closepath() {
+    fltk3::gap();
+  }
 
+#if 0
 // Shapes and lines
 FL_API void strokepath();
 FL_API void fillpath();
-FL_API void fillstrokepath(Color);
+#endif
 
-FL_API void fillrect(int, int, int, int);
+  void fillstrokepath(Color c) {
+    fltk3::end_polygon();
+  }
+  
+  void fillrect(int x, int y, int w, int h) {
+    fltk3::rectf(x, y, w, h);
+  }
+  
+#if 0
 inline void fillrect(const Rectangle& r) {fillrect(r.x(),r.y(),r.w(),r.h());}
 FL_API void strokerect(int, int, int, int);
 inline void strokerect(const Rectangle& r) 
{strokerect(r.x(),r.y(),r.w(),r.h());}
@@ -216,7 +281,8 @@
 #endif
 
 //@}
-
+#endif
+  
 }
 
 #endif

Modified: branches/branch-3.0/include/fltk3/FloatInput.h
===================================================================
--- branches/branch-3.0/include/fltk3/FloatInput.h      2012-06-01 12:16:23 UTC 
(rev 9568)
+++ branches/branch-3.0/include/fltk3/FloatInput.h      2012-06-01 21:38:52 UTC 
(rev 9569)
@@ -32,7 +32,7 @@
 #ifndef Fltk3_Float_Input_H
 #define Fltk3_Float_Input_H
 
-#include "Input.h"
+#include "NumericInput.h"
 
 namespace fltk3 {
   
@@ -41,7 +41,7 @@
    that only allows the user to type floating point numbers (sign,
    digits, decimal point, more digits, 'E' or 'e', sign, digits).
    */
-  class FLTK3_EXPORT FloatInput : public fltk3::Input { // don't use 
FLTK3_EXPORT here !
+  class FLTK3_EXPORT FloatInput : public fltk3::NumericInput { // don't use 
FLTK3_EXPORT here !
   public:
     /**
      Creates a new fltk3::FloatInput widget using the given position,
@@ -53,7 +53,7 @@
     FloatInput(int X,int Y,int W,int H,const char *l = 0);
 #else
     FloatInput(int X,int Y,int W,int H,const char *l = 0)
-    : fltk3::Input(X,Y,W,H,l) {type(fltk3::FLOAT_INPUT);}
+    : fltk3::NumericInput(X,Y,W,H,l) {type(fltk3::FLOAT_INPUT);}
 #endif
   };
   

Copied: branches/branch-3.0/include/fltk3/NumericInput.h (from rev 9568, 
branches/branch-3.0/include/fltk3/FloatInput.h)
===================================================================
--- branches/branch-3.0/include/fltk3/NumericInput.h                            
(rev 0)
+++ branches/branch-3.0/include/fltk3/NumericInput.h    2012-06-01 21:38:52 UTC 
(rev 9569)
@@ -0,0 +1,67 @@
+//
+// "$Id$"
+//
+// One-line text input field, which handles up/down arrows to
+// change the digit to the right of the cursor. This still allows
+// arbitrary text such as a math expression to be typed, if you
+// want to restrict the user to a number use FloatInput or IntInput.
+//
+// Copyright 1998-2010 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
+//
+
+/* \file
+ fltk3::NumericInput widget . */
+
+
+#ifndef Fltk3_Numeric_Input_H
+#define Fltk3_Numeric_Input_H
+
+#include "Input.h"
+
+namespace fltk3 {
+  
+  /**
+    One-line text input field, which handles up/down arrows to
+    change the digit to the right of the cursor. This still allows
+    arbitrary text such as a math expression to be typed, if you
+    want to restrict the user to a number use FloatInput or IntInput.
+   */
+  class FLTK3_EXPORT NumericInput : public fltk3::Input {
+  public:
+    /**
+     Creates a new fltk3::NumericInput widget using the given position,
+     size, and label string. The default boxtype is fltk3::DOWN_BOX.
+     
+     Inherited destructor destroys the widget and any value associated with it
+     FIXME: this is not yet implemented! Please copy code from FLTK2!
+     */
+    NumericInput(int X,int Y,int W,int H,const char *l = 0)
+    : fltk3::Input(X,Y,W,H,l) {type(fltk3::FLOAT_INPUT);}
+  };
+  
+}
+
+#endif
+
+//
+// End of "$Id$".
+//

Modified: branches/branch-3.0/src/fltk3/Input.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Input.cxx     2012-06-01 12:16:23 UTC (rev 
9568)
+++ branches/branch-3.0/src/fltk3/Input.cxx     2012-06-01 21:38:52 UTC (rev 
9569)
@@ -797,11 +797,16 @@
  */
 #if defined(FL_DLL)
 
-fltk3::FloatInput::FloatInput(int X,int Y,int W,int H,const char *l)
+fltk3::NumericInput::NumericInput(int X,int Y,int W,int H,const char *l)
 : fltk3::Input(X,Y,W,H,l) {
   type(fltk3::FLOAT_INPUT);
 }
 
+fltk3::FloatInput::FloatInput(int X,int Y,int W,int H,const char *l)
+: fltk3::NumericInput(X,Y,W,H,l) {
+  type(fltk3::FLOAT_INPUT);
+}
+
 fltk3::IntInput::IntInput(int X,int Y,int W,int H,const char *l)
 : fltk3::Input(X,Y,W,H,l) {
   type(fltk3::INT_INPUT);

Modified: branches/branch-3.0/test2/arc.cxx
===================================================================
--- branches/branch-3.0/test2/arc.cxx   2012-06-01 12:16:23 UTC (rev 9568)
+++ branches/branch-3.0/test2/arc.cxx   2012-06-01 21:38:52 UTC (rev 9569)
@@ -35,17 +35,16 @@
 
 #include <fltk/run.h>
 #include <fltk/Window.h>
-#if 0
 #include <fltk/ValueSlider.h>
 #include <fltk/draw.h>
 
+
 float dargs[7] = {90, 90, 100, 100, 0, 360, 0};
 const char* name[7] = {"X", "Y", "W", "H", "start", "end", "rotate"};
-#endif
 
+
 using namespace fltk;
 
-#if 0
 class Drawing : public Widget {
   void draw() {
     push_clip(0,0, w(), h());
@@ -57,18 +56,23 @@
       rotate(dargs[6]);
       translate(-w()/2.0f, -h()/2.0f);
       //}
+    fltk3::begin_complex_polygon();
+    setcolor_alpha(GRAY33, 0.5);
     addarc(dargs[0],dargs[1],dargs[2],dargs[3],dargs[4],dargs[5]);
     closepath();
     addarc(120,120,40,40,0,-360);
     setcolor_alpha(GRAY33,0.6);
     fillstrokepath(WHITE);
+#if 0
     // draw a hardware circle to see how well rotations match:
     setcolor(GRAY33);
     fltk::Rectangle r(20,20,(int)(dargs[2]+1),(int)(dargs[3]+1));
     addchord(r,dargs[4],dargs[5]);
     fillstrokepath(WHITE);
     // now draw non-rotated hardware circle to check if it inscribes:
+#endif
     pop_matrix();
+#if 0
     setcolor_alpha(GRAY40,0.6);
     r.set(10,(int) (270-dargs[3]),(int) dargs[2],(int)dargs[3]);
     fillrect(r);
@@ -77,6 +81,7 @@
     setcolor_alpha(RED,0.6);
     addchord(r,dargs[4],dargs[5]);
     fillstrokepath(GRAY90);
+#endif
     pop_clip();
   }
 public:
@@ -91,10 +96,8 @@
   d->redraw();
 }
 
-#endif
 int main(int argc, char** argv) {
-  Window window(300,500);
-#if 0
+  fltk::Window window(300,500);
   window.begin();
   Drawing drawing(10,10,280,280);
   d = &drawing;
@@ -106,17 +109,22 @@
     if (n<4) {s->minimum(0); s->maximum(300);}
     else if (n==6) {s->minimum(0); s->maximum(360);}
     else {s->minimum(-360); s->maximum(360);}
+#if 0
     s->type(Slider::TICK_ABOVE);
+#endif
     s->step(1);
     s->value(dargs[n]);
-       s->clear_flag(ALIGN_MASK);
+#if 0
+    s->clear_flag(ALIGN_MASK);
     s->set_flag(ALIGN_LEFT);
+#else
+    s->type(s->type() | 1);
+#endif
     s->callback(slider_cb, (void*)n);
   }
 
   window.end();
   window.resizable(drawing);
-#endif
   window.show(argc,argv);
   return run();
 }

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to