Author: matt Date: 2010-03-30 14:35:40 -0700 (Tue, 30 Mar 2010) New Revision: 7372 Log: OK, I managed to get the fltk2 version of hello.cxx to work somewhat. I am hitting the first issues that need to be resolved. Boy, I have to admit, FLTK2 is a lot cleaner and makes much sense ;-).
Modified: branches/branch-3.0/fltk/Group.h branches/branch-3.0/fltk/Rectangle.h branches/branch-3.0/fltk/Widget.h branches/branch-3.0/fltk/Window.h branches/branch-3.0/fltk/run.h branches/branch-3.0/fltk3/Group.h branches/branch-3.0/test/hello2.cxx Modified: branches/branch-3.0/fltk/Group.h =================================================================== --- branches/branch-3.0/fltk/Group.h 2010-03-30 21:07:46 UTC (rev 7371) +++ branches/branch-3.0/fltk/Group.h 2010-03-30 21:35:40 UTC (rev 7372) @@ -1,57 +1,43 @@ // // "$Id: Group.h 5915 2007-06-19 17:49:29Z spitzak $" // -// Group is the base class for all container widgets. For historical -// reasons it also provides a default version of layout. -// -// 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_Group_h -#define fltk_Group_h +#ifndef fltk2_Group_h +#define fltk2_Group_h -#ifndef fltk_Widget_h -# include "Widget.h" -#endif +#include "Widget.h" +#include <fltk3/Group.h> namespace fltk { class FL_API Group : public Widget { +protected: + Group() { } + public: - +#if 0 int children() const {return children_;} Widget* child(int n) const {return array_[n];} void draw(); void layout(); int handle(int); - - void begin() {current_ = this;} - void end() {current_ = (Group*)parent();} +#endif + + void begin() { ((fltk3::Group*)_p)->begin(); } + void end() { ((fltk3::Group*)_p)->end(); } + +#if 0 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);} - +#endif + Group(int,int,int,int, const char * = 0, bool begin=false); + +#if 0 virtual ~Group(); void add(Widget&); void add(Widget* o) {add(*o);} @@ -103,7 +89,8 @@ int *sizes_; // remembered initial sizes of children static Group *current_; - +#endif + }; } Modified: branches/branch-3.0/fltk/Rectangle.h =================================================================== --- branches/branch-3.0/fltk/Rectangle.h 2010-03-30 21:07:46 UTC (rev 7371) +++ branches/branch-3.0/fltk/Rectangle.h 2010-03-30 21:35:40 UTC (rev 7372) @@ -22,6 +22,7 @@ #ifndef fltk_Rectangle_h #define fltk_Rectangle_h +#include <fltk3/Wrapper.h> #include "FL_API.h" // rectangle macros that help keeping rectangle predicates as strict as possible @@ -35,11 +36,15 @@ namespace fltk { -class FL_API Rectangle { + class FL_API Rectangle : public fltk3::Wrapper { + +#if 0 int x_, y_, w_, h_; +#endif public: - + +#if 0 /*! Left edge */ int x() const {return x_;} /*! Top edge */ @@ -114,7 +119,8 @@ void merge(const Rectangle& r); void intersect(const Rectangle& r); - +#endif + }; } Modified: branches/branch-3.0/fltk/Widget.h =================================================================== --- branches/branch-3.0/fltk/Widget.h 2010-03-30 21:07:46 UTC (rev 7371) +++ branches/branch-3.0/fltk/Widget.h 2010-03-30 21:35:40 UTC (rev 7372) @@ -2,31 +2,17 @@ // // 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_Widget_h -#define fltk_Widget_h +#ifndef fltk2_Widget_h +#define fltk2_Widget_h #include "Style.h" #include "Rectangle.h" +#include <fltk3/Widget.h> namespace fltk { +#if 0 class FL_API Widget; class FL_API Window; class FL_API Symbol; @@ -43,17 +29,25 @@ #ifdef FLTK_1_WIDGET // back-compatability section: FL_API Font* font(int); #endif +#endif class FL_API Widget : public Rectangle { // disable the copy assignment/constructors: Widget & operator=(const Widget &); Widget(const Widget &); +protected: + Widget() { } + public: - Widget(int,int,int,int,const char* =0); - virtual ~Widget(); + Widget(int x, int y, int w, int h, const char *title=0) { + _p = new fltk3::Widget(x, y, w, h, title); + _p->wrapper(this); + } + virtual ~Widget() { } +#if 0 virtual void draw(); virtual int handle(int); int send(int event); @@ -234,13 +228,24 @@ float leading() const; unsigned char scrollbar_align() const; unsigned char scrollbar_width() const; - +#endif + void box(Box*) ; + +#if 0 void buttonbox(Box*) ; void glyph(Symbol*) ; +#endif + void labelfont(Font*) ; + +#if 0 void textfont(Font*) ; +#endif + void labeltype(LabelType*) ; + +#if 0 void color(Color) ; void textcolor(Color a) ; void selection_color(Color) ; @@ -249,7 +254,11 @@ void labelcolor(Color) ; void highlight_color(Color) ; void highlight_textcolor(Color); - void labelsize(float a) ; +#endif + + void labelsize(float a) { _p->labelsize(a); } + +#if 0 void textsize(float a) ; void leading(float a) ; void scrollbar_align(unsigned char); @@ -284,7 +293,11 @@ void color2(Color a) { selection_color(a); } void color3(Color a) { buttoncolor(a); } void down_labelcolor(Color a) { selection_textcolor(a); } +#endif + void labelfont(unsigned a) { labelfont(font(a)); } + +#if 0 void fly_color(Color a) { highlight_color(a); } void textfont(unsigned a) { textfont(font(a)); } void selected_textcolor(Color a) { selection_textcolor(a); } @@ -308,7 +321,8 @@ uchar damage_; uchar layout_damage_; uchar when_; - +#endif + }; enum { // Widget::when() values Modified: branches/branch-3.0/fltk/Window.h =================================================================== --- branches/branch-3.0/fltk/Window.h 2010-03-30 21:07:46 UTC (rev 7371) +++ branches/branch-3.0/fltk/Window.h 2010-03-30 21:35:40 UTC (rev 7372) @@ -1,50 +1,35 @@ // "$Id: Window.h 6150 2008-08-04 22:53:30Z spitzak $" // -// Window widget. This must be the outermost group. You can also put -// them inside other widgets to use the system's window hierarchy. -// -// 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_Window_h -#define fltk_Window_h +#ifndef fltk2_Window_h +#define fltk2_Window_h #include "Group.h" +#include <fltk3/Window.h> namespace fltk { +#if 0 // value for x,y to indicate window system places window const int USEDEFAULT = ((int)0x80000000); // same as Win32 value class CreatedWindow; class Monitor; +#endif -// implementations of methods of Window are in different files in src/ - class FL_API Window : public Group { public: - Window(int,int,int,int, const char* = 0, bool begin = false); - Window(int,int, const char* = 0); - static NamedStyle* default_style; - virtual ~Window(); + + Window(int w, int h, const char *title=0) { + _p = new fltk3::Window(w, h, title); + _p->wrapper(this); + } + + virtual ~Window() { } +#if 0 + static NamedStyle* default_style; const char* label() const {return Widget::label();} const char* iconlabel() const {return iconlabel_;} void label(const char*); @@ -85,7 +70,11 @@ bool shown() const {return i != 0;} void show(); - void show(int, char**); +#endif + + void show(int argc, char **argv) { ((fltk3::Window*)_p)->show(argc, argv); } + +#if 0 void show(const Window* parent); bool exec(const Window* parent = 0, bool grab = false); void make_exec_return(bool); @@ -147,6 +136,7 @@ }; static const char* xclass_; void _Window(); // constructor innards +#endif }; } Modified: branches/branch-3.0/fltk/run.h =================================================================== --- branches/branch-3.0/fltk/run.h 2010-03-30 21:07:46 UTC (rev 7371) +++ branches/branch-3.0/fltk/run.h 2010-03-30 21:35:40 UTC (rev 7372) @@ -1,38 +1,19 @@ // "$Id: run.h 6233 2008-09-14 07:54:06Z spitzak $" // -// The basic fltk runtime. Every program needs to call this somewhere. -// 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_run_h -#define fltk_run_h +#ifndef fltk2_run_h +#define fltk2_run_h #include "FL_API.h" +#include <fltk3/run.h> + #ifdef check # undef check #endif namespace fltk { -/// \name fltk/run.h -//@{ - +#if 0 FL_API void display(const char*); FL_API int arg(int, char**, int&); FL_API int args(int, char**, int&, int (*)(int,char**,int&) = 0); @@ -44,7 +25,11 @@ FL_API int wait(float time); FL_API int check(); FL_API int ready(); -FL_API int run(); +#endif + + FL_API int run() { return fltk3::run(); } + +#if 0 FL_API void flush(); FL_API void redraw(); extern FL_API int damage_; @@ -85,9 +70,8 @@ FL_API void awake(void* message = 0); FL_API void* thread_message(); FL_API bool in_main_thread(); - -//@} - +#endif + } #endif Modified: branches/branch-3.0/fltk3/Group.h =================================================================== --- branches/branch-3.0/fltk3/Group.h 2010-03-30 21:07:46 UTC (rev 7371) +++ branches/branch-3.0/fltk3/Group.h 2010-03-30 21:35:40 UTC (rev 7372) @@ -28,8 +28,8 @@ /* \file fltk3::Group, Fl_End classes . */ -#ifndef Fl_Group_H -#define Fl_Group_H +#ifndef Fltk3_Group_H +#define Fltk3_Group_H #ifndef Fl_Widget_H #include "Widget.h" Modified: branches/branch-3.0/test/hello2.cxx =================================================================== --- branches/branch-3.0/test/hello2.cxx 2010-03-30 21:07:46 UTC (rev 7371) +++ branches/branch-3.0/test/hello2.cxx 2010-03-30 21:35:40 UTC (rev 7372) @@ -35,10 +35,10 @@ Window *window = new Window(300, 180); window->begin(); Widget *box = new Widget(20, 40, 260, 100, "Hello, World!"); - box->box(UP_BOX); - box->labelfont(HELVETICA_BOLD_ITALIC); + //box->box(UP_BOX); + //box->labelfont(HELVETICA_BOLD_ITALIC); box->labelsize(36); - box->labeltype(SHADOW_LABEL); + //box->labeltype(SHADOW_LABEL); window->end(); window->show(argc, argv); return run(); _______________________________________________ fltk-commit mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-commit
