2010-03-18 18:29:18 +03:00
|
|
|
//
|
|
|
|
// "$Id$"
|
|
|
|
//
|
2010-03-25 16:59:00 +03:00
|
|
|
// implementation of Fl_Device class for the Fast Light Tool Kit (FLTK).
|
2010-03-18 18:29:18 +03:00
|
|
|
//
|
2011-02-07 16:49:34 +03:00
|
|
|
// Copyright 2010-2011 by Bill Spitzak and others.
|
2010-03-18 18:29:18 +03:00
|
|
|
//
|
|
|
|
// 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:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/str.php
|
|
|
|
//
|
2010-03-14 21:07:24 +03:00
|
|
|
|
|
|
|
#include <FL/Fl.H>
|
|
|
|
#include <FL/Fl_Device.H>
|
|
|
|
#include <FL/Fl_Image.H>
|
|
|
|
|
2011-01-05 13:21:45 +03:00
|
|
|
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";
|
|
|
|
const char *Fl_Graphics_Driver::class_id = "Fl_Graphics_Driver";
|
2010-05-27 21:20:18 +04:00
|
|
|
#if defined(__APPLE__) || defined(FL_DOXYGEN)
|
2011-01-05 13:21:45 +03:00
|
|
|
const char *Fl_Quartz_Graphics_Driver::class_id = "Fl_Quartz_Graphics_Driver";
|
2010-05-27 21:20:18 +04:00
|
|
|
#endif
|
|
|
|
#if defined(WIN32) || defined(FL_DOXYGEN)
|
2011-01-05 13:21:45 +03:00
|
|
|
const char *Fl_GDI_Graphics_Driver::class_id = "Fl_GDI_Graphics_Driver";
|
2010-05-27 21:20:18 +04:00
|
|
|
#endif
|
|
|
|
#if !(defined(__APPLE__) || defined(WIN32))
|
2011-01-05 13:21:45 +03:00
|
|
|
const char *Fl_Xlib_Graphics_Driver::class_id = "Fl_Xlib_Graphics_Driver";
|
2010-05-27 21:20:18 +04:00
|
|
|
#endif
|
2010-03-14 21:07:24 +03:00
|
|
|
|
|
|
|
|
2010-05-27 21:20:18 +04:00
|
|
|
/** \brief Use this drawing surface for future graphics requests. */
|
|
|
|
void Fl_Surface_Device::set_current(void)
|
2010-03-14 21:07:24 +03:00
|
|
|
{
|
2010-07-01 17:21:32 +04:00
|
|
|
fl_graphics_driver = _driver;
|
2011-02-02 15:42:47 +03:00
|
|
|
_surface = this;
|
2010-03-14 21:07:24 +03:00
|
|
|
}
|
2010-03-18 18:29:18 +03:00
|
|
|
|
2011-02-24 21:02:11 +03:00
|
|
|
const Fl_Graphics_Driver::matrix Fl_Graphics_Driver::m0 = {1, 0, 0, 1, 0, 0};
|
2011-02-05 02:32:53 +03:00
|
|
|
|
|
|
|
Fl_Graphics_Driver::Fl_Graphics_Driver() {
|
2011-02-05 16:54:56 +03:00
|
|
|
font_ = 0;
|
|
|
|
size_ = 0;
|
|
|
|
sptr=0; rstackptr=0;
|
|
|
|
fl_clip_state_number=0;
|
|
|
|
m = m0;
|
|
|
|
fl_matrix = &m;
|
|
|
|
p = (XPOINT *)0;
|
2011-02-07 16:49:34 +03:00
|
|
|
font_descriptor_ = NULL;
|
2011-02-05 02:32:53 +03:00
|
|
|
};
|
|
|
|
|
2011-02-18 16:39:48 +03:00
|
|
|
void Fl_Graphics_Driver::text_extents(const char*t, int n, int& dx, int& dy, int& w, int& h)
|
|
|
|
{
|
|
|
|
w = (int)width(t, n);
|
|
|
|
h = - height();
|
2011-02-19 10:36:29 +03:00
|
|
|
dx = 0;
|
|
|
|
dy = descent();
|
2011-02-18 16:39:48 +03:00
|
|
|
}
|
|
|
|
|
2011-03-01 14:58:36 +03:00
|
|
|
Fl_Display_Device::Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : Fl_Surface_Device( graphics_driver) {
|
|
|
|
#ifdef __APPLE__
|
|
|
|
SInt32 version;
|
|
|
|
Gestalt(gestaltSystemVersion, &version);
|
|
|
|
fl_mac_os_version = (int)version;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2011-02-18 16:39:48 +03:00
|
|
|
|
2010-03-18 18:29:18 +03:00
|
|
|
//
|
|
|
|
// End of "$Id$".
|
|
|
|
//
|