PageRenderTime 53ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

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