Author: matt
Date: 2011-01-10 11:41:50 -0800 (Mon, 10 Jan 2011)
New Revision: 8244
Log:
Emulating Boxtypes etc. for FLTK2. I am SOOO tempted to port the FLTK2
approach, but I must hold back and NOT change any implementations until the
Wrappers are completely done. Sigh. OTOH: if we manage to merge F1 and F2
features, FLTK will be really cool!
Modified:
branches/branch-3.0-2011/FL/Fl_Widget.H
branches/branch-3.0-2011/fltk/Box.h
branches/branch-3.0-2011/fltk/Font.h
branches/branch-3.0-2011/fltk/LabelType.h
branches/branch-3.0-2011/fltk/Style.h
branches/branch-3.0-2011/fltk/Symbol.h
branches/branch-3.0-2011/fltk/Widget.h
branches/branch-3.0-2011/fltk3/Fl_File_Icon.H
branches/branch-3.0-2011/fltk3/Image.h
branches/branch-3.0-2011/fltk3/Widget.h
branches/branch-3.0-2011/fltk3/run.h
branches/branch-3.0-2011/src/Fl_Choice.cxx
branches/branch-3.0-2011/src/Fl_File_Icon.cxx
branches/branch-3.0-2011/src/Fl_Image.cxx
branches/branch-3.0-2011/src/Fl_Menu.cxx
branches/branch-3.0-2011/src/Fl_Multi_Label.cxx
branches/branch-3.0-2011/src/Fl_Widget.cxx
branches/branch-3.0-2011/src/fl_engraved_label.cxx
branches/branch-3.0-2011/src/fl_labeltype.cxx
branches/branch-3.0-2011/test2/hello.cxx
Modified: branches/branch-3.0-2011/FL/Fl_Widget.H
===================================================================
--- branches/branch-3.0-2011/FL/Fl_Widget.H 2011-01-10 16:56:37 UTC (rev
8243)
+++ branches/branch-3.0-2011/FL/Fl_Widget.H 2011-01-10 19:41:50 UTC (rev
8244)
@@ -58,42 +58,22 @@
typedef void (Fl_Callback0)(Fl_Widget*);
typedef void (Fl_Callback1)(Fl_Widget*, long);
-#if 0 // TODO: FLTK123
-
-/** This struct stores all information for a text or mixed graphics label.
-
- \todo For FLTK 1.3, the Fl_Label type will become a widget by itself. That
way
- we will be avoiding a lot of code duplication by handling labels in
- a similar fashion to widgets containing text. We also provide an easy
- interface for very complex labels, containing html or vector
graphics.
- */
+// FIXME: FLTK123 - this does not port very well. FLTK2 may have a better
solution.
struct FL_EXPORT Fl_Label {
- /** label text */
const char* value;
- /** optional image for an active label */
Fl_Image* image;
- /** optional image for a deactivated label */
Fl_Image* deimage;
- /** label font used in text */
Fl_Font font;
- /** size of label font */
Fl_Fontsize size;
- /** text color */
Fl_Color color;
- /** alignment of label */
Fl_Align align_;
- /** type of label. \see Fl_Labeltype */
uchar type;
-
- /** Draws the label aligned to the given box */
void draw(int,int,int,int, Fl_Align) const ;
void measure(int &w, int &h) const ;
};
-#endif // TODO: FLTK123
-
class FL_EXPORT Fl_Widget : public fltk3::WidgetWrapper {
friend class Fl_Group;
@@ -178,18 +158,20 @@
_p->wrapper(this);
}
-#if 0 // TODO: FLTK123
- virtual ~Fl_Widget() {}
-#endif // TODO: FLTK123
-
// Wrapper: virtual void draw()
// Wrapper: virtual int handle(int event)
// Wrapper: virtual void resize(int x, int y, int w, int h)
// Wrapper: virtual void show()
// Wrapper: virtual void hide()
- virtual Fl_Group* as_group() { return 0L; }
- virtual Fl_Window* as_window() { return 0L; }
- virtual class Fl_Gl_Window* as_gl_window() { return 0L; }
+ virtual Fl_Group* as_group() {
+ return 0L;
+ }
+ virtual Fl_Window* as_window() {
+ return 0L;
+ }
+ virtual class Fl_Gl_Window* as_gl_window() {
+ return 0L;
+ }
Fl_Group* parent() const {
return (Fl_Group*)( ((fltk3::Widget*)_p)->parent()->wrapper() );
Modified: branches/branch-3.0-2011/fltk/Box.h
===================================================================
--- branches/branch-3.0-2011/fltk/Box.h 2011-01-10 16:56:37 UTC (rev 8243)
+++ branches/branch-3.0-2011/fltk/Box.h 2011-01-10 19:41:50 UTC (rev 8244)
@@ -1,5 +1,3 @@
-#warn FLTK123: This file has not been ported yet
-#if 0
//
// "$Id: Box.h 5865 2007-06-01 13:04:19Z sanel.z $"
//
@@ -25,16 +23,23 @@
// Please report all bugs and problems to "[email protected]".
//
-#ifndef fltk_Box_h
-#define fltk_Box_h
+#ifndef fltk2_Box_h
+#define fltk2_Box_h
+#include "Symbol.h"
+
+#if 0 // TODO: FLTK123
+
#include "Color.h"
#include "Flags.h"
-#include "Symbol.h"
+#endif // TODO: FLTK123
+
namespace fltk {
+
+ typedef Symbol Box;
-typedef Symbol Box;
+#if 0 // TODO: FLTK123
class FL_API FrameBox : public Box {
protected:
@@ -68,6 +73,9 @@
HighlightBox(const char* n, const Box* d);
};
+#endif // TODO: FLTK123
+
+
}
#endif
@@ -75,4 +83,3 @@
//
// End of "$Id: Box.h 5865 2007-06-01 13:04:19Z sanel.z $".
//
-#endif
Modified: branches/branch-3.0-2011/fltk/Font.h
===================================================================
--- branches/branch-3.0-2011/fltk/Font.h 2011-01-10 16:56:37 UTC (rev
8243)
+++ branches/branch-3.0-2011/fltk/Font.h 2011-01-10 19:41:50 UTC (rev
8244)
@@ -1,5 +1,3 @@
-#warn FLTK123: This file has not been ported yet
-#if 0
//
// "$Id: Font.h 5461 2006-09-19 02:49:30Z spitzak $"
//
@@ -22,9 +20,10 @@
//
// Please report all bugs and problems to "[email protected]".
-#ifndef fltk_Font_h
-#define fltk_Font_h
+#ifndef fltk2_Font_h
+#define fltk2_Font_h
+#include <fltk3/Enumerations.H>
#include "Style.h"
namespace fltk {
@@ -36,6 +35,8 @@
};
struct FL_API Font {
+ fltk3::Font fltk3_id;
+#if 0 // TODO: FLTK123
const char* name_;
int attributes_;
// other fields are added here!
@@ -55,9 +56,13 @@
const char* system_name();
static const char* current_name();
-
+#endif // TODO: FLTK123
};
+ extern Font fltk2_font_list[16];
+
+#if 0 // TODO: FLTK123
+
// Find a Font from a name and attributes:
FL_API Font* font(const char* name, int attrib = 0);
@@ -67,7 +72,8 @@
// Find and return every font on the system.
FL_API int list_fonts(Font**& arrayp);
+#endif // TODO: FLTK123
+
}
#endif
-#endif
Modified: branches/branch-3.0-2011/fltk/LabelType.h
===================================================================
--- branches/branch-3.0-2011/fltk/LabelType.h 2011-01-10 16:56:37 UTC (rev
8243)
+++ branches/branch-3.0-2011/fltk/LabelType.h 2011-01-10 19:41:50 UTC (rev
8244)
@@ -1,5 +1,3 @@
-#warn FLTK123: This file has not been ported yet
-#if 0
//
// "$Id: LabelType.h 5770 2007-04-10 10:42:07Z spitzak $"
//
@@ -28,8 +26,8 @@
// Please report all bugs and problems to "[email protected]".
//
-#ifndef fltk_LabelType_h
-#define fltk_LabelType_h
+#ifndef fltk2_LabelType_h
+#define fltk2_LabelType_h
#include "Flags.h"
#include "Rectangle.h"
@@ -40,6 +38,8 @@
class FL_API LabelType {
public:
+ fltk3::Labeltype fltk3_id;
+#if 0 // TODO: FLTK123
virtual void draw(const char*, const Rectangle&, Flags) const;
const char* name;
LabelType* next;
@@ -47,8 +47,12 @@
LabelType(const char* n) : name(n), next(first) {first = this;}
static LabelType* find(const char* name);
virtual ~LabelType(); // virtual to shut up C++ warnings
+#endif // TODO: FLTK123
};
+ extern LabelType fltk2_labeltype_list[8];
+
+#if 0 // TODO: FLTK123
// You can use this to draw overlapping patterns
class FL_API EngravedLabel : public LabelType {
const int* data;
@@ -57,8 +61,8 @@
EngravedLabel(const char * n, const int p[][3])
: LabelType(n), data((const int*)p) {}
};
+#endif // TODO: FLTK123
}
#endif
-#endif
Modified: branches/branch-3.0-2011/fltk/Style.h
===================================================================
--- branches/branch-3.0-2011/fltk/Style.h 2011-01-10 16:56:37 UTC (rev
8243)
+++ branches/branch-3.0-2011/fltk/Style.h 2011-01-10 19:41:50 UTC (rev
8244)
@@ -28,15 +28,14 @@
#include "Color.h"
-#if 0 // TODO: FLTK123
-
namespace fltk {
-/// \name fltk/Style.h
-//@{
-
+#if 0 // TODO: FLTK123
+
class FL_API Widget;
class FL_API Rectangle;
+#endif // TODO: FLTK123
+
class FL_API Symbol;
typedef Symbol Box;
@@ -66,6 +65,7 @@
extern FL_API Box* const PLASTIC_UP_BOX;
extern FL_API Box* const PLASTIC_DOWN_BOX;
+
struct Font;
extern FL_API Font* const HELVETICA;
extern FL_API Font* const HELVETICA_BOLD;
@@ -84,6 +84,7 @@
extern FL_API Font* const SCREEN_BOLD_FONT;
extern FL_API Font* const ZAPF_DINGBATS;
+
class LabelType;
extern FL_API LabelType* const NO_LABEL;
extern FL_API LabelType* const NORMAL_LABEL;
@@ -92,6 +93,9 @@
extern FL_API LabelType* const ENGRAVED_LABEL;
extern FL_API LabelType* const EMBOSSED_LABEL;
+#if 0 // TODO: FLTK123
+
+
class Style;
class FL_API Style {
@@ -196,8 +200,12 @@
FL_API void reload_theme();
FL_API bool reset_theme();
+#endif // TODO: FLTK123
+
}
+#if 0 // TODO: FLTK123
+
extern "C" FL_API bool fltk_theme();
//@}
Modified: branches/branch-3.0-2011/fltk/Symbol.h
===================================================================
--- branches/branch-3.0-2011/fltk/Symbol.h 2011-01-10 16:56:37 UTC (rev
8243)
+++ branches/branch-3.0-2011/fltk/Symbol.h 2011-01-10 19:41:50 UTC (rev
8244)
@@ -1,5 +1,3 @@
-#warn FLTK123: This file has not been ported yet
-#if 0
// "$Id: Symbol.h 5865 2007-06-01 13:04:19Z sanel.z $"
//
// Copyright 1998-2006 by Bill Spitzak and others.
@@ -22,19 +20,29 @@
// Please report all bugs and problems to "[email protected]".
//
-#ifndef fltk_Symbol_h
-#define fltk_Symbol_h
+#ifndef fltk2_Symbol_h
+#define fltk2_Symbol_h
+#include <fltk3/Enumerations.H>
#include "FL_API.h"
+
+#if 0 // TODO: FLTK123
+
#include "Color.h"
#include "Rectangle.h"
#include "PixelType.h"
+#endif // TODO: FLTK123
+
namespace fltk {
class Style;
-
+
class FL_API Symbol {
+public:
+ fltk3::Boxtype fltk3_id;
+
+#if 0 // TODO: FLTK123
const char* name_;
Rectangle inset_;
@@ -83,12 +91,15 @@
static unsigned text_length() {return text_length_;}
virtual ~Symbol();
+#endif // TODO: FLTK123
};
+ extern Symbol fltk2_box_list[18];
+
+#if 0 // TODO: FLTK123
// Back-compatability constructor:
FL_API void add_symbol(const char* name, void (*drawit)(Color), int scalable);
-
+#endif // TODO: FLTK123
}
#endif
-#endif
Modified: branches/branch-3.0-2011/fltk/Widget.h
===================================================================
--- branches/branch-3.0-2011/fltk/Widget.h 2011-01-10 16:56:37 UTC (rev
8243)
+++ branches/branch-3.0-2011/fltk/Widget.h 2011-01-10 19:41:50 UTC (rev
8244)
@@ -26,6 +26,9 @@
#include <fltk3/Widget.h>
#include "Style.h"
#include "Rectangle.h"
+#include "Font.h"
+#include "Box.h"
+#include "LabelType.h"
namespace fltk {
@@ -50,7 +53,7 @@
#endif // TODO: FLTK123
- class FL_API Widget : public fltk3::Wrapper {
+ class FL_API Widget : public fltk3::WidgetWrapper {
#if 0 // TODO: FLTK123
// disable the copy assignment/constructors:
@@ -233,10 +236,19 @@
// TODO: FLTK123 - please port FLTK2 box styles to FLTK3!
Box* box() { return (fltk::Box)((fltk3::Widget*)_p)->box(); }
void box(Box *b) { ((fltk3::Widget*)_p)->box((fltk3::Boxtype)b); }
+#endif
+
+ void box(Box *f) {
+ ((fltk3::Widget*)_p)->box(f->fltk3_id);
+ }
+ Box *box() const {
+ return fltk2_box_list + ((fltk3::Widget*)_p)->box();
+ }
+
+#if 0
Box* buttonbox() const;
Symbol* glyph() const;
- Font* labelfont() const;
Font* textfont() const;
LabelType* labeltype() const;
Color color() const;
@@ -255,9 +267,20 @@
void buttonbox(Box*) ;
void glyph(Symbol*) ;
- void labelfont(Font*) ;
+#endif // TODO: FLTK123
+
+ void labelfont(Font *f) {
+ ((fltk3::Widget*)_p)->labelfont(f->fltk3_id);
+ }
+ Font *labelfont() const {
+ return fltk2_font_list + ((fltk3::Widget*)_p)->labelfont();
+ }
+ void labeltype(LabelType *l) {
+ ((fltk3::Widget*)_p)->labeltype(l->fltk3_id);
+ }
+
+#if 0 // TODO: FLTK123
void textfont(Font*) ;
- void labeltype(LabelType*) ;
void color(Color) ;
void textcolor(Color a) ;
void selection_color(Color) ;
@@ -266,7 +289,13 @@
void labelcolor(Color) ;
void highlight_color(Color) ;
void highlight_textcolor(Color);
- void labelsize(float a) ;
+#endif // TODO: FLTK123
+
+ void labelsize(float a) {
+ ((fltk3::Widget*)_p)->labelsize((fltk3::Fontsize)a);
+ }
+
+#if 0 // TODO: FLTK123
void textsize(float a) ;
void leading(float a) ;
void scrollbar_align(unsigned char);
Modified: branches/branch-3.0-2011/fltk3/Fl_File_Icon.H
===================================================================
--- branches/branch-3.0-2011/fltk3/Fl_File_Icon.H 2011-01-10 16:56:37 UTC
(rev 8243)
+++ branches/branch-3.0-2011/fltk3/Fl_File_Icon.H 2011-01-10 19:41:50 UTC
(rev 8244)
@@ -124,7 +124,7 @@
void label(fltk3::Widget *w);
- static void labeltype(const Fl_Label *o, int x, int y, int w, int h,
fltk3::Align a);
+ static void labeltype(const fltk3::Label *o, int x, int y, int w, int h,
fltk3::Align a);
void load(const char *f);
int load_fti(const char *fti);
int load_image(const char *i);
Modified: branches/branch-3.0-2011/fltk3/Image.h
===================================================================
--- branches/branch-3.0-2011/fltk3/Image.h 2011-01-10 16:56:37 UTC (rev
8243)
+++ branches/branch-3.0-2011/fltk3/Image.h 2011-01-10 19:41:50 UTC (rev
8244)
@@ -34,9 +34,9 @@
# include "Enumerations.H"
struct Fl_Menu_Item;
-struct Fl_Label;
namespace fltk3 {
+ struct Label;
class Widget;
class Image;
}
@@ -93,8 +93,8 @@
void data(const char * const *p, int c) {data_ = p; count_ = c;}
void draw_empty(int X, int Y);
- static void labeltype(const Fl_Label *lo, int lx, int ly, int lw, int lh,
fltk3::Align la);
- static void measure(const Fl_Label *lo, int &lw, int &lh);
+ static void labeltype(const fltk3::Label *lo, int lx, int ly, int lw, int
lh, fltk3::Align la);
+ static void measure(const fltk3::Label *lo, int &lw, int &lh);
public:
Modified: branches/branch-3.0-2011/fltk3/Widget.h
===================================================================
--- branches/branch-3.0-2011/fltk3/Widget.h 2011-01-10 16:56:37 UTC (rev
8243)
+++ branches/branch-3.0-2011/fltk3/Widget.h 2011-01-10 19:41:50 UTC (rev
8244)
@@ -26,7 +26,7 @@
//
/** \file
- fltk3::Widget, Fl_Label classes . */
+ fltk3::Widget, fltk3::Label classes . */
#ifndef FLTK3_Widget_H
#define FLTK3_Widget_H
@@ -58,6 +58,7 @@
class Group;
class Widget;
class Image;
+ struct Label;
/** Default callback type definition for all fltk widgets (by far the most
used) */
typedef void (Callback)(Widget*, void*);
@@ -75,12 +76,12 @@
/** This struct stores all information for a text or mixed graphics label.
- \todo For FLTK 1.3, the Fl_Label type will become a widget by itself. That
way
+ \todo For FLTK 1.3, the fltk3::Label type will become a widget by itself.
That way
we will be avoiding a lot of code duplication by handling labels in
a similar fashion to widgets containing text. We also provide an easy
interface for very complex labels, containing html or vector
graphics.
*/
-struct FL_EXPORT Fl_Label {
+struct FL_EXPORT fltk3::Label {
/** label text */
const char* value;
/** optional image for an active label */
@@ -124,7 +125,7 @@
fltk3::Callback* callback_;
void* user_data_;
int x_,y_,w_,h_;
- Fl_Label label_;
+ fltk3::Label label_;
unsigned int flags_;
fltk3::Color color_;
fltk3::Color color2_;
Modified: branches/branch-3.0-2011/fltk3/run.h
===================================================================
--- branches/branch-3.0-2011/fltk3/run.h 2011-01-10 16:56:37 UTC (rev
8243)
+++ branches/branch-3.0-2011/fltk3/run.h 2011-01-10 19:41:50 UTC (rev
8244)
@@ -47,9 +47,8 @@
# endif
-struct Fl_Label;
-
namespace fltk3 {
+ struct Label;
class Window;
class Widget;
class Image;
@@ -72,10 +71,10 @@
@{ */
/** signature of some label drawing functions passed as parameters */
-typedef void (Fl_Label_Draw_F)(const Fl_Label *label, int x, int y, int w, int
h, fltk3::Align align);
+typedef void (Fl_Label_Draw_F)(const fltk3::Label *label, int x, int y, int w,
int h, fltk3::Align align);
/** signature of some label measurement functions passed as parameters */
-typedef void (Fl_Label_Measure_F)(const Fl_Label *label, int &width, int
&height);
+typedef void (Fl_Label_Measure_F)(const fltk3::Label *label, int &width, int
&height);
/** signature of some box drawing functions passed as parameters */
typedef void (Fl_Box_Draw_F)(int x, int y, int w, int h, fltk3::Color color);
Modified: branches/branch-3.0-2011/src/Fl_Choice.cxx
===================================================================
--- branches/branch-3.0-2011/src/Fl_Choice.cxx 2011-01-10 16:56:37 UTC (rev
8243)
+++ branches/branch-3.0-2011/src/Fl_Choice.cxx 2011-01-10 19:41:50 UTC (rev
8244)
@@ -90,7 +90,7 @@
fl_push_clip(xx, yy, ww, hh);
if ( fltk3::scheme()) {
- Fl_Label l;
+ fltk3::Label l;
l.value = m.text;
l.image = 0;
l.deimage = 0;
Modified: branches/branch-3.0-2011/src/Fl_File_Icon.cxx
===================================================================
--- branches/branch-3.0-2011/src/Fl_File_Icon.cxx 2011-01-10 16:56:37 UTC
(rev 8243)
+++ branches/branch-3.0-2011/src/Fl_File_Icon.cxx 2011-01-10 19:41:50 UTC
(rev 8244)
@@ -470,7 +470,7 @@
\param[in] a label alignment [not used]
*/
void
-Fl_File_Icon::labeltype(const Fl_Label *o, // I - Label data
+Fl_File_Icon::labeltype(const fltk3::Label *o, // I - Label data
int x, // I - X position of label
int y, // I - Y position of label
int w, // I - Width of label
Modified: branches/branch-3.0-2011/src/Fl_Image.cxx
===================================================================
--- branches/branch-3.0-2011/src/Fl_Image.cxx 2011-01-10 16:56:37 UTC (rev
8243)
+++ branches/branch-3.0-2011/src/Fl_Image.cxx 2011-01-10 19:41:50 UTC (rev
8244)
@@ -132,7 +132,7 @@
}
void
-fltk3::Image::labeltype(const Fl_Label *lo, // I - Label
+fltk3::Image::labeltype(const fltk3::Label *lo, // I - Label
int lx, // I - X position
int ly, // I - Y position
int lw, // I - Width of label
@@ -157,7 +157,7 @@
}
void
-fltk3::Image::measure(const Fl_Label *lo, // I - Label
+fltk3::Image::measure(const fltk3::Label *lo, // I - Label
int &lw, // O - Width of image
int &lh) { // O - Height of image
fltk3::Image *img; // Image pointer
Modified: branches/branch-3.0-2011/src/Fl_Menu.cxx
===================================================================
--- branches/branch-3.0-2011/src/Fl_Menu.cxx 2011-01-10 16:56:37 UTC (rev
8243)
+++ branches/branch-3.0-2011/src/Fl_Menu.cxx 2011-01-10 19:41:50 UTC (rev
8244)
@@ -126,7 +126,7 @@
Optionally, can get height if hp is not NULL.
*/
int Fl_Menu_Item::measure(int* hp, const Fl_Menu_* m) const {
- Fl_Label l;
+ fltk3::Label l;
l.value = text;
l.image = 0;
l.deimage = 0;
@@ -145,7 +145,7 @@
/** Draws the menu item in bounding box x,y,w,h, optionally selects the item.
*/
void Fl_Menu_Item::draw(int x, int y, int w, int h, const Fl_Menu_* m,
int selected) const {
- Fl_Label l;
+ fltk3::Label l;
l.value = text;
l.image = 0;
l.deimage = 0;
Modified: branches/branch-3.0-2011/src/Fl_Multi_Label.cxx
===================================================================
--- branches/branch-3.0-2011/src/Fl_Multi_Label.cxx 2011-01-10 16:56:37 UTC
(rev 8243)
+++ branches/branch-3.0-2011/src/Fl_Multi_Label.cxx 2011-01-10 19:41:50 UTC
(rev 8244)
@@ -34,10 +34,10 @@
#include <fltk3/Fl_Multi_Label.H>
static void multi_labeltype(
- const Fl_Label* o, int x, int y, int w, int h, fltk3::Align a)
+ const fltk3::Label* o, int x, int y, int w, int h, fltk3::Align a)
{
Fl_Multi_Label* b = (Fl_Multi_Label*)(o->value);
- Fl_Label local = *o;
+ fltk3::Label local = *o;
local.value = b->labela;
local.type = b->typea;
int W = w; int H = h; local.measure(W, H);
@@ -53,9 +53,9 @@
}
// measurement is only correct for left-to-right appending...
-static void multi_measure(const Fl_Label* o, int& w, int& h) {
+static void multi_measure(const fltk3::Label* o, int& w, int& h) {
Fl_Multi_Label* b = (Fl_Multi_Label*)(o->value);
- Fl_Label local = *o;
+ fltk3::Label local = *o;
local.value = b->labela;
local.type = b->typea;
local.measure(w,h);
Modified: branches/branch-3.0-2011/src/Fl_Widget.cxx
===================================================================
--- branches/branch-3.0-2011/src/Fl_Widget.cxx 2011-01-10 16:56:37 UTC (rev
8243)
+++ branches/branch-3.0-2011/src/Fl_Widget.cxx 2011-01-10 19:41:50 UTC (rev
8244)
@@ -346,7 +346,12 @@
void
fltk3::Widget::do_callback(fltk3::Widget* o,void* arg) {
Fl_Widget_Tracker wp(this);
- callback_(o,arg);
+ // FIXME: the other callbacks must know about wrappers as well.
+ if (o && o->pWrapper) {
+ callback_((fltk3::Widget*)o->pWrapper,arg);
+ } else {
+ callback_(o,arg);
+ }
if (wp.deleted()) return;
if (callback_ != default_callback)
clear_changed();
@@ -359,6 +364,7 @@
}
+// ========================= Wrapper Support
===================================
fltk3::Object::~Object() {
if ( pWrapper && !(pWrapper->pVCalls&Wrapper::pVCallDtor) ) {
@@ -374,8 +380,113 @@
}
}
+// =================== FLTK1 Compatibility Support
=============================
+// =================== FLTK2 Compatibility Support
=============================
+
+#include <fltk/Font.h>
+
+fltk::Font fltk::fltk2_font_list[] = {
+ { fltk3::HELVETICA },
+ { fltk3::HELVETICA_BOLD },
+ { fltk3::HELVETICA_ITALIC },
+ { fltk3::HELVETICA_BOLD_ITALIC },
+ { fltk3::COURIER },
+ { fltk3::COURIER_BOLD },
+ { fltk3::COURIER_ITALIC },
+ { fltk3::COURIER_BOLD_ITALIC },
+ { fltk3::TIMES },
+ { fltk3::TIMES_BOLD },
+ { fltk3::TIMES_ITALIC },
+ { fltk3::TIMES_BOLD_ITALIC },
+ { fltk3::SYMBOL },
+ { fltk3::SCREEN },
+ { fltk3::SCREEN_BOLD },
+ { fltk3::ZAPF_DINGBATS }
+};
+
+fltk::Font *const fltk::HELVETICA = fltk2_font_list+0;
+fltk::Font *const fltk::HELVETICA_BOLD = fltk2_font_list+1;
+fltk::Font *const fltk::HELVETICA_ITALIC = fltk2_font_list+2;
+fltk::Font *const fltk::HELVETICA_BOLD_ITALIC = fltk2_font_list+3;
+fltk::Font *const fltk::COURIER = fltk2_font_list+4;
+fltk::Font *const fltk::COURIER_BOLD = fltk2_font_list+5;
+fltk::Font *const fltk::COURIER_ITALIC = fltk2_font_list+6;
+fltk::Font *const fltk::COURIER_BOLD_ITALIC = fltk2_font_list+7;
+fltk::Font *const fltk::TIMES = fltk2_font_list+8;
+fltk::Font *const fltk::TIMES_BOLD = fltk2_font_list+9;
+fltk::Font *const fltk::TIMES_ITALIC = fltk2_font_list+10;
+fltk::Font *const fltk::TIMES_BOLD_ITALIC = fltk2_font_list+11;
+fltk::Font *const fltk::SYMBOL = fltk2_font_list+12;
+fltk::Font *const fltk::SCREEN = fltk2_font_list+13;
+fltk::Font *const fltk::SCREEN_BOLD = fltk2_font_list+14;
+fltk::Font *const fltk::ZAPF_DINGBATS = fltk2_font_list+15;
+
+#include <fltk/Box.h>
+#include <fltk/Symbol.h>
+
+fltk::Symbol fltk::fltk2_box_list[] = {
+ { fltk3::NO_BOX },
+ { fltk3::FLAT_BOX },
+ { fltk3::UP_BOX },
+ { fltk3::DOWN_BOX },
+ { fltk3::UP_FRAME },
+ { fltk3::DOWN_FRAME },
+ { fltk3::THIN_UP_BOX },
+ { fltk3::THIN_DOWN_BOX },
+ { fltk3::THIN_UP_FRAME },
+ { fltk3::THIN_DOWN_FRAME },
+ { fltk3::ENGRAVED_BOX },
+ { fltk3::EMBOSSED_BOX },
+ { fltk3::ENGRAVED_FRAME },
+ { fltk3::EMBOSSED_FRAME },
+ { fltk3::BORDER_BOX },
+ { fltk3::SHADOW_BOX },
+ { fltk3::BORDER_FRAME },
+ { fltk3::SHADOW_FRAME }
+};
+
+fltk::Box *const fltk::NO_BOX = fltk2_box_list+0;
+fltk::Box *const fltk::FLAT_BOX = fltk2_box_list+1;
+fltk::Box *const fltk::UP_BOX = fltk2_box_list+2;
+fltk::Box *const fltk::DOWN_BOX = fltk2_box_list+3;
+fltk::Box *const fltk::UP_FRAME = fltk2_box_list+4;
+fltk::Box *const fltk::DOWN_FRAME = fltk2_box_list+5;
+fltk::Box *const fltk::THIN_UP_BOX = fltk2_box_list+6;
+fltk::Box *const fltk::THIN_DOWN_BOX = fltk2_box_list+7;
+fltk::Box *const fltk::THIN_UP_FRAME = fltk2_box_list+8;
+fltk::Box *const fltk::THIN_DOWN_FRAME = fltk2_box_list+9;
+fltk::Box *const fltk::ENGRAVED_BOX = fltk2_box_list+10;
+fltk::Box *const fltk::EMBOSSED_BOX = fltk2_box_list+11;
+fltk::Box *const fltk::ENGRAVED_FRAME = fltk2_box_list+12;
+fltk::Box *const fltk::EMBOSSED_FRAME = fltk2_box_list+13;
+fltk::Box *const fltk::BORDER_BOX = fltk2_box_list+14;
+fltk::Box *const fltk::SHADOW_BOX = fltk2_box_list+15;
+fltk::Box *const fltk::BORDER_FRAME = fltk2_box_list+16;
+fltk::Box *const fltk::SHADOW_FRAME = fltk2_box_list+17;
+
+
+#include <fltk/LabelType.h>
+
+fltk::LabelType fltk::fltk2_labeltype_list[] = {
+ { fltk3::NORMAL_LABEL },
+ { fltk3::NO_LABEL },
+ { fltk3::SHADOW_LABEL },
+ { fltk3::ENGRAVED_LABEL },
+ { fltk3::EMBOSSED_LABEL },
+ { fltk3::MULTI_LABEL },
+ { fltk3::ICON_LABEL },
+ { fltk3::IMAGE_LABEL }
+};
+
+fltk::LabelType *const fltk::NO_LABEL = fltk2_labeltype_list+1;
+fltk::LabelType *const fltk::NORMAL_LABEL = fltk2_labeltype_list+0;
+fltk::LabelType *const fltk::SYMBOL_LABEL = fltk2_labeltype_list+0;
+fltk::LabelType *const fltk::SHADOW_LABEL = fltk2_labeltype_list+2;
+fltk::LabelType *const fltk::ENGRAVED_LABEL = fltk2_labeltype_list+3;
+fltk::LabelType *const fltk::EMBOSSED_LABEL = fltk2_labeltype_list+4;
+
//
// End of "$Id$".
//
Modified: branches/branch-3.0-2011/src/fl_engraved_label.cxx
===================================================================
--- branches/branch-3.0-2011/src/fl_engraved_label.cxx 2011-01-10 16:56:37 UTC
(rev 8243)
+++ branches/branch-3.0-2011/src/fl_engraved_label.cxx 2011-01-10 19:41:50 UTC
(rev 8244)
@@ -34,7 +34,7 @@
// data[] is dx, dy, color triples
static void innards(
- const Fl_Label* o, int X, int Y, int W, int H, fltk3::Align align,
+ const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align,
int data[][3], int n)
{
fltk3::Align a1 = align;
@@ -49,14 +49,14 @@
}
static void fl_shadow_label(
- const Fl_Label* o, int X, int Y, int W, int H, fltk3::Align align)
+ const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align)
{
static int data[2][3] = {{2,2,FL_DARK3},{0,0,0}};
innards(o, X, Y, W, H, align, data, 2);
}
static void fl_engraved_label(
- const Fl_Label* o, int X, int Y, int W, int H, fltk3::Align align)
+ const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align)
{
static int data[7][3] = {
{1,0,FL_LIGHT3},{1,1,FL_LIGHT3},{0,1,FL_LIGHT3},
@@ -66,7 +66,7 @@
}
static void fl_embossed_label(
- const Fl_Label* o, int X, int Y, int W, int H, fltk3::Align align)
+ const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align)
{
static int data[7][3] = {
{-1,0,FL_LIGHT3},{-1,-1,FL_LIGHT3},{0,-1,FL_LIGHT3},
Modified: branches/branch-3.0-2011/src/fl_labeltype.cxx
===================================================================
--- branches/branch-3.0-2011/src/fl_labeltype.cxx 2011-01-10 16:56:37 UTC
(rev 8243)
+++ branches/branch-3.0-2011/src/fl_labeltype.cxx 2011-01-10 19:41:50 UTC
(rev 8244)
@@ -36,10 +36,10 @@
#include <fltk3/Image.h>
void
-fl_no_label(const Fl_Label*,int,int,int,int,fltk3::Align) {}
+fl_no_label(const fltk3::Label*,int,int,int,int,fltk3::Align) {}
void
-fl_normal_label(const Fl_Label* o, int X, int Y, int W, int H, fltk3::Align
align)
+fl_normal_label(const fltk3::Label* o, int X, int Y, int W, int H,
fltk3::Align align)
{
fl_font(o->font, o->size);
fl_color((fltk3::Color)o->color);
@@ -47,7 +47,7 @@
}
void
-fl_normal_measure(const Fl_Label* o, int& W, int& H) {
+fl_normal_measure(const fltk3::Label* o, int& W, int& H) {
fl_font(o->font, o->size);
fl_measure(o->value, W, H);
if (o->image) {
@@ -84,7 +84,7 @@
////////////////////////////////////////////////////////////////
/** Draws a label with arbitrary alignment in an arbitrary box. */
-void Fl_Label::draw(int X, int Y, int W, int H, fltk3::Align align) const {
+void fltk3::Label::draw(int X, int Y, int W, int H, fltk3::Align align) const {
if (!value && !image) return;
table[type](this, X, Y, W, H, align);
}
@@ -93,7 +93,7 @@
\param[in,out] W, H : this is the requested size for the label text plus
image;
on return, this will contain the size needed to fit the label
*/
-void Fl_Label::measure(int& W, int& H) const {
+void fltk3::Label::measure(int& W, int& H) const {
if (!value && !image) {
W = H = 0;
return;
@@ -127,7 +127,7 @@
*/
void fltk3::Widget::draw_label(int X, int Y, int W, int H, fltk3::Align a)
const {
if (flags()&SHORTCUT_LABEL) fl_draw_shortcut = 1;
- Fl_Label l1 = label_;
+ fltk3::Label l1 = label_;
if (!active_r()) {
l1.color = fl_inactive((fltk3::Color)l1.color);
if (l1.deimage) l1.image = l1.deimage;
Modified: branches/branch-3.0-2011/test2/hello.cxx
===================================================================
--- branches/branch-3.0-2011/test2/hello.cxx 2011-01-10 16:56:37 UTC (rev
8243)
+++ branches/branch-3.0-2011/test2/hello.cxx 2011-01-10 19:41:50 UTC (rev
8244)
@@ -9,10 +9,10 @@
Window *window = new Window(300, 180,"FLTK 2");
window->begin();
Widget *box = new Widget(20, 40, 260, 100, "Hello, World!");
- // FIXME: box->box(UP_BOX);
- // FIXME: box->labelfont(HELVETICA_BOLD_ITALIC);
- // FIXME: box->labelsize(36);
- // FIXME: box->labeltype(SHADOW_LABEL);
+ box->box(UP_BOX);
+ 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