foobar2000 SDK  2015-08-03
obj-c.mm
Go to the documentation of this file.
1 //
2 // PFC-ObjC.m
3 // pfc-test
4 //
5 // Created by PEPE on 28/07/14.
6 // Copyright (c) 2014 PEPE. All rights reserved.
7 //
8 #ifdef __APPLE__
9 #import <Foundation/Foundation.h>
10 
11 
12 #include <TargetConditionals.h>
13 
14 #if TARGET_OS_MAC && !TARGET_OS_IPHONE
15 #import <Cocoa/Cocoa.h>
16 #endif
17 
18 #include "pfc.h"
19 
20 
21 namespace pfc {
22  void * thread::g_entry(void * arg) {
23  @autoreleasepool {
24  reinterpret_cast<thread*>(arg)->entry();
25  }
26  return NULL;
27  }
29  if (![NSThread isMultiThreaded]) [[[NSThread alloc] init] start];
30  }
31 
32  bool isShiftKeyPressed() {
33 #if TARGET_OS_MAC && !TARGET_OS_IPHONE
34  return ( [NSEvent modifierFlags] & NSShiftKeyMask ) != 0;
35 #else
36  return false;
37 #endif
38  }
39  bool isCtrlKeyPressed() {
40 #if TARGET_OS_MAC && !TARGET_OS_IPHONE
41  return ( [NSEvent modifierFlags] & NSControlKeyMask ) != 0;
42 #else
43  return false;
44 #endif
45  }
46  bool isAltKeyPressed() {
47 #if TARGET_OS_MAC && !TARGET_OS_IPHONE
48  return ( [NSEvent modifierFlags] & NSAlternateKeyMask ) != 0;
49 #else
50  return false;
51 #endif
52  }
53 }
54 
55 #endif
void start()
Definition: threads.cpp:93
bool isShiftKeyPressed()
bool isCtrlKeyPressed()
bool isAltKeyPressed()
IMPORTANT: all classes derived from thread must call waitTillDone() in their destructor, to avoid object destruction during a virtual function call!
Definition: threads.h:11
static unsigned CALLBACK g_entry(void *p_instance)
Definition: obj-c.mm:22
static void appleStartThreadPrologue()
Definition: obj-c.mm:28
void entry()
Definition: threads.cpp:49