[773] | 1 | // |
---|
| 2 | // "$Id: mac.h 4397 2005-06-24 06:35:24Z spitzak $" |
---|
| 3 | // |
---|
| 4 | // Mac header file for the Fast Light Tool Kit (FLTK). |
---|
| 5 | // |
---|
| 6 | // Copyright 1998-2003 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 and "USE_X11" is UNdefined. |
---|
| 28 | // This is to encourage portability of even the system-specific code... |
---|
| 29 | |
---|
| 30 | #ifndef fltk_mac_h |
---|
| 31 | #define fltk_mac_h |
---|
| 32 | |
---|
| 33 | // Standard MacOS Carbon API includes... |
---|
| 34 | #define Style XStyle |
---|
| 35 | #include <Carbon/Carbon.h> |
---|
| 36 | #undef Style |
---|
| 37 | |
---|
| 38 | // Now make some fixes to the headers... |
---|
| 39 | #undef check // Dunno where this comes from... |
---|
| 40 | |
---|
| 41 | //////////////////////////////////////////////////////////////// |
---|
| 42 | // Emulate X somewhat: |
---|
| 43 | |
---|
| 44 | namespace fltk { |
---|
| 45 | |
---|
| 46 | //////////////////////////////////////////////////////////////// |
---|
| 47 | // constant information about the display: |
---|
| 48 | |
---|
| 49 | //extern FL_API void *qdisplay; |
---|
| 50 | extern FL_API void open_display(); |
---|
| 51 | extern FL_API void close_display(); |
---|
| 52 | extern FL_API WindowPtr quartz_window; |
---|
| 53 | extern FL_API CGContextRef quartz_gc; |
---|
| 54 | extern FL_API Handle system_menu; |
---|
| 55 | extern FL_API class Fl_Sys_Menu_Bar *sys_menu_bar; |
---|
| 56 | |
---|
| 57 | //////////////////////////////////////////////////////////////// |
---|
| 58 | // event handling: |
---|
| 59 | |
---|
| 60 | // we want some way to access last message from system |
---|
| 61 | |
---|
| 62 | //////////////////////////////////////////////////////////////// |
---|
| 63 | // drawing functions: |
---|
| 64 | |
---|
| 65 | extern FL_API void clip_region(RgnHandle); |
---|
| 66 | extern FL_API RgnHandle clip_region(); |
---|
| 67 | extern FL_API void draw_into(CGContextRef xid, int w, int h); |
---|
| 68 | extern FL_API void stop_drawing(CGImageRef xid); |
---|
| 69 | #define HFONT const char* // points at name of font! |
---|
| 70 | extern FL_API HFONT xfont(); |
---|
| 71 | |
---|
| 72 | extern FL_API void clear_quartz_clipping(); |
---|
| 73 | extern FL_API void begin_quartz_image(CGRect&, const Rectangle&); |
---|
| 74 | extern FL_API void end_quartz_image(); |
---|
| 75 | |
---|
| 76 | //////////////////////////////////////////////////////////////// |
---|
| 77 | #ifdef fltk_Window_h // only include this if <fltk/Window.h> was included |
---|
| 78 | |
---|
| 79 | // When fltk tells X about a window, one of these objects is created. |
---|
| 80 | // Warning: this object is highly subject to change! It's definition |
---|
| 81 | // is only here so that fltk::xid(Window) can be declared inline: |
---|
| 82 | |
---|
| 83 | class FL_API CreatedWindow { |
---|
| 84 | public: |
---|
| 85 | WindowPtr xid; // used by main windows |
---|
| 86 | Window* window; |
---|
| 87 | RgnHandle region; // damage region |
---|
| 88 | void expose(const Rectangle&); |
---|
| 89 | CreatedWindow* next; |
---|
| 90 | RgnHandle subRegion; // region which clips out children |
---|
| 91 | CreatedWindow *children, *brother; |
---|
| 92 | bool wait_for_expose; |
---|
| 93 | bool need_new_subRegion; |
---|
| 94 | bool overlay; |
---|
| 95 | static CreatedWindow* first; |
---|
| 96 | static CreatedWindow* find(const Window* window) {return window->i;} |
---|
| 97 | static int borders(const Window* w, int& dx, int& dy, int& dw, int& dh); |
---|
| 98 | // Quartz additions: |
---|
| 99 | CGContextRef gc; |
---|
| 100 | }; |
---|
| 101 | |
---|
| 102 | extern FL_API void fill_quartz_context(); |
---|
| 103 | extern FL_API void release_quartz_context(CreatedWindow *x=0); |
---|
| 104 | |
---|
| 105 | // convert xid <-> Window: |
---|
| 106 | //inline WindowPtr xid(const Window*w) {return CreatedWindow::find(w)->xid;} |
---|
| 107 | WindowPtr xid(const Window*); |
---|
| 108 | Window* find(WindowPtr xid); |
---|
| 109 | |
---|
| 110 | extern CursHandle default_cursor; |
---|
| 111 | extern CursHandle current_cursor; |
---|
| 112 | extern const Widget* cursor_for; |
---|
| 113 | |
---|
| 114 | #endif //Fl_Window_H |
---|
| 115 | //////////////////////////////////////////////////////////////// |
---|
| 116 | |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | #endif |
---|
| 120 | |
---|
| 121 | // |
---|
| 122 | // End of "$Id: mac.h 4397 2005-06-24 06:35:24Z spitzak $". |
---|
| 123 | // |
---|
| 124 | |
---|