Remove the useless pseudo run-time type information supported by the Fl_Device class.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11217 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2016-02-25 17:56:48 +00:00
parent 31793cbdba
commit 7f17b915db
28 changed files with 18 additions and 147 deletions

View File

@ -73,8 +73,6 @@ private:
Fl_Surface_Device *_ss;
#endif
public:
static const char *class_id;
const char *class_name() {return class_id;};
Fl_Copy_Surface(int w, int h);
~Fl_Copy_Surface();
void set_current();
@ -94,8 +92,6 @@ protected:
int width;
int height;
public:
static const char *class_id;
const char *class_name() {return class_id;};
Fl_Quartz_Surface_(int w, int h);
virtual int printable_rect(int *w, int *h);
virtual ~Fl_Quartz_Surface_() {};
@ -110,8 +106,6 @@ class FL_EXPORT Fl_GDI_Surface_ : public Fl_Paged_Device {
unsigned depth;
POINT origins[10];
public:
static const char *class_id;
const char *class_name() {return class_id;};
Fl_GDI_Surface_();
virtual void translate(int x, int y);
virtual void untranslate();
@ -127,8 +121,6 @@ public:
/* Xlib class to implement translate()/untranslate() */
class FL_EXPORT Fl_Xlib_Surface_ : public Fl_Paged_Device {
public:
static const char *class_id;
const char *class_name() {return class_id;};
Fl_Xlib_Surface_();
virtual void translate(int x, int y);
virtual void untranslate();

View File

@ -1,7 +1,7 @@
//
// "$Id$"
//
// Definition of classes Fl_Device, Fl_Surface_Device, Fl_Display_Device
// Definition of classes Fl_Surface_Device, Fl_Display_Device
// for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2016 by Bill Spitzak and others.
@ -18,8 +18,7 @@
//
/** \file Fl_Device.H
\brief declaration of classes Fl_Device, Fl_Surface_Device,
Fl_Display_Device, Fl_Device_Plugin.
\brief declaration of classes Fl_Surface_Device, Fl_Display_Device, Fl_Device_Plugin.
*/
#ifndef Fl_Device_H
@ -33,37 +32,6 @@ class Fl_Font_Descriptor;
class Fl_RGB_Image;
class Fl_Widget;
/**
All graphical output devices and all graphics systems.
This class supports a rudimentary system of run-time type information.
*/
class FL_EXPORT Fl_Device {
public:
/** A string that identifies each subclass of Fl_Device.
Function class_name() applied to a device of this class returns this string.
*/
static const char *class_id;
/**
Returns the name of the class of this object.
The class_name() function is deprecated.
The preferred procedure is to use the Fl_Graphics_Driver::has_feature() member function.
The class of an instance of an Fl_Device subclass can be checked with code such as:
\code
if ( instance->class_name() == Fl_Printer::class_id ) { ... }
\endcode
*/
virtual const char *class_name() {return class_id;};
/**
Virtual destructor.
The destructor of Fl_Device must be virtual to make the destructors of
derived classes being called correctly on destruction.
*/
virtual ~Fl_Device() {};
};
/**
A drawing surface that's susceptible to receive graphical output.
Any FLTK application has at any time a current drawing surface to which all drawing requests are directed.
@ -84,7 +52,7 @@ public:
<li> Delete \c surface.
</ol>
*/
class FL_EXPORT Fl_Surface_Device : public Fl_Device {
class FL_EXPORT Fl_Surface_Device {
/** \brief The graphics driver in use by this surface. */
Fl_Graphics_Driver *_driver;
static Fl_Surface_Device *_surface; // the surface that currently receives graphics output
@ -93,8 +61,6 @@ protected:
/** \brief Constructor that sets the graphics driver to use for the created surface. */
Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver) {_driver = graphics_driver; };
public:
static const char *class_id;
const char *class_name() {return class_id;};
virtual void set_current(void);
/** \brief Sets the graphics driver of this drawing surface. */
inline void driver(Fl_Graphics_Driver *graphics_driver) {_driver = graphics_driver;};
@ -120,8 +86,6 @@ class FL_EXPORT Fl_Display_Device : public Fl_Surface_Device {
static Fl_Display_Device *_display; // the platform display device
static bool high_res_window_; //< true when drawing to a window of a retina display (Mac OS X only)
public:
static const char *class_id;
const char *class_name() {return class_id;};
Fl_Display_Device(Fl_Graphics_Driver *graphics_driver);
static Fl_Display_Device *display_device();
static bool high_resolution() {return high_res_window_;}

View File

@ -1,7 +1,7 @@
//
// "$Id$"
//
// Definition of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
// Definition of classes Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
// for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2016 by Bill Spitzak and others.
@ -83,7 +83,7 @@ typedef short COORD_T;
class. This new class should implement all virtual methods of the Fl_Graphics_Driver class
to support all FLTK drawing functions.
*/
class FL_EXPORT Fl_Graphics_Driver : public Fl_Device {
class FL_EXPORT Fl_Graphics_Driver {
friend class Fl_Surface_Device;
friend class Fl_Pixmap;
friend class Fl_Bitmap;
@ -133,8 +133,6 @@ protected:
// === all code below in this class has been to the reorganisation FL_PORTING process
public:
static const char *class_id;
virtual const char *class_name() {return class_id;};
Fl_Graphics_Driver();
virtual ~Fl_Graphics_Driver() { if (p) free(p); }
virtual char can_do_alpha_blending() { return 0; }

View File

@ -63,8 +63,6 @@ private:
Window pre_window;
#endif
public:
static const char *class_id;
const char *class_name() {return class_id;};
Fl_Image_Surface(int w, int h, int highres = 0);
~Fl_Image_Surface();
void set_current();
@ -78,8 +76,6 @@ public:
/* Mac class to implement translate()/untranslate() for a flipped bitmap graphics context */
class FL_EXPORT Fl_Quartz_Flipped_Surface_ : public Fl_Quartz_Surface_ {
public:
static const char *class_id;
const char *class_name() {return class_id;};
Fl_Quartz_Flipped_Surface_(int w, int h);
void translate(int x, int y);
void untranslate();

View File

@ -113,8 +113,6 @@ protected:
public:
/** \brief The destructor */
virtual ~Fl_Paged_Device() {};
static const char *class_id;
const char *class_name() {return class_id;};
virtual int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
virtual int start_page(void);
virtual int printable_rect(int *w, int *h);

View File

@ -71,8 +71,6 @@ protected:
uchar **mask_bitmap() {return &mask;}
void mask_bitmap(uchar **value) { }
public:
static const char *class_id;
const char *class_name() {return class_id;};
Fl_PostScript_Graphics_Driver();
#ifndef FL_DOXYGEN
enum SHAPE{NONE=0, LINE, LOOP, POLYGON, POINTS};
@ -239,8 +237,6 @@ class FL_EXPORT Fl_PostScript_File_Device : public Fl_Paged_Device {
protected:
Fl_PostScript_Graphics_Driver *driver();
public:
static const char *class_id;
const char *class_name() {return class_id;};
Fl_PostScript_File_Device();
~Fl_PostScript_File_Device();
int start_job(int pagecount, int* from, int* to);

View File

@ -71,8 +71,6 @@ protected:
/** \brief The constructor */
Fl_System_Printer(void);
public:
static const char *class_id;
const char *class_name() {return class_id;};
int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
int start_page (void);
int printable_rect(int *w, int *h);
@ -116,8 +114,6 @@ protected:
/** The constructor */
Fl_PostScript_Printer(void) {};
public:
static const char *class_id;
const char *class_name() {return class_id;};
int start_job(int pages, int *firstpage = NULL, int *lastpage = NULL);
};
@ -184,8 +180,6 @@ public:
*/
class FL_EXPORT Fl_Printer : public Fl_Paged_Device {
public:
static const char *class_id;
const char *class_name() {return class_id;};
/** \brief The constructor */
Fl_Printer(void);
int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);

View File

@ -139,8 +139,9 @@ extern NSCursor *fl_default_cursor;
// This object contains all mac-specific stuff about a window:
// WARNING: this object is highly subject to change!
class Fl_X : public Fl_Device {
class Fl_X {
public:
virtual ~Fl_X() {} // very important
Window xid; // pointer to the Cocoa window object (FLWindow*)
Fl_Offscreen other_xid; // pointer for offscreen bitmaps (overlay window)
Fl_Window *w; // FLTK window for

View File

@ -63,8 +63,9 @@ inline void XClipBox(Fl_Region r,XRectangle* rect) {
// this object contains all win32-specific stuff about a window:
// Warning: this object is highly subject to change!
class FL_EXPORT Fl_X : public Fl_Device {
class FL_EXPORT Fl_X {
public:
virtual ~Fl_X() {} // very important
// member variables - add new variables only at the end of this block
Window xid;
HBITMAP other_xid; // for double-buffered windows

3
FL/x.H
View File

@ -133,8 +133,9 @@ extern FL_EXPORT XFontStruct* fl_X_core_font();
// this object contains all X-specific stuff about a window:
// Warning: this object is highly subject to change!
// FL_LIBRARY or FL_INTERNALS must be defined to access this class.
class FL_EXPORT Fl_X : public Fl_Device {
class FL_EXPORT Fl_X {
public:
virtual ~Fl_X() {} // very important
Window xid;
Window other_xid;
Fl_Window *w;

View File

@ -33,7 +33,6 @@ int Fl_Quartz_Surface_::printable_rect(int *w, int *h) {
return 0;
}
const char *Fl_Quartz_Surface_::class_id = "Fl_Quartz_Surface_";
#elif defined(WIN32)
@ -60,13 +59,9 @@ void Fl_GDI_Surface_::untranslate() {
SetWindowOrgEx((HDC)driver()->gc(), origins[depth].x, origins[depth].y, NULL);
}
const char *Fl_GDI_Surface_::class_id = "Fl_GDI_Surface_";
#endif
const char *Fl_Copy_Surface::class_id = "Fl_Copy_Surface";
/** Constructor.
\param w and \param h are the width and height of the clipboard surface
in pixels where drawing will occur.
@ -243,8 +238,6 @@ class Fl_translated_Xlib_Graphics_Driver_ : public Fl_Xlib_Graphics_Driver {
unsigned depth; // depth of translation stack
int stack_x[20], stack_y[20]; // translation stack allowing cumulative translations
public:
static const char *class_id;
const char *class_name() {return class_id;};
Fl_translated_Xlib_Graphics_Driver_() {
offset_x = 0; offset_y = 0;
depth = 0;
@ -258,7 +251,7 @@ public:
push_matrix();
translate(dx, dy);
if (depth < sizeof(stack_x)/sizeof(int)) depth++;
else Fl::warning("%s: translate stack overflow!", class_id);
else Fl::warning("%s: translate stack overflow!", "Fl_translated_Xlib_Graphics_Driver_");
}
void untranslate_all() { // undoes previous translate_all()
if (depth > 0) depth--;
@ -353,7 +346,6 @@ public:
void point(int x, int y) { Fl_Xlib_Graphics_Driver::point(x+offset_x, y+offset_y); }
};
const char *Fl_translated_Xlib_Graphics_Driver_::class_id = "Fl_translated_Xlib_Graphics_Driver_";
void Fl_Xlib_Surface_::translate(int x, int y) {
((Fl_translated_Xlib_Graphics_Driver_*)driver())->translate_all(x, y);
@ -369,8 +361,6 @@ Fl_Xlib_Surface_::~Fl_Xlib_Surface_() {
delete driver();
}
const char *Fl_Xlib_Surface_::class_id = "Fl_Xlib_Surface_";
#endif
//

View File

@ -23,8 +23,7 @@
/* Attempt at an inheritance diagram.
Fl_Device: base class for the core device systems
|
+- Fl_Surface_Device: any kind of surface that we can draw onto -> uses an Fl_Graphics_Driver
|
+- Fl_Display_Device: some kind of video device
@ -38,7 +37,7 @@
+- Fl_PostScript_File_Device
|
+- Fl_PostScript_Printer
|
+- Fl_Graphics_Driver
|
+- Fl_..._Graphics_Driver: platform specific graphics driver
@ -49,10 +48,6 @@ TODO:
*/
const char *Fl_Device::class_id = "Fl_Device";
const char *Fl_Surface_Device::class_id = "Fl_Surface_Device";
const char *Fl_Display_Device::class_id = "Fl_Display_Device";
bool Fl_Display_Device::high_res_window_ = false;

View File

@ -1,7 +1,7 @@
//
// "$Id$"
//
// implementation of Fl_Device class for the Fast Light Tool Kit (FLTK).
// implementation of Fl_Graphics_Driver class for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2012 by Bill Spitzak and others.
//
@ -22,8 +22,6 @@
#include <FL/Fl_Image.H>
#include <FL/fl_draw.H>
const char *Fl_Graphics_Driver::class_id = "Fl_Graphics_Driver";
FL_EXPORT Fl_Graphics_Driver *fl_graphics_driver; // the current target device of graphics operations
const Fl_Graphics_Driver::matrix Fl_Graphics_Driver::m0 = {1, 0, 0, 1, 0, 0};

View File

@ -32,8 +32,6 @@
#else
#endif
const char *Fl_Image_Surface::class_id = "Fl_Image_Surface";
/** Constructor with optional high resolution.
\param w and \param h give the size in pixels of the resulting image.
\param highres if non-zero, the surface pixel size is twice as high and wide as w and h,
@ -200,8 +198,6 @@ void Fl_Quartz_Flipped_Surface_::untranslate() {
CGContextRestoreGState((CGContextRef)driver()->gc());
}
const char *Fl_Quartz_Flipped_Surface_::class_id = "Fl_Quartz_Flipped_Surface_";
#endif
/** Draws a window and its borders and title bar to the image drawing surface.

View File

@ -29,8 +29,6 @@
#include "drivers/Quartz/Fl_Quartz_Graphics_Driver.h"
#endif
const char *Fl_Paged_Device::class_id = "Fl_Paged_Device";
/**
@brief Draws the widget on the printed page.
*

View File

@ -32,8 +32,6 @@
#endif
#endif
const char *Fl_PostScript_Graphics_Driver::class_id = "Fl_PostScript_Graphics_Driver";
const char *Fl_PostScript_File_Device::class_id = "Fl_PostScript_File_Device";
/** \brief Label of the PostScript file chooser window */
const char *Fl_PostScript_File_Device::file_chooser_title = "Select a .ps file";

View File

@ -19,8 +19,6 @@
#include <FL/Fl_Printer.H>
const char *Fl_Printer::class_id = "Fl_Printer";
#ifdef NO_PRINT_SUPPORT
Fl_Printer::Fl_Printer(void) {
@ -116,16 +114,6 @@ const char *Fl_Printer::property_save = "Save";
/** [this text may be customized at run-time] */
const char *Fl_Printer::property_cancel = "Cancel";
#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN) // PORTME: Fl_Screen_Driver - platform printing
const char *Fl_System_Printer::class_id = Fl_Printer::class_id;
#endif
#if defined(__APPLE__) || defined(WIN32)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the printer device specifics"
#else
const char *Fl_PostScript_Printer::class_id = Fl_Printer::class_id;
#endif
#if defined(__APPLE__) || defined(WIN32) // PORTME: Fl_Screen_Driver - platform printing
void Fl_System_Printer::origin(int *x, int *y)

View File

@ -22,11 +22,6 @@
#include "Fl_GDI_Graphics_Driver.h"
const char *Fl_GDI_Graphics_Driver::class_id = "Fl_GDI_Graphics_Driver";
// FIXME: move to printer graphics driver
const char *Fl_GDI_Printer_Graphics_Driver::class_id = "Fl_GDI_Printer_Graphics_Driver";
/* Reference to the current device context
For back-compatibility only. The preferred procedure to get this reference is
Fl_Surface_Device::surface()->driver()->gc().

View File

@ -1,7 +1,7 @@
//
// "$Id$"
//
// Definition of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
// Definition of classes Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
// for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2016 by Bill Spitzak and others.
@ -43,8 +43,6 @@ protected:
void mask_bitmap(uchar **value) { mask_bitmap_ = value; }
public:
Fl_GDI_Graphics_Driver() {mask_bitmap_ = NULL;}
static const char *class_id;
const char *class_name() {return class_id;};
virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
char can_do_alpha_blending();
virtual void gc(void *ctxt) {if (ctxt != gc_) global_gc(); gc_ = (HDC)ctxt;}
@ -132,9 +130,7 @@ protected:
*/
class FL_EXPORT Fl_GDI_Printer_Graphics_Driver : public Fl_GDI_Graphics_Driver {
public:
static const char *class_id;
virtual int has_feature(driver_feature mask) { return mask & (NATIVE | PRINTER); }
const char *class_name() {return class_id;};
void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy);
int draw_scaled(Fl_Image *img, int XP, int YP, int WP, int HP);

View File

@ -37,9 +37,6 @@ Fl_OpenGL_Display_Device::Fl_OpenGL_Display_Device(Fl_OpenGL_Graphics_Driver *gr
{
}
const char *Fl_OpenGL_Display_Device::class_id = "Fl_OpenGL_Display_Device";
//
// End of "$Id$".
//

View File

@ -27,8 +27,6 @@ class Fl_OpenGL_Graphics_Driver;
*/
class FL_EXPORT Fl_OpenGL_Display_Device : public Fl_Surface_Device {
public:
static const char *class_id;
const char *class_name() {return class_id;};
Fl_OpenGL_Display_Device(Fl_OpenGL_Graphics_Driver *graphics_driver);
static Fl_OpenGL_Display_Device *display_device();
};

View File

@ -19,14 +19,9 @@
#ifndef FL_CFG_GFX_OPENGL_CXX
#define FL_CFG_GFX_OPENGL_CXX
#include <FL/gl.h>
#include "Fl_OpenGL_Graphics_Driver.h"
const char *Fl_OpenGL_Graphics_Driver::class_id = "Fl_OpenGL_Graphics_Driver";
#endif // FL_CFG_GFX_OPENGL_RECT_CXX
//

View File

@ -33,8 +33,6 @@
*/
class FL_EXPORT Fl_OpenGL_Graphics_Driver : public Fl_Graphics_Driver {
public:
static const char *class_id;
const char *class_name() {return class_id;};
// --- line and polygon drawing with integer coordinates
void point(int x, int y);
void rect(int x, int y, int w, int h);

View File

@ -1,7 +1,7 @@
//
// "$Id$"
//
// implementation of Fl_Device class for the Fast Light Tool Kit (FLTK).
// implementation of Fl_Display_Device class for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2016 by Bill Spitzak and others.
//
@ -19,8 +19,6 @@
// FIXME: implement this
#if 0
const char *Fl_Display_Device::class_id = "Fl_Display_Device";
/** A constructor that sets the graphics driver used by the display */
Fl_Display_Device::Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : Fl_Surface_Device(graphics_driver) {
this->set_current();

View File

@ -20,9 +20,6 @@
#include "../../config_lib.h"
#include "Fl_Quartz_Graphics_Driver.h"
const char *Fl_Quartz_Graphics_Driver::class_id = "Fl_Quartz_Graphics_Driver";
/* Reference to the current CGContext
For back-compatibility only. The preferred procedure to get this reference is
Fl_Surface_Device::surface()->driver()->gc().

View File

@ -42,8 +42,6 @@ class Fl_Quartz_Graphics_Driver : public Fl_Graphics_Driver {
protected:
CGContextRef gc_;
public:
static const char *class_id;
const char *class_name() {return class_id;};
virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
virtual void gc(void *ctxt) {if (ctxt != gc_) global_gc(); gc_ = (CGContextRef)ctxt; }
virtual void *gc() {return gc_;}

View File

@ -27,9 +27,6 @@
#include <X11/extensions/Xrender.h>
#endif
const char *Fl_Xlib_Graphics_Driver::class_id = "Fl_Xlib_Graphics_Driver";
/* Reference to the current graphics context
For back-compatibility only. The preferred procedure to get this pointer is
Fl_Surface_Device::surface()->driver()->gc().

View File

@ -1,7 +1,7 @@
//
// "$Id$"
//
// Definition of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
// Definition of classes Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
// for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2016 by Bill Spitzak and others.
@ -39,9 +39,7 @@ protected:
uchar **mask_bitmap() {return mask_bitmap_;}
void mask_bitmap(uchar **value) { mask_bitmap_ = value; }
public:
static const char *class_id;
Fl_Xlib_Graphics_Driver(void);
const char *class_name() {return class_id;};
virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
virtual void *gc() { return gc_; }
char can_do_alpha_blending();