/TeXmacs-1.0.7.11-src/src/Plugins/Cocoa/aqua_utilities.h
C++ Header | 55 lines | 33 code | 10 blank | 12 comment | 3 complexity | 1e1dfe32858921d018365c0edcee41e4 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, MPL-2.0-no-copyleft-exception
1
2/******************************************************************************
3* MODULE : aqua_utilities.h
4* DESCRIPTION: Utilities for Aqua
5* COPYRIGHT : (C) 2007 Massimiliano Gubinelli
6*******************************************************************************
7* This software falls under the GNU general public license version 3 or later.
8* It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
9* in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
10******************************************************************************/
11
12#include "mac_cocoa.h"
13#include "message.hpp"
14
15typedef quartet<SI,SI,SI,SI> coord4;
16typedef pair<SI,SI> coord2;
17
18NSRect to_nsrect(coord4 p);
19NSPoint to_nspoint(coord2 p);
20NSSize to_nssize(coord2 p);
21coord4 from_nsrect(NSRect rect);
22coord2 from_nspoint(NSPoint pt);
23coord2 from_nssize(NSSize s);
24NSString *to_nsstring(string s);
25NSString *to_nsstring_utf8(string s);
26string from_nsstring(NSString *s);
27string aqua_translate (string s);
28
29/******************************************************************************
30 * Type checking
31 ******************************************************************************/
32#pragma mark type checking
33
34inline void
35check_type_void (blackbox bb, string s) {
36 if (!is_nil (bb)) {
37 cerr << "\nslot type= " << s << "\n";
38 FAILED ("type mismatch");
39 }
40}
41
42template<class T> void
43check_type (blackbox bb, string s) {
44 if (type_box (bb) != type_helper<T>::id) {
45 cerr << "\nslot type= " << s << "\n";
46 FAILED ("type mismatch");
47 }
48}
49
50template<class T1, class T2> inline void
51check_type (blackbox bb, string s) {
52 check_type<pair<T1,T2> > (bb, s);
53}
54
55