Author: matt
Date: 2010-04-01 09:08:15 -0700 (Thu, 01 Apr 2010)
New Revision: 7393
Log:
Ported Fl_Repeat_Button.H

Added:
   branches/branch-3.0/fltk3/RepeatButton.h
Modified:
   branches/branch-3.0/FL/Fl_Repeat_Button.H
   branches/branch-3.0/fltk/RepeatButton.h
   branches/branch-3.0/fltk3/Fl_Repeat_Button.H
   branches/branch-3.0/fltk3/Fl_Spinner.H
   branches/branch-3.0/src/Fl_Repeat_Button.cxx
   branches/branch-3.0/src/forms_compatability.cxx
   branches/branch-3.0/test/buttons.cxx
   branches/branch-3.0/test/buttons1.cxx
   branches/branch-3.0/test/buttons2.cxx

Modified: branches/branch-3.0/FL/Fl_Repeat_Button.H
===================================================================
--- branches/branch-3.0/FL/Fl_Repeat_Button.H   2010-04-01 15:56:17 UTC (rev 
7392)
+++ branches/branch-3.0/FL/Fl_Repeat_Button.H   2010-04-01 16:08:15 UTC (rev 
7393)
@@ -28,32 +28,23 @@
 /* \file
    Fl_Repeat_Button widget . */
 
-#ifndef Fl_Repeat_Button_H
-#define Fl_Repeat_Button_H
+#ifndef Fltk1_Repeat_Button_H
+#define Fltk1_Repeat_Button_H
+
+#include <fltk3/RepeatButton.h>
+
 #include "Fl.H"
 #include "Fl_Button.H"
 
-/**
-  The Fl_Repeat_Button is a subclass of Fl_Button that
-  generates a callback when it is pressed and then repeatedly generates
-  callbacks as long as it is held down.  The speed of the repeat is fixed
-  and depends on the implementation.
-*/
 class FL_EXPORT Fl_Repeat_Button : public Fl_Button {
-  static void repeat_callback(void *);
 public:
-  int handle(int);
-  /**
-    Creates a new Fl_Repeat_Button widget using the given
-    position, size, and label string. The default boxtype is FL_UP_BOX.
-    Deletes the button.
-  */
-  Fl_Repeat_Button(int X,int Y,int W,int H,const char *l=0)
-    : Fl_Button(X,Y,W,H,l) {}
-  void deactivate() {
-    fltk3::remove_timeout(repeat_callback,this);
-    Fl_Button::deactivate();
+  // fltk123: int handle(int);
+  
+  Fl_Repeat_Button(int X,int Y,int W,int H,const char *l=0) {
+    _p = new fltk3::RepeatButton(X, Y, W, H, l);
+    _p->wrapper(this);
   }
+  void deactivate() { ((fltk3::RepeatButton*)_p)->deactivate(); }
 };
 
 #endif

Modified: branches/branch-3.0/fltk/RepeatButton.h
===================================================================
--- branches/branch-3.0/fltk/RepeatButton.h     2010-04-01 15:56:17 UTC (rev 
7392)
+++ branches/branch-3.0/fltk/RepeatButton.h     2010-04-01 16:08:15 UTC (rev 
7393)
@@ -1,41 +1,23 @@
 //
 // "$Id: RepeatButton.h 4886 2006-03-30 09:55:32Z fabien $"
 //
-// This button does it's callback repeatedly (about 10/second) while
-// the user holds the button down.
-//
-// Copyright 1998-2006 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 to "[email protected]".
-//
 
-#ifndef fltk_RepeatButton_h
-#define fltk_RepeatButton_h
+#ifndef fltk2_RepeatButton_h
+#define fltk2_RepeatButton_h
 
+#include <fltk3/RepeatButton.h>
+
 #include "Button.h"
 
 namespace fltk {
 
 class FL_API RepeatButton : public Button {
-  static void repeat_callback(void *);
 public:
-  int handle(int);
-  RepeatButton(int x,int y,int w,int h,const char *l=0) : Button(x,y,w,h,l) {}
+  // fltk123: int handle(int);
+  RepeatButton(int x,int y,int w,int h,const char *l=0) {
+    _p = new fltk3::RepeatButton(x, y, w, h, l);
+    _p->wrapper(this);
+  }
 };
 
 }

Modified: branches/branch-3.0/fltk3/Fl_Repeat_Button.H
===================================================================
--- branches/branch-3.0/fltk3/Fl_Repeat_Button.H        2010-04-01 15:56:17 UTC 
(rev 7392)
+++ branches/branch-3.0/fltk3/Fl_Repeat_Button.H        2010-04-01 16:08:15 UTC 
(rev 7393)
@@ -1,5 +1,5 @@
 //
-// "$Id: Fl_Repeat_Button.H 7365 2010-03-30 15:18:29Z matt $"
+// "$Id: RepeatButton.h 7365 2010-03-30 15:18:29Z matt $"
 //
 // Repeat button header file for the Fast Light Tool Kit (FLTK).
 //
@@ -26,7 +26,7 @@
 //
 
 /* \file
-   Fl_Repeat_Button widget . */
+   fltk3::RepeatButton widget . */
 
 #ifndef Fl_Repeat_Button_H
 #define Fl_Repeat_Button_H
@@ -34,21 +34,21 @@
 #include "Button.h"
 
 /**
-  The Fl_Repeat_Button is a subclass of fltk3::Button that
+  The fltk3::RepeatButton is a subclass of fltk3::Button that
   generates a callback when it is pressed and then repeatedly generates
   callbacks as long as it is held down.  The speed of the repeat is fixed
   and depends on the implementation.
 */
-class FL_EXPORT Fl_Repeat_Button : public fltk3::Button {
+class FL_EXPORT fltk3::RepeatButton : public fltk3::Button {
   static void repeat_callback(void *);
 public:
   int handle(int);
   /**
-    Creates a new Fl_Repeat_Button widget using the given
+    Creates a new fltk3::RepeatButton widget using the given
     position, size, and label string. The default boxtype is fltk3::UP_BOX.
     Deletes the button.
   */
-  Fl_Repeat_Button(int X,int Y,int W,int H,const char *l=0)
+  fltk3::RepeatButton(int X,int Y,int W,int H,const char *l=0)
     : fltk3::Button(X,Y,W,H,l) {}
   void deactivate() {
     fltk3::remove_timeout(repeat_callback,this);
@@ -59,5 +59,5 @@
 #endif
 
 //
-// End of "$Id: Fl_Repeat_Button.H 7365 2010-03-30 15:18:29Z matt $".
+// End of "$Id: RepeatButton.h 7365 2010-03-30 15:18:29Z matt $".
 //

Modified: branches/branch-3.0/fltk3/Fl_Spinner.H
===================================================================
--- branches/branch-3.0/fltk3/Fl_Spinner.H      2010-04-01 15:56:17 UTC (rev 
7392)
+++ branches/branch-3.0/fltk3/Fl_Spinner.H      2010-04-01 16:08:15 UTC (rev 
7393)
@@ -38,7 +38,7 @@
 #  include <fltk3/Enumerations.H>
 #  include <fltk3/Group.h>
 #  include <fltk3/Fl_Input.H>
-#  include <fltk3/Fl_Repeat_Button.H>
+#  include <fltk3/RepeatButton.h>
 #  include <stdio.h>
 #  include <stdlib.h>
 
@@ -57,7 +57,7 @@
   const char   *format_;               // Format string
 
   Fl_Input     input_;                 // Input field for the value
-  Fl_Repeat_Button
+  fltk3::RepeatButton
                up_button_,             // Up button
                down_button_;           // Down button
 

Copied: branches/branch-3.0/fltk3/RepeatButton.h (from rev 7384, 
branches/branch-3.0/fltk3/Fl_Repeat_Button.H)
===================================================================
--- branches/branch-3.0/fltk3/RepeatButton.h                            (rev 0)
+++ branches/branch-3.0/fltk3/RepeatButton.h    2010-04-01 16:08:15 UTC (rev 
7393)
@@ -0,0 +1,67 @@
+//
+// "$Id: RepeatButton.h 7365 2010-03-30 15:18:29Z matt $"
+//
+// Repeat button header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2009 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
+   RepeatButton widget . */
+
+#ifndef Fltk3_Repeat_Button_H
+#define Fltk3_Repeat_Button_H
+#include "run.h"
+#include "Button.h"
+
+namespace fltk3 {
+
+/**
+  The RepeatButton is a subclass of Button that
+  generates a callback when it is pressed and then repeatedly generates
+  callbacks as long as it is held down.  The speed of the repeat is fixed
+  and depends on the implementation.
+*/
+class FL_EXPORT RepeatButton : public Button {
+  static void repeat_callback(void *);
+public:
+  int handle(int);
+  /**
+    Creates a new fltk3::RepeatButton widget using the given
+    position, size, and label string. The default boxtype is fltk3::UP_BOX.
+    Deletes the button.
+  */
+  RepeatButton(int X,int Y,int W,int H,const char *l=0)
+    : Button(X,Y,W,H,l) {}
+  void deactivate() {
+    remove_timeout(repeat_callback,this);
+    Button::deactivate();
+  }
+};
+
+}
+
+#endif
+
+//
+// End of "$Id: RepeatButton.h 7365 2010-03-30 15:18:29Z matt $".
+//

Modified: branches/branch-3.0/src/Fl_Repeat_Button.cxx
===================================================================
--- branches/branch-3.0/src/Fl_Repeat_Button.cxx        2010-04-01 15:56:17 UTC 
(rev 7392)
+++ branches/branch-3.0/src/Fl_Repeat_Button.cxx        2010-04-01 16:08:15 UTC 
(rev 7393)
@@ -26,18 +26,18 @@
 //
 
 #include <fltk3/run.h>
-#include <fltk3/Fl_Repeat_Button.H>
+#include <fltk3/RepeatButton.h>
 
 #define INITIALREPEAT .5
 #define REPEAT .1
 
-void Fl_Repeat_Button::repeat_callback(void *v) {
+void fltk3::RepeatButton::repeat_callback(void *v) {
   fltk3::Button *b = (fltk3::Button*)v;
   fltk3::add_timeout(REPEAT,repeat_callback,b);
   b->do_callback();
 }
 
-int Fl_Repeat_Button::handle(int event) {
+int fltk3::RepeatButton::handle(int event) {
   int newval;
   switch (event) {
   case fltk3::HIDE:

Modified: branches/branch-3.0/src/forms_compatability.cxx
===================================================================
--- branches/branch-3.0/src/forms_compatability.cxx     2010-04-01 15:56:17 UTC 
(rev 7392)
+++ branches/branch-3.0/src/forms_compatability.cxx     2010-04-01 16:08:15 UTC 
(rev 7393)
@@ -149,7 +149,7 @@
 // Create a forms button by selecting correct fltk subclass:
 
 #include <fltk3/ReturnButton.h>
-#include <fltk3/Fl_Repeat_Button.H>
+#include <fltk3/RepeatButton.h>
 
 fltk3::Button *fl_add_button(uchar t,int x,int y,int w,int h,const char *l) {
   fltk3::Button *b;
@@ -159,7 +159,7 @@
     b = new fltk3::ReturnButton(x,y,w,h,l);
     break;
   case FL_TOUCH_BUTTON:
-    b = new Fl_Repeat_Button(x,y,w,h,l);
+    b = new fltk3::RepeatButton(x,y,w,h,l);
     break;
   default:
     b = new fltk3::Button(x,y,w,h,l);

Modified: branches/branch-3.0/test/buttons.cxx
===================================================================
--- branches/branch-3.0/test/buttons.cxx        2010-04-01 15:56:17 UTC (rev 
7392)
+++ branches/branch-3.0/test/buttons.cxx        2010-04-01 16:08:15 UTC (rev 
7393)
@@ -31,7 +31,7 @@
 #include <fltk3/Window.h>
 #include <fltk3/Button.h>
 #include <fltk3/ReturnButton.h>
-// fltk123: #include <fltk3/RepeatButton.h>
+#include <fltk3/RepeatButton.h>
 // fltk123: #include <fltk3/CheckButton.h>
 // fltk123: #include <fltk3/LightButton.h>
 // fltk123: #include <fltk3/Fl_Round_Button.h>
@@ -45,7 +45,7 @@
   {
     (new Button(10, 10, 130, 30, "Button"))->tooltip("This is a Tooltip.");
     new ReturnButton(150, 10, 160, 30, "ReturnButton");
-    // fltk123: new RepeatButton(10,50,130,30,"RepeatButton");
+    new RepeatButton(10,50,130,30,"RepeatButton");
     // fltk123: new LightButton(10,90,130,30,"LightButton");
     // fltk123: new Fl_Round_Button(150,50,160,30,"Fl_Round_Button");
     // fltk123: new CheckButton(150,90,160,30,"CheckButton");

Modified: branches/branch-3.0/test/buttons1.cxx
===================================================================
--- branches/branch-3.0/test/buttons1.cxx       2010-04-01 15:56:17 UTC (rev 
7392)
+++ branches/branch-3.0/test/buttons1.cxx       2010-04-01 16:08:15 UTC (rev 
7393)
@@ -31,7 +31,7 @@
 #include <FL/Fl_Window.H>
 #include <FL/Fl_Button.H>
 #include <FL/Fl_Return_Button.H>
-// fltk123: #include <FL/Fl_Repeat_Button.H>
+#include <FL/Fl_Repeat_Button.H>
 // fltk123: #include <FL/Fl_Check_Button.H>
 // fltk123: #include <FL/Fl_Light_Button.H>
 // fltk123: #include <FL/Fl_Round_Button.H>
@@ -41,7 +41,7 @@
   Fl_Window *window = new Fl_Window(320,130);
   (new Fl_Button(10, 10, 130, 30, "Fl_Button"))->tooltip("This is a Tooltip.");
   new Fl_Return_Button(150, 10, 160, 30, "Fl_Return_Button");
-  // fltk123: new Fl_Repeat_Button(10,50,130,30,"Fl_Repeat_Button");
+  new Fl_Repeat_Button(10,50,130,30,"Fl_Repeat_Button");
   // fltk123: new Fl_Light_Button(10,90,130,30,"Fl_Light_Button");
   // fltk123: new Fl_Round_Button(150,50,160,30,"Fl_Round_Button");
   // fltk123: new Fl_Check_Button(150,90,160,30,"Fl_Check_Button");

Modified: branches/branch-3.0/test/buttons2.cxx
===================================================================
--- branches/branch-3.0/test/buttons2.cxx       2010-04-01 15:56:17 UTC (rev 
7392)
+++ branches/branch-3.0/test/buttons2.cxx       2010-04-01 16:08:15 UTC (rev 
7393)
@@ -30,7 +30,7 @@
 #include <fltk/Button.h>
 // fltk123: #include <fltk/ToggleButton.h>
 #include <fltk/ReturnButton.h>
-// fltk123: #include <fltk/RepeatButton.h>
+#include <fltk/RepeatButton.h>
 // fltk123: #include <fltk/CheckButton.h>
 // fltk123: #include <fltk/RadioButton.h>
 // fltk123: #include <fltk/LightButton.h>
@@ -106,7 +106,7 @@
   // fltk123: (void) new ToggleButton(X0, Y, W, H, "ToggleButton");
   // fltk123: (void) new RadioButton(X1, Y, W, H, "RadioButton");
   Y += H+B;
-  // fltk123: (void) new RepeatButton(X0, Y, W, H, "RepeatButton");
+  (void) new RepeatButton(X0, Y, W, H, "RepeatButton");
   // fltk123: (void) new RadioButton(X1, Y, W, H, "RadioButton");
   Y += H+B;
   // fltk123: (void) new LightButton(X0, Y, W, H, "LightButton");

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

Reply via email to