Author: matt
Date: 2011-05-18 07:32:17 -0700 (Wed, 18 May 2011)
New Revision: 8684
Log:
123: very very simple and minimal FLTK2 emulation.
Modified:
branches/branch-3.0/fltk/Color.h
branches/branch-3.0/fltk/FL_API.h
branches/branch-3.0/fltk/Flags.h
branches/branch-3.0/fltk/Group.h
branches/branch-3.0/fltk/Rectangle.h
branches/branch-3.0/fltk/Style.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/test2/hello.cxx
Modified: branches/branch-3.0/fltk/Color.h
===================================================================
--- branches/branch-3.0/fltk/Color.h 2011-05-18 13:58:16 UTC (rev 8683)
+++ branches/branch-3.0/fltk/Color.h 2011-05-18 14:32:17 UTC (rev 8684)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
//
// "$Id: Color.h 6233 2008-09-14 07:54:06Z spitzak $"
//
@@ -36,6 +35,8 @@
namespace fltk {
+#if 0 // FIXME: 123
+
/// \name fltk/Color.h
//@{
@@ -121,6 +122,8 @@
FL_API void set_background(Color);
FL_API Color nearest_index(Color);
+#endif
+
}
//@}
Modified: branches/branch-3.0/fltk/FL_API.h
===================================================================
--- branches/branch-3.0/fltk/FL_API.h 2011-05-18 13:58:16 UTC (rev 8683)
+++ branches/branch-3.0/fltk/FL_API.h 2011-05-18 14:32:17 UTC (rev 8684)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
// "$Id: FL_API.h 8500 2011-03-03 09:20:46Z bgbnbigben $"
//
// This file is included by all FLTK header files. Originally it was to
@@ -28,50 +27,12 @@
// http://www.fltk.org/str.php
#ifndef FL_API
-#if _MSC_VER > 1000
-# pragma once
-// suppress vc2005 warnings:
-// C4312 because we have no problem to cast a smaller type to a greater
(potentially 64bit) one
-// and C4996 (deprecated C-lib calls like strcpy that should be _strcpy, etc
...)
-# pragma warning(disable:4312 4996)
-#endif
-
-#if !defined(DOXYGEN) && defined(_WIN32) && defined(FL_SHARED)
-# ifdef FL_LIBRARY
-# define FL_API __declspec(dllexport)
-# else
-# define FL_API __declspec(dllimport)
-# endif
-# ifdef FL_IMAGES_LIBRARY
-# define FL_IMAGES_API __declspec(dllexport)
-# else
-# define FL_IMAGES_API __declspec(dllimport)
-# endif
-# ifdef FL_GLUT_LIBRARY
-# define FL_GLUT_API __declspec(dllexport)
-# else
-# define FL_GLUT_API __declspec(dllimport)
-# endif
-# ifdef FL_FORMS_LIBRARY
-# define FL_FORMS_API __declspec(dllexport)
-# else
-# define FL_FORMS_API __declspec(dllimport)
-# endif
-# ifdef FL_GL_LIBRARY
-# define FL_GL_API __declspec(dllexport)
-# else
-# define FL_GL_API __declspec(dllimport)
-# endif
-#else
# define FL_API
# define FL_IMAGES_API
# define FL_GLUT_API
# define FL_FORMS_API
# define FL_GL_API
-#endif
-typedef unsigned char uchar;
-
#endif
//
Modified: branches/branch-3.0/fltk/Flags.h
===================================================================
--- branches/branch-3.0/fltk/Flags.h 2011-05-18 13:58:16 UTC (rev 8683)
+++ branches/branch-3.0/fltk/Flags.h 2011-05-18 14:32:17 UTC (rev 8684)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
//
// "$Id: Flags.h 8500 2011-03-03 09:20:46Z bgbnbigben $"
//
@@ -39,6 +38,8 @@
#define fltk_Flags_h
namespace fltk {
+
+#if 0 // FIXME: 123
/// \name fltk/Flags.h
//@{
@@ -106,6 +107,8 @@
//@}
+#endif
+
}
#endif
Modified: branches/branch-3.0/fltk/Group.h
===================================================================
--- branches/branch-3.0/fltk/Group.h 2011-05-18 13:58:16 UTC (rev 8683)
+++ branches/branch-3.0/fltk/Group.h 2011-05-18 14:32:17 UTC (rev 8684)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
//
// "$Id: Group.h 8500 2011-03-03 09:20:46Z bgbnbigben $"
//
@@ -30,24 +29,42 @@
#ifndef fltk_Group_h
#define fltk_Group_h
-#ifndef fltk_Widget_h
-# include "Widget.h"
-#endif
+#include <fltk3/Group.h>
+#include "Widget.h"
namespace fltk {
class FL_API Group : public Widget {
+protected:
+ Group() { }
public:
+ Group(int x, int y, int w, int h, const char *label = 0, bool begin=false) {
+ fltk3::Group *g = fltk3::Group::current();
+ _p = new fltk3::Group(x, y, w, h, label);
+ _p->wrapper(this);
+ if (!begin)
+ fltk3::Group::current(g);
+ }
+
+#if 0 // FIXME: 123
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 // FIXME: 123
static Group *current() {return current_;}
static void current(Group *g) {current_ = g;}
@@ -106,7 +123,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 2011-05-18 13:58:16 UTC (rev
8683)
+++ branches/branch-3.0/fltk/Rectangle.h 2011-05-18 14:32:17 UTC (rev
8684)
@@ -1,4 +1,4 @@
-#error header has not been ported to 3.0 yet
+//
// "$Id: Rectangle.h 8500 2011-03-03 09:20:46Z bgbnbigben $"
//
// Copyright 1998-2006 by Bill Spitzak and others.
@@ -37,6 +37,8 @@
//#define FLTK_CENTER_Y(coord, length) (coord + (length>>1))
namespace fltk {
+
+#if 0 // FIXME: 123
class FL_API Rectangle {
int x_, y_, w_, h_;
@@ -120,6 +122,8 @@
};
+#endif
+
}
#endif
Modified: branches/branch-3.0/fltk/Style.h
===================================================================
--- branches/branch-3.0/fltk/Style.h 2011-05-18 13:58:16 UTC (rev 8683)
+++ branches/branch-3.0/fltk/Style.h 2011-05-18 14:32:17 UTC (rev 8684)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
//
// "$Id: Style.h 8636 2011-05-06 08:01:12Z bgbnbigben $"
//
@@ -29,19 +28,25 @@
#ifndef fltk_Style_h
#define fltk_Style_h
+#include <fltk3/enumerations.h>
#include "Color.h"
namespace fltk {
+
+#if 0 // FIXME: 123
/// \name fltk/Style.h
//@{
class FL_API Widget;
class FL_API Rectangle;
+#endif
+
class FL_API Symbol;
typedef Symbol Box;
-
-extern FL_API Box* const UP_BOX;
+
+static FL_API Box* const UP_BOX = 0L;
+#if 0 // FIXME: 123
extern FL_API Box* const DOWN_BOX;
extern FL_API Box* const DEFAULT_FOCUS_BOX;
extern FL_API Box* const THIN_UP_BOX;
@@ -67,7 +72,9 @@
extern FL_API Box* const BORDER_FRAME;
extern FL_API Box* const PLASTIC_UP_BOX;
extern FL_API Box* const PLASTIC_DOWN_BOX;
-
+#endif
+
+#if 0 // FIXME: 123
struct Font;
extern FL_API Font* const HELVETICA;
extern FL_API Font* const HELVETICA_BOLD;
@@ -204,10 +211,17 @@
FL_API void reload_theme();
FL_API bool reset_theme();
+#endif
+
}
extern "C" FL_API bool fltk_theme();
+namespace fltk3 {
+ inline Boxtype _2to3_boxtype(fltk::Box *b) { return UP_BOX; }
+}
+
+
//@}
#endif
Modified: branches/branch-3.0/fltk/Widget.h
===================================================================
--- branches/branch-3.0/fltk/Widget.h 2011-05-18 13:58:16 UTC (rev 8683)
+++ branches/branch-3.0/fltk/Widget.h 2011-05-18 14:32:17 UTC (rev 8684)
@@ -1,4 +1,4 @@
-#error header has not been ported to 3.0 yet
+//
// "$Id: Widget.h 8636 2011-05-06 08:01:12Z bgbnbigben $"
//
// Copyright 1998-2006 by Bill Spitzak and others.
@@ -25,6 +25,9 @@
#ifndef fltk_Widget_h
#define fltk_Widget_h
+#include <fltk3/Wrapper.h>
+#include <fltk3/Widget.h>
+
#include "Style.h"
#include "Rectangle.h"
@@ -47,14 +50,25 @@
FL_API Font* font(int);
#endif
-class FL_API Widget : public Rectangle {
+ class FL_API Widget : public fltk3::WidgetWrapper {
+ // FIXME: 123 - this was derived from "public Rectangle"
+
+#if 0 // FIXME: 123
// disable the copy assignment/constructors:
Widget & operator=(const Widget &);
Widget(const Widget &);
-
+#endif
+
+protected:
+ Widget() {}
+
public:
-
- Widget(int,int,int,int,const char* =0);
+ Widget(int x, int y, int w, int h, const char *label=0) {
+ _p = new fltk3::Widget(x, y, w, h, label);
+ _p->wrapper(this);
+ }
+
+#if 0 // FIXME: 123
virtual ~Widget();
virtual void draw();
@@ -238,8 +252,13 @@
float leading() const;
unsigned char scrollbar_align() const;
unsigned char scrollbar_width() const;
-
- void box(Box*) ;
+#endif
+
+ void box(Box *b) {
+ ((fltk3::Widget*)_p)->box(fltk3::_2to3_boxtype(b));
+ }
+
+#if 0 // FIXME: 123
void buttonbox(Box*) ;
void focusbox(Box*) ;
void glyph(Symbol*) ;
@@ -313,7 +332,7 @@
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 2011-05-18 13:58:16 UTC (rev 8683)
+++ branches/branch-3.0/fltk/Window.h 2011-05-18 14:32:17 UTC (rev 8684)
@@ -1,4 +1,4 @@
-#error header has not been ported to 3.0 yet
+//
// "$Id: Window.h 8500 2011-03-03 09:20:46Z bgbnbigben $"
//
// Window widget. This must be the outermost group. You can also put
@@ -28,23 +28,37 @@
#ifndef fltk_Window_h
#define fltk_Window_h
+#include <fltk3/Window.h>
#include "Group.h"
namespace fltk {
-// value for x,y to indicate window system places window
-const int USEDEFAULT = ((int)0x80000000); // same as Win32 value
+#if 0 // FIXME: 123
+
+const int USEDEFAULT = ((int)0x80000000);
class CreatedWindow;
class Monitor;
-// implementations of methods of Window are in different files in src/
+#endif
-class FL_API Window : public Group {
+class Window : public Group {
public:
- Window(int,int,int,int, const char* = 0, bool begin = false);
- Window(int,int, const char* = 0);
+ Window(int x, int y, int w, int h, const char *label = 0, bool begin =
false) {
+ fltk3::Group *g = fltk3::Group::current();
+ _p = new fltk3::Window(x, y, w, h, label);
+ _p->wrapper(this);
+ if (!begin)
+ fltk3::Group::current(g);
+ }
+
+ Window(int w, int h, const char *label = 0) {
+ _p = new fltk3::Window(w, h, label);
+ _p->wrapper(this);
+ }
+
+#if 0 // FIXME: 123
static NamedStyle* default_style;
virtual ~Window();
@@ -88,7 +102,13 @@
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 // FIXME: 123
void show(const Window* parent);
bool exec(const Window* parent = 0, bool grab = false);
void make_exec_return(bool);
@@ -150,6 +170,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 2011-05-18 13:58:16 UTC (rev 8683)
+++ branches/branch-3.0/fltk/run.h 2011-05-18 14:32:17 UTC (rev 8684)
@@ -1,4 +1,4 @@
-#error header has not been ported to 3.0 yet
+//
// "$Id: run.h 8500 2011-03-03 09:20:46Z bgbnbigben $"
//
// The basic fltk runtime. Every program needs to call this somewhere.
@@ -26,6 +26,8 @@
#ifndef fltk_run_h
#define fltk_run_h
+#include <fltk3/run.h>
+
#include "FL_API.h"
#include <stdio.h>
#ifdef check
@@ -34,6 +36,8 @@
namespace fltk {
+#if 0 // FIXME: 123
+
/// \name fltk/run.h
//@{
@@ -48,8 +52,14 @@
FL_API int wait(float time);
FL_API int check();
FL_API int ready();
-FL_API int run();
-FL_API void flush();
+#endif
+
+ int run() {
+ return fltk3::run();
+ }
+
+#if 0 // FIXME: 123
+ FL_API void flush();
FL_API void redraw();
extern FL_API int damage_;
inline void damage(int d) {damage_ = d;}
@@ -93,6 +103,8 @@
//@}
+#endif
+
}
#endif
Modified: branches/branch-3.0/test2/hello.cxx
===================================================================
--- branches/branch-3.0/test2/hello.cxx 2011-05-18 13:58:16 UTC (rev 8683)
+++ branches/branch-3.0/test2/hello.cxx 2011-05-18 14:32:17 UTC (rev 8684)
@@ -10,9 +10,9 @@
window->begin();
Widget *box = new Widget(20, 40, 260, 100, "Hello, World!");
box->box(UP_BOX);
- box->labelfont(HELVETICA_BOLD_ITALIC);
- box->labelsize(36);
- box->labeltype(SHADOW_LABEL);
+ //box->labelfont(HELVETICA_BOLD_ITALIC);
+ //box->labelsize(36);
+ //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