Bump version.
[ntk.git] / src / Fl_Device.cxx
blob60330b00d5ff53328130d02f73392ff296b11b02
1 //
2 // "$Id: Fl_Device.cxx 8504 2011-03-04 16:48:10Z manolo $"
3 //
4 // implementation of Fl_Device class for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 2010-2011 by Bill Spitzak and others.
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 // USA.
23 // Please report all bugs and problems to:
25 // http://www.fltk.org/str.php
28 #include <FL/Fl.H>
29 #include <FL/Fl_Device.H>
30 #include <FL/Fl_Image.H>
32 const char *Fl_Device::class_id = "Fl_Device";
33 const char *Fl_Surface_Device::class_id = "Fl_Surface_Device";
34 const char *Fl_Display_Device::class_id = "Fl_Display_Device";
35 const char *Fl_Graphics_Driver::class_id = "Fl_Graphics_Driver";
36 #if defined(__APPLE__) || defined(FL_DOXYGEN)
37 const char *Fl_Quartz_Graphics_Driver::class_id = "Fl_Quartz_Graphics_Driver";
38 #endif
39 #if defined(WIN32) || defined(FL_DOXYGEN)
40 const char *Fl_GDI_Graphics_Driver::class_id = "Fl_GDI_Graphics_Driver";
41 #endif
42 #if !(defined(__APPLE__) || defined(WIN32))
43 const char *Fl_Xlib_Graphics_Driver::class_id = "Fl_Xlib_Graphics_Driver";
44 const char *Fl_Cairo_Graphics_Driver::class_id = "Fl_Cairo_Graphics_Driver";
45 #endif
48 Fl_Font Fl_Graphics_Driver::font_; // current font
49 Fl_Fontsize Fl_Graphics_Driver::size_; // current font size
50 Fl_Color Fl_Graphics_Driver::color_; // current color
51 int Fl_Graphics_Driver::sptr = 0;
52 //const int Fl_Graphics_Driver::matrix_stack_size = FL_MATRIX_STACK_SIZE;
53 Fl_Graphics_Driver::matrix Fl_Graphics_Driver::stack[FL_MATRIX_STACK_SIZE];
54 Fl_Graphics_Driver::matrix Fl_Graphics_Driver::m = m0;
55 Fl_Graphics_Driver::matrix *Fl_Graphics_Driver::fl_matrix = &m; /**< Points to the current coordinate transformation matrix */
57 int Fl_Graphics_Driver::n = 0;
58 int Fl_Graphics_Driver::p_size = 0;
59 int Fl_Graphics_Driver::gap_ = 0;
60 XPOINT *Fl_Graphics_Driver::p = 0;
61 int Fl_Graphics_Driver::what = 0;
62 int Fl_Graphics_Driver::fl_clip_state_number = 0;
63 int Fl_Graphics_Driver::rstackptr = 0;
64 //const int Fl_Graphics_Driver::region_stack_max = FL_REGION_STACK_SIZE - 1;
65 Fl_Region Fl_Graphics_Driver::rstack[FL_REGION_STACK_SIZE];
68 /** \brief Use this drawing surface for future graphics requests. */
69 void Fl_Surface_Device::set_current(void)
71 fl_graphics_driver = _driver;
72 _surface = this;
75 const Fl_Graphics_Driver::matrix Fl_Graphics_Driver::m0 = {1, 0, 0, 1, 0, 0};
77 Fl_Graphics_Driver::Fl_Graphics_Driver() {
78 /* font_ = 0; */
79 /* size_ = 0; */
80 /* sptr=0; rstackptr=0; */
81 /* fl_clip_state_number=0; */
82 /* m = m0; */
83 /* fl_matrix = &m; */
84 /* p = (XPOINT *)0; */
85 font_descriptor_ = NULL;
88 void Fl_Graphics_Driver::text_extents(const char*t, int n, int& dx, int& dy, int& w, int& h)
90 w = (int)width(t, n);
91 h = - height();
92 dx = 0;
93 dy = descent();
96 Fl_Display_Device::Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : Fl_Surface_Device( graphics_driver ) {
97 #ifdef __APPLE__
98 SInt32 versionMajor = 0;
99 SInt32 versionMinor = 0;
100 SInt32 versionBugFix = 0;
101 Gestalt( gestaltSystemVersionMajor, &versionMajor );
102 Gestalt( gestaltSystemVersionMinor, &versionMinor );
103 Gestalt( gestaltSystemVersionBugFix, &versionBugFix );
104 fl_mac_os_version = versionMajor * 10000 + versionMinor * 100 + versionBugFix;
105 #endif
110 // End of "$Id: Fl_Device.cxx 8504 2011-03-04 16:48:10Z manolo $".