Back to index

texmacs  1.0.7.15
aqua_utilities.h
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : aqua_utilities.h
00004 * DESCRIPTION: Utilities for Aqua
00005 * COPYRIGHT  : (C) 2007  Massimiliano Gubinelli
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #include "mac_cocoa.h"
00013 #include "message.hpp"
00014 
00015 typedef quartet<SI,SI,SI,SI> coord4;
00016 typedef pair<SI,SI> coord2;
00017 
00018 NSRect to_nsrect(coord4 p);
00019 NSPoint to_nspoint(coord2 p);
00020 NSSize to_nssize(coord2 p);
00021 coord4 from_nsrect(NSRect rect);
00022 coord2 from_nspoint(NSPoint pt);
00023 coord2 from_nssize(NSSize s);
00024 NSString *to_nsstring(string s);
00025 NSString *to_nsstring_utf8(string s);
00026 string from_nsstring(NSString *s);
00027 string aqua_translate (string s);
00028 
00029 /******************************************************************************
00030  * Type checking
00031  ******************************************************************************/
00032 #pragma mark type checking
00033 
00034 inline void
00035 check_type_void (blackbox bb, string s) {
00036   if (!is_nil (bb)) {
00037     cerr << "\nslot type= " << s << "\n";
00038     FAILED ("type mismatch");
00039   }
00040 }
00041 
00042 template<class T> void
00043 check_type (blackbox bb, string s) {
00044   if (type_box (bb) != type_helper<T>::id) {
00045     cerr << "\nslot type= " << s << "\n";
00046     FAILED ("type mismatch");
00047   }
00048 }
00049 
00050 template<class T1, class T2> inline void
00051 check_type (blackbox bb, string s) {
00052   check_type<pair<T1,T2> > (bb, s);
00053 }
00054 
00055