summaryrefslogtreecommitdiff
path: root/FL/Fl_Device.H
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-04-18 06:57:37 +0000
committerManolo Gouy <Manolo>2010-04-18 06:57:37 +0000
commitd0b1cc30f7eac228caddadb2bc675865a4124b1b (patch)
tree210bf48b7ca03062c9a02c9b057539263f3d7ae1 /FL/Fl_Device.H
parent828568a33610d7696f4764ce2ad0f4014f4a6e26 (diff)
Removed multiple inheritance: back to r. 7519 exactly.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7522 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl_Device.H')
-rw-r--r--FL/Fl_Device.H137
1 files changed, 54 insertions, 83 deletions
diff --git a/FL/Fl_Device.H b/FL/Fl_Device.H
index ad8506f1e..8eaaa0c87 100644
--- a/FL/Fl_Device.H
+++ b/FL/Fl_Device.H
@@ -1,8 +1,8 @@
//
// "$Id$"
//
-// Definition of classes Fl_Device, Fl_Display_Device, Fl_Graphics_Device
-// for the Fast Light Tool Kit (FLTK).
+// Definition of classes Fl_Device, Fl_Display, Fl_Quartz_Display, Fl_GDI_Display,
+// and Fl_Xlib_Display for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010 by Bill Spitzak and others.
//
@@ -26,7 +26,7 @@
// http://www.fltk.org/str.php
//
/** \file Fl_Device.H
- \brief declaration of classes Fl_Device, Fl_Display_Device.
+ \brief declaration of classes Fl_Device, Fl_Display.
*/
#ifndef Fl_Device_H
@@ -45,12 +45,14 @@
#include <stdio.h>
#endif
+class Fl_Widget;
class Fl_Device;
-class Fl_Display_Device;
+class Fl_Display;
+class Fl_Abstract_Printer;
/** \brief Points to the device that currently receives all graphics requests */
-extern Fl_Device *fl_device;
+FL_EXPORT extern Fl_Device *fl_device;
/** \brief Points to the platform's display device */
-extern Fl_Display_Device *fl_display_device;
+FL_EXPORT extern Fl_Display *fl_display_device;
/**
signature of image generation callback function.
@@ -69,18 +71,18 @@ typedef void (*Fl_Draw_Image_Cb)(void* data,int x,int y,int w,uchar* buf);
support all of FLTK drawing functions.
<br> The preferred FLTK API for drawing operations is the function collection of the
\ref fl_drawings and \ref fl_attributes modules.
- <br> Alternatively, methods of the Fl_Device class can be called
+ <br> Alternatively, member functions of the Fl_Device class can be called
using the global variable Fl_Device * \ref fl_device that points at all time to the single device
(an instance of an Fl_Device subclass) that's currently receiving graphics requests:
\code fl_device->rect(x, y, w, h); \endcode
- <br>Each protected method of the Fl_Device class has the same effect as the
+ <br>Each member function of the Fl_Device class has the same effect and parameter list as the
function of the \ref fl_drawings and \ref fl_attributes modules which bears the same name
- prefixed with fl_ and has the same parameter list.
+ prefixed with fl_ .
*/
class Fl_Device {
protected:
/** \brief The device type */
- const char *type_;
+ int type_;
/** \brief red color for background and/or mixing if device does not support masking or alpha */
uchar bg_r_;
/** \brief green color for background and/or mixing if device does not support masking or alpha */
@@ -90,7 +92,6 @@ protected:
friend class Fl_Pixmap;
friend class Fl_Bitmap;
friend class Fl_RGB_Image;
- friend class Fl_PS_Device;
friend void fl_rect(int x, int y, int w, int h);
friend void fl_rectf(int x, int y, int w, int h);
friend void fl_line_style(int style, int width, char* dashes);
@@ -238,103 +239,73 @@ protected:
/** \brief see fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D). */
virtual void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
// Image classes
- /** \brief Draws an Fl_RGB_Image object to the device.
- *
- Specifies a bounding box for the image, with the origin (upper left-hand corner) of
- the image offset by the cx and cy arguments.
- */
- virtual void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy) {};
- /** \brief Draws an Fl_Pixmap object to the device.
- *
- Specifies a bounding box for the image, with the origin (upper left-hand corner) of
- the image offset by the cx and cy arguments.
- */
- virtual void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy) {};
- /** \brief Draws an Fl_Bitmap object to the device.
- *
- Specifies a bounding box for the image, with the origin (upper left-hand corner) of
- the image offset by the cx and cy arguments.
- */
- virtual void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {};
-
+ virtual void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy);
+ virtual void draw(Fl_Bitmap * bmp,int XP, int YP, int WP, int HP, int cx, int cy);
+ virtual void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy);
+
public:
- /** A name that identifies each subclass of Fl_Device */
- static const char *device_type;
/**
- @brief An RTTI emulation of device classes.
- *
- The type of an instance of an Fl_Device subclass can be checked with code such as:
- \code
- if ( fl_device->type() == Fl_Printer::device_type ) { ... }
- \endcode
+ @brief All implemented graphics output devices.
*/
- inline const char *type() {return type_;};
+ enum device_types {
+ xlib_display = 0, /**< The X11 display. */
+ quartz_display, /**< The Mac OS X display. */
+ gdi_display, /**< The MSWindows display. */
+ gdi_printer = 256, /**< The MSWindows printer. */
+ quartz_printer, /**< The Mac OS X printer. */
+ postscript_device /**< The PostScript device. */
+ };
+ /**
+ @brief An RTTI emulation of device classes. It returns values < 256 if it is a display device
+ */
+ inline int type() {return type_;};
virtual Fl_Device *set_current(void);
-
+
virtual ~Fl_Device() {};
static Fl_Device *current();
/**
@brief Returns the platform's display device.
*/
- static Fl_Display_Device *display_device() { return fl_display_device; };
+ static Fl_Display *display_device() { return fl_display_device; };
};
+extern FL_EXPORT Fl_Device *fl_device;
-#if defined(__APPLE__)
-// The Mac OS X-specific graphics class.
-class Fl_Graphics_Device : public Fl_Device {
-protected:
- Fl_Graphics_Device() { type_ = device_type; };
-public:
- static const char *device_type;
- void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
+/**
+ @brief A virtual class subclassed for OS-specific display graphics.
+ */
+class Fl_Display : public Fl_Device {
+ friend class Fl_PSfile_Device;
};
-typedef Fl_Graphics_Device Fl_Quartz_Device;
-#elif defined(WIN32)
-// The MSWindows-specific graphics class.
-class Fl_Graphics_Device : public Fl_Device {
-protected:
- Fl_Graphics_Device() { type_ = device_type; };
+#if defined(__APPLE__) || defined(FL_DOXYGEN)
+/**
+ @brief The Mac OS X-specific display graphics class.
+ */
+class Fl_Quartz_Display : public Fl_Display {
public:
- static const char *device_type;
- void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
+ Fl_Quartz_Display() { type_ = quartz_display; };
};
-typedef Fl_Graphics_Device Fl_GDI_Device;
-
-#else
+#endif
+#if defined(WIN32) || defined(FL_DOXYGEN)
/**
- @brief A class representing OS-specific graphics system.
- *
- This class is also named Fl_Quartz_Device on Mac OS X, Fl_GDI_Device on MS-Win, Fl_Xlib_Device on X11.
- A graphics system can be shared by various devices (e.g., display, printer, clipboard).
+ @brief The MSWindows-specific display graphics class.
*/
-class Fl_Graphics_Device : public Fl_Device {
-protected:
- Fl_Graphics_Device() { type_ = device_type; };
+class Fl_GDI_Display : public Fl_Display {
public:
- static const char *device_type;
- void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
+ Fl_GDI_Display() { type_ = gdi_display; };
};
-typedef Fl_Graphics_Device Fl_Xlib_Device;
#endif
-
+#if !( defined(__APPLE__) || defined(WIN32)) || defined(FL_DOXYGEN)
/**
- @brief The platform's display.
-*/
-class Fl_Display_Device : public Fl_Graphics_Device {
+ @brief The X11-specific display graphics class.
+ */
+class Fl_Xlib_Display : public Fl_Display {
public:
- static const char *device_type;
- Fl_Display_Device() { type_ = device_type; };
+ Fl_Xlib_Display() { type_ = xlib_display; };
};
-
+#endif
#endif // Fl_Device_H