2 // "$Id: mac.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
4 // Mac header file for the Fast Light Tool Kit (FLTK).
6 // Copyright 1998-2002 by Bill Spitzak and others.
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
23 // Please report all bugs and problems to "fltk-bugs@fltk.org".
26 // Do not directly include this file, instead use <FL/x.H>. It will
27 // include this file if "__APPLE__" is defined. This is to encourage
28 // portability of even the system-specific code...
31 # error "Never use <FL/mac.H> directly; include <FL/x.H> instead."
34 // Standard MacOS Carbon API includes...
35 #include <Carbon/Carbon.h>
37 // Now make some fixes to the headers...
38 #undef check // Dunno where this comes from...
40 // Some random X equivalents
41 typedef WindowPtr Window;
42 struct XPoint { int x, y; };
43 struct XRectangle {int x, y, width, height;};
44 typedef RgnHandle Fl_Region;
45 void fl_clip_region(Fl_Region);
46 inline Fl_Region XRectangleRegion(int x, int y, int w, int h) {
47 Fl_Region R = NewRgn();
48 SetRectRgn(R, x, y, x+w, y+h);
51 inline void XDestroyRegion(Fl_Region r) {
55 # define XDestroyWindow(a,b) DisposeWindow(b)
56 # define XMapWindow(a,b) ShowWindow(b)
57 # define XUnmapWindow(a,b) HideWindow(b)
59 # include "Fl_Window.H"
61 // This object contains all mac-specific stuff about a window:
62 // WARNING: this object is highly subject to change!
66 Window xid; // Mac WindowPtr
67 GWorldPtr other_xid; // pointer for offscreen bitmaps (doublebuffer)
68 Fl_Window *w; // FLTK window for
70 Fl_Region subRegion; // region for this specific subwindow
71 Fl_X *next; // linked tree to support subwindows
72 Fl_X *xidChildren, *xidNext; // more subwindow tree
76 static Fl_X* i(const Fl_Window* w) {return w->i;}
77 static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&);
78 static void make(Fl_Window*);
82 inline Window fl_xid(const Fl_Window*w)
84 return Fl_X::i(w)->xid;
87 extern CursHandle fl_default_cursor;
89 extern struct Fl_XMap {
94 extern FL_EXPORT void *fl_display;
95 extern FL_EXPORT Window fl_window;
96 extern FL_EXPORT Handle fl_system_menu;
97 extern FL_EXPORT class Fl_Sys_Menu_Bar *fl_sys_menu_bar;
99 typedef GWorldPtr Fl_Offscreen;
101 extern Fl_Offscreen fl_create_offscreen(int w, int h);
102 extern void fl_copy_offscreen(int x,int y,int w,int h, Fl_Offscreen gWorld, int srcx,int srcy);
103 extern void fl_delete_offscreen(Fl_Offscreen gWorld);
104 extern void fl_begin_offscreen(Fl_Offscreen gWorld);
105 extern void fl_end_offscreen();
107 typedef GWorldPtr Fl_Bitmask; // Carbon requires a 1-bit GWorld instead of a BitMap
109 extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
110 extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
111 extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
113 extern void fl_open_display();
115 extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
118 // End of "$Id: mac.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".