Update the changelog
[opencv] / otherlibs / _fltk / include / FL / mac.H
1 //
2 // "$Id: mac.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
3 //
4 // Mac header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2002 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 to "fltk-bugs@fltk.org".
24 //
25
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...
29
30 #ifndef Fl_X_H
31 #  error "Never use <FL/mac.H> directly; include <FL/x.H> instead."
32 #endif // !Fl_X_H
33
34 // Standard MacOS Carbon API includes...
35 #include <Carbon/Carbon.h>
36
37 // Now make some fixes to the headers...
38 #undef check                    // Dunno where this comes from...
39
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);
49   return R;
50 }
51 inline void XDestroyRegion(Fl_Region r) {
52   DisposeRgn(r);
53 }
54
55 #  define XDestroyWindow(a,b) DisposeWindow(b)
56 #  define XMapWindow(a,b) ShowWindow(b)
57 #  define XUnmapWindow(a,b) HideWindow(b)
58
59 #  include "Fl_Window.H"
60
61 // This object contains all mac-specific stuff about a window:
62 // WARNING: this object is highly subject to change!
63 class Fl_X 
64 {
65 public:
66   Window xid;              // Mac WindowPtr
67   GWorldPtr other_xid;     // pointer for offscreen bitmaps (doublebuffer)
68   Fl_Window *w;            // FLTK window for 
69   Fl_Region region;
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
73   int wait_for_expose;
74   CursHandle cursor;
75   static Fl_X* first;
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*);
79   void flush();
80 };
81
82 inline Window fl_xid(const Fl_Window*w) 
83 {
84   return Fl_X::i(w)->xid;
85 }
86
87 extern CursHandle fl_default_cursor;
88
89 extern struct Fl_XMap {
90   RGBColor rgb;
91   ulong pen;
92 } *fl_current_xmap;
93
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;
98
99 typedef GWorldPtr Fl_Offscreen;
100
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();
106
107 typedef GWorldPtr Fl_Bitmask; // Carbon requires a 1-bit GWorld instead of a BitMap
108
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);
112
113 extern void fl_open_display();
114
115 extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
116
117 //
118 // End of "$Id: mac.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".
119 //
120