Author: matt
Date: 2011-01-11 02:15:14 -0800 (Tue, 11 Jan 2011)
New Revision: 8251
Log:
More random translations

Modified:
   branches/branch-3.0-2011/fltk/Button.h
   branches/branch-3.0-2011/fltk/Group.h
   branches/branch-3.0-2011/fltk/Widget.h
   branches/branch-3.0-2011/test2/button.cxx

Modified: branches/branch-3.0-2011/fltk/Button.h
===================================================================
--- branches/branch-3.0-2011/fltk/Button.h      2011-01-11 09:31:35 UTC (rev 
8250)
+++ branches/branch-3.0-2011/fltk/Button.h      2011-01-11 10:15:14 UTC (rev 
8251)
@@ -1,5 +1,3 @@
-#warn FLTK123: This file has not been ported yet
-#if 0
 //
 // "$Id: Button.h 5433 2006-09-16 03:00:02Z spitzak $"
 //
@@ -25,17 +23,21 @@
 // Please report all bugs and problems to "[email protected]".
 //
 
-#ifndef fltk_Button_h
-#define fltk_Button_h
+#ifndef fltk2_Button_h
+#define fltk2_Button_h
 
-#ifndef fltk_Widget_h
+#include <fltk3/Button.h>
 #include "Widget.h"
-#endif
 
 namespace fltk {
 
 class FL_API Button : public Widget {
 public:
+  Button(int x, int y, int w, int h, const char *l = 0) {
+    _p = new fltk3::Button(x, y, w, h, l);
+    _p->wrapper(this);
+  }
+#if 0 // TODO: FLTK123
   enum {HIDDEN=3}; // back-comptability value to hide the button
 
   bool value() const { return state(); }
@@ -43,11 +45,11 @@
 
   int handle(int);
   int handle(int event, const Rectangle&);
-  Button(int,int,int,int,const char * = 0);
   static NamedStyle* default_style;
 
   virtual void draw();
   void draw(int glyph_width) const;
+#endif // TODO: FLTK123
 };
 
 }
@@ -57,4 +59,3 @@
 //
 // End of "$Id: Button.h 5433 2006-09-16 03:00:02Z spitzak $".
 //
-#endif

Modified: branches/branch-3.0-2011/fltk/Group.h
===================================================================
--- branches/branch-3.0-2011/fltk/Group.h       2011-01-11 09:31:35 UTC (rev 
8250)
+++ branches/branch-3.0-2011/fltk/Group.h       2011-01-11 10:15:14 UTC (rev 
8251)
@@ -36,29 +36,35 @@
 public:
   
   Group() {}
-  Group(int,int,int,int, const char * = 0, bool begin=false);
-
-
+  Group(int x, int y, int w, int h, const char *l = 0, bool aBegin=false) {
+    _p = new fltk3::Group(x, y, w, h, l);
+    _p->wrapper(this);
+    if (aBegin)
+      begin();
+  }
+  void begin() { 
+    ((fltk3::Group*)_p)->begin(); 
+  }
+  void end() { 
+    ((fltk3::Group*)_p)->end(); 
+  }
+  void resizable(Widget* o) {
+    ((fltk3::Group*)_p)->resizable( (fltk3::Widget*)(o->_p) ); 
+  }
+  void resizable(Widget& o) {
+    resizable(&o);
+  }
+  
 #if 0 // TODO: FLTK123  
   int children() const {return children_;}
   Widget* child(int n) const {return array_[n];}
-
   void draw();
   void layout();
   int handle(int);
-#endif // TODO: FLTK123
-  
-  void begin() { ((fltk3::Group*)_p)->begin(); }
-  void end() { ((fltk3::Group*)_p)->end(); }
-  
-#if 0 // TODO: FLTK123
   static Group *current() {return current_;}
   static void current(Group *g) {current_ = g;}
-
   int find(const Widget*) const;
   int find(const Widget& o) const {return find(&o);}
-
-  Group(int,int,int,int, const char * = 0, bool begin=false);
   virtual ~Group();
   void add(Widget&);
   void add(Widget* o) {add(*o);}
@@ -72,22 +78,16 @@
   void replace(Widget& old, Widget& o) {replace(find(old),o);}
   void swap(int indexA, int indexB);
   void clear();
-
-  void resizable(Widget& o) {resizable_ = &o;}
-  void resizable(Widget* o) {resizable_ = o;}
   Widget* resizable() const {return resizable_;}
   void add_resizable(Widget& o) {resizable_ = &o; add(o);}
   void init_sizes();
-
   void focus_index(int v) {focus_index_ = v;}
   void set_focus(Widget* w) {focus_index_ = find(w);}
   int  focus_index() const {return focus_index_;}
   static int navigation_key();
-
   // back compatability function:
   friend FL_FORMS_API void end_group(); // forms emulation function
   void fix_old_positions();
-
   Flags resize_align() const {return resize_align_;}
   void resize_align(Flags f) {resize_align_ = f;}
 
@@ -99,17 +99,6 @@
   int initial_w, initial_h;
   int* sizes();
   void layout(const Rectangle&, int layout_damage);
-
-private:
-
-  int children_;
-  int focus_index_;
-  Widget** array_;
-  Widget* resizable_;
-  Flags resize_align_;
-  int *sizes_; // remembered initial sizes of children
-
-  static Group *current_;
 #endif // TODO: FLTK123
 };
 

Modified: branches/branch-3.0-2011/fltk/Widget.h
===================================================================
--- branches/branch-3.0-2011/fltk/Widget.h      2011-01-11 09:31:35 UTC (rev 
8250)
+++ branches/branch-3.0-2011/fltk/Widget.h      2011-01-11 10:15:14 UTC (rev 
8251)
@@ -42,21 +42,40 @@
 class FL_API AssociationType;
 class FL_API AssociationFunctor;
 struct Cursor;
+#endif // TODO: FLTK123
 
 typedef void (Callback )(Widget*, void*);
-typedef Callback* Callback_p; // needed for BORLAND
+typedef Callback* Callback_p;
 typedef void (Callback0)(Widget*);
 typedef void (Callback1)(Widget*, long);
 
+#if 0 // TODO: FLTK123
+
 #ifdef FLTK_1_WIDGET  // back-compatability section:
 FL_API Font* font(int);
 #endif
   
 #endif // TODO: FLTK123
   
+  // TODO: this should be derived from Rectangle!
   class FL_API Widget : public fltk3::WidgetWrapper {
   
 public:
+    
+    // TODO: this should be derived from Rectangle!
+    int x() {
+      return ((fltk3::Widget*)_p)->x();
+    }
+    int y() {
+      return ((fltk3::Widget*)_p)->y();
+    }
+    int w() {
+      return ((fltk3::Widget*)_p)->w();
+    }
+    int h() {
+      return ((fltk3::Widget*)_p)->h();
+    }
+    
 
     Widget() {}
     Widget(int x, int y, int w, int h, const char *l=0) {
@@ -123,8 +142,35 @@
     void tooltip(const char *t)        {
       ((fltk3::Widget*)_p)->tooltip(t);
     }
-    
+    Callback_p callback() const        {
+      return (Callback_p)((fltk3::Widget*)_p)->callback();
+    }
+    void callback(Callback* cb, void* p) { 
+      ((fltk3::Widget*)_p)->callback( (fltk3::Callback*)cb, p );
+    }
+    void callback(Callback* cb) {
+      ((fltk3::Widget*)_p)->callback( (fltk3::Callback*)cb );
+    }
+    void callback(Callback0* cb)       {
+      ((fltk3::Widget*)_p)->callback( (fltk3::Callback0*)cb );
+    }
+    void callback(Callback1* cb, long p=0) {
+      ((fltk3::Widget*)_p)->callback( (fltk3::Callback1*)cb, p );
+    }
+    void do_callback() {
+      ((fltk3::Widget*)_p)->do_callback();
+    }
+    void do_callback(Widget* o,void* arg=0) { 
+      ((fltk3::Widget*)_p)->do_callback( (fltk3::Widget*)( ((Widget*)o)->_p ), 
arg );
+    }
+    void do_callback(Widget* o,long arg) { 
+      ((fltk3::Widget*)_p)->do_callback( (fltk3::Widget*)( ((Widget*)o)->_p ), 
arg );
+    }    
+    void color(Color c) {
+      ((fltk3::Widget*)_p)->color((fltk3::Color)c);
+    }
 #if 0 // TODO: FLTK123
+    static void default_callback(Widget*, void*);
   int  send(int event);
   virtual void layout();
   const Style* style() const { return style_; }
@@ -158,21 +204,12 @@
   bool test_label_shortcut() const;
   bool test_shortcut() const   ;
   bool  test_shortcut(bool) const;
-  Callback_p callback() const  { return callback_; }
-  void callback(Callback* c, void* p) { callback_=c; user_data_=p; }
-  void callback(Callback* c)   { callback_=c; }
-  void callback(Callback0*c)   { callback_=(Callback*)c; }
-  void callback(Callback1*c, long p=0) { callback_=(Callback*)c; 
user_data_=(void*)p; }
   void*        user_data() const       { return user_data_; }
   void user_data(void* v)      { user_data_ = v; }
   long argument() const        { return (long)user_data_; }
   void argument(long v)        { user_data_ = (void*)v; }
   uchar when() const           { return when_; }
   void when(uchar i)           { when_ = i; }
-  static void default_callback(Widget*, void*);
-  void do_callback()           { callback_(this,user_data_); }
-  void do_callback(Widget* o,void* arg=0) { callback_(o,arg); }
-  void do_callback(Widget* o,long arg) { callback_(o,(void*)arg); }
   bool contains(const Widget*) const;
   bool inside(const Widget* o) const { return o && o->contains(this); }
   bool pushed() const          ;
@@ -269,7 +306,6 @@
   unsigned char scrollbar_width() const;
   void glyph(Symbol*)          ;
   void textfont(Font*)         ;
-  void color(Color)            ;
   void textcolor(Color a)      ;
   void selection_color(Color)  ;
   void selection_textcolor(Color);

Modified: branches/branch-3.0-2011/test2/button.cxx
===================================================================
--- branches/branch-3.0-2011/test2/button.cxx   2011-01-11 09:31:35 UTC (rev 
8250)
+++ branches/branch-3.0-2011/test2/button.cxx   2011-01-11 10:15:14 UTC (rev 
8251)
@@ -5,12 +5,13 @@
 #include <fltk/run.h>
 #include <fltk/Window.h>
 #include <fltk/Button.h>
-#include <fltk/InvisibleBox.h>
-#include <fltk/TiledImage.h>
-#include <fltk/SharedImage.h>
+// TODO: #include <fltk/InvisibleBox.h>
+// TODO: #include <fltk/TiledImage.h>
+// TODO: #include <fltk/SharedImage.h>
 using namespace fltk;
 
-void beepcb(Widget *, void *) {
+void beepcb(Widget *w, void *) {
+  w->color(FL_RED);
   printf("\007"); fflush(stdout);
 }
 
@@ -19,20 +20,20 @@
 }
 
 int main(int argc, char ** argv) {
-  register_images();
+  // TODO: register_images();
   Window *window = new Window(320,65);
 
   window->begin();
   Group* ib = new Group(0,0,window->w(),window->h());
   ib->begin();
-  ib->image(new TiledImage(SharedImage::get("./images/bg.jpeg")));
+  // TODO: ib->image(new TiledImage(SharedImage::get("./images/bg.jpeg")));
   window->resizable(ib);
 
   Button *b1 = new Button(20, 20, 80, 25, "&Beep");
   b1->callback(beepcb,0);
   
   Button *b2 = new Button(120,20, 80, 25, "");
-  b2->image(new TiledImage(SharedImage::get("./images/coucou.png")));
+  // TODO: b2->image(new TiledImage(SharedImage::get("./images/coucou.png")));
 
   Button *b3 = new Button(220,20, 80, 25, "E&xit");
   b3->callback(exitcb,0);

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

Reply via email to