mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-18 11:38:46 +02:00
add Mac OS X "Scope" menu with empty action
This commit is contained in:
parent
e7fc997f78
commit
4741eb869e
4 changed files with 73 additions and 2 deletions
|
@ -21,7 +21,7 @@ endif (APPLE)
|
|||
configure_file(InterfaceConfig.h.in ${PROJECT_BINARY_DIR}/includes/InterfaceConfig.h)
|
||||
|
||||
# grab the implementation and header files from src dir
|
||||
file(GLOB INTERFACE_SRCS src/*.cpp src/*.h)
|
||||
file(GLOB INTERFACE_SRCS src/*.mm src/*.cpp src/*.h)
|
||||
|
||||
if (APPLE)
|
||||
# set how the icon shows up in the Info.plist file
|
||||
|
|
6
interface/src/InterfaceMacOSX.h
Normal file
6
interface/src/InterfaceMacOSX.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef __interface__InterfaceMacOSX
|
||||
#define __interface__InterfaceMacOSX
|
||||
|
||||
void initMacOSXMenu();
|
||||
|
||||
#endif
|
55
interface/src/InterfaceMacOSX.mm
Normal file
55
interface/src/InterfaceMacOSX.mm
Normal file
|
@ -0,0 +1,55 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface InterfaceMainMenuTarget : NSObject
|
||||
|
||||
@property (strong, nonatomic) NSMenuItem *scopeAudioMenuItem;
|
||||
@property (strong, nonatomic) NSMenuItem *scopeNoneMenuItem;
|
||||
|
||||
@end
|
||||
|
||||
@implementation InterfaceMainMenuTarget
|
||||
|
||||
- (void)scopeAudioAction {
|
||||
NSLog(@"scopeAudioAction");
|
||||
}
|
||||
|
||||
- (void)scopeNoneAction {
|
||||
NSLog(@"scopeNoneAction");
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static InterfaceMainMenuTarget *sharedInterfaceMainMenuTarget = nil;
|
||||
|
||||
void initMacOSXMenu() {
|
||||
@autoreleasepool {
|
||||
if (NSApp) {
|
||||
if (!sharedInterfaceMainMenuTarget) {
|
||||
sharedInterfaceMainMenuTarget = [[InterfaceMainMenuTarget alloc] init];
|
||||
}
|
||||
|
||||
NSMenu *mainMenu = [NSApp mainMenu];
|
||||
|
||||
NSMenuItem *scopeMenuItem = [mainMenu insertItemWithTitle:@"Scope"
|
||||
action:nil
|
||||
keyEquivalent:@""
|
||||
atIndex:3];
|
||||
|
||||
NSMenu *scopeMenu = [[[NSMenu alloc] init] initWithTitle:@"Scope"];
|
||||
[scopeMenuItem setSubmenu:scopeMenu];
|
||||
sharedInterfaceMainMenuTarget.scopeAudioMenuItem = [scopeMenu addItemWithTitle:@"Audio"
|
||||
action:@selector(scopeAudioAction)
|
||||
keyEquivalent:@""];
|
||||
[sharedInterfaceMainMenuTarget.scopeAudioMenuItem setTarget:sharedInterfaceMainMenuTarget];
|
||||
[sharedInterfaceMainMenuTarget.scopeAudioMenuItem setState:NSOnState];
|
||||
|
||||
sharedInterfaceMainMenuTarget.scopeNoneMenuItem = [scopeMenu addItemWithTitle:@"None"
|
||||
action:@selector(scopeNoneAction)
|
||||
keyEquivalent:@""];
|
||||
[sharedInterfaceMainMenuTarget.scopeNoneMenuItem setTarget:sharedInterfaceMainMenuTarget];
|
||||
|
||||
[NSApp setMainMenu:mainMenu];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,6 +44,12 @@
|
|||
#include "Oscilloscope.h"
|
||||
#include "UDPSocket.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#include "InterfaceMacOSX.h"
|
||||
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
int audio_on = 1; // Whether to turn on the audio support
|
||||
|
@ -966,7 +972,11 @@ int main(int argc, char** argv)
|
|||
printf( "Init() complete.\n" );
|
||||
|
||||
glutTimerFunc(1000, Timer, 0);
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
initMacOSXMenu();
|
||||
#endif
|
||||
|
||||
glutMainLoop();
|
||||
|
||||
pthread_join(networkReceiveThread, NULL);
|
||||
|
|
Loading…
Reference in a new issue