source: rtems-graphics-toolkit/fltk-1.1.10/FL/mac.H @ 513eea1

Last change on this file since 513eea1 was 513eea1, checked in by Joel Sherrill <joel.sherrill@…>, on 01/09/10 at 22:43:24

2010-01-08 Joel Sherrill <joel.sherrill@…>

fltk 1.1.10. imported

  • ORIGIN: Updated.
  • Property mode set to 100644
File size: 4.5 KB
Line 
1//
2// "$Id$"
3//
4// Mac header file for the Fast Light Tool Kit (FLTK).
5//
6// Copyright 1998-2005 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.
12//
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.
17//
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.
22//
23// Please report all bugs and problems on the following page:
24//
25//     http://www.fltk.org/str.php
26//
27
28// Do not directly include this file, instead use <FL/x.H>.  It will
29// include this file if "__APPLE__" is defined.  This is to encourage
30// portability of even the system-specific code...
31
32#ifndef Fl_X_H
33#  error "Never use <FL/mac.H> directly; include <FL/x.H> instead."
34#endif // !Fl_X_H
35
36// Standard MacOS Carbon API includes...
37#include <Carbon/Carbon.h>
38
39// Now make some fixes to the headers...
40#undef check                    // Dunno where this comes from...
41
42// Some random X equivalents
43typedef WindowPtr Window;
44struct XPoint { int x, y; };
45struct XRectangle {int x, y, width, height;};
46typedef RgnHandle Fl_Region;
47void fl_clip_region(Fl_Region);
48inline Fl_Region XRectangleRegion(int x, int y, int w, int h) {
49  Fl_Region R = NewRgn();
50  SetRectRgn(R, x, y, x+w, y+h);
51  return R;
52}
53inline void XDestroyRegion(Fl_Region r) {
54  DisposeRgn(r);
55}
56
57#  include "Fl_Window.H"
58
59// This object contains all mac-specific stuff about a window:
60// WARNING: this object is highly subject to change!
61class Fl_X
62{
63public:
64  Window xid;              // Mac WindowPtr
65  GWorldPtr other_xid;     // pointer for offscreen bitmaps (doublebuffer)
66  Fl_Window *w;            // FLTK window for
67  Fl_Region region;
68  Fl_Region subRegion;     // region for this specific subwindow
69  Fl_X *next;              // linked tree to support subwindows
70  Fl_X *xidChildren, *xidNext; // more subwindow tree
71  int wait_for_expose;
72  CursHandle cursor;
73  static Fl_X* first;
74  static Fl_X* i(const Fl_Window* w) {return w->i;}
75  static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&);
76  static void make(Fl_Window*);
77  void flush();
78  // Quartz additions:
79  CGContextRef gc;                 // graphics context (NULL when using QD)
80  static ATSUTextLayout atsu_layout; // windows share a global font
81  static ATSUStyle      atsu_style;
82  static void q_fill_context();    // fill a Quartz context with current FLTK state
83  static void q_clear_clipping();  // remove all clipping from a Quartz context
84  static void q_release_context(Fl_X *x=0); // free all resources associated with fl_gc
85  static void q_begin_image(CGRect&, int x, int y, int w, int h);
86  static void q_end_image();
87};
88
89extern void MacDestroyWindow(Fl_Window*,WindowPtr);
90extern void MacMapWindow(Fl_Window*,WindowPtr);
91extern void MacUnmapWindow(Fl_Window*,WindowPtr);
92extern int MacUnlinkWindow(Fl_X*,Fl_X*start=0L);
93
94inline Window fl_xid(const Fl_Window*w)
95{
96  return Fl_X::i(w)->xid;
97}
98
99extern CursHandle fl_default_cursor;
100
101extern struct Fl_XMap {
102  RGBColor rgb;
103  ulong pen;
104} *fl_current_xmap;
105
106extern FL_EXPORT void *fl_display;
107extern FL_EXPORT Window fl_window;
108extern FL_EXPORT CGContextRef fl_gc;
109extern FL_EXPORT Handle fl_system_menu;
110extern FL_EXPORT class Fl_Sys_Menu_Bar *fl_sys_menu_bar;
111
112typedef GWorldPtr Fl_Offscreen;
113
114extern Fl_Offscreen fl_create_offscreen(int w, int h);
115extern void fl_copy_offscreen(int x,int y,int w,int h, Fl_Offscreen gWorld, int srcx,int srcy);
116extern void fl_delete_offscreen(Fl_Offscreen gWorld);
117extern void fl_begin_offscreen(Fl_Offscreen gWorld);
118extern void fl_end_offscreen();
119
120typedef GWorldPtr Fl_Bitmask; // Carbon requires a 1-bit GWorld instead of a BitMap
121
122extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
123extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
124extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
125
126extern void fl_open_display();
127
128// Register a function for opening files via the finder...
129extern void fl_open_callback(void (*cb)(const char *));
130
131extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
132
133//
134// End of "$Id$".
135//
136
Note: See TracBrowser for help on using the repository browser.