Esempio n. 1
0
static void RLXAPI Shutdown(void)
{
	if (!g_pCGLC)
		return;

	CGDisplaySwitchToMode(g_cgDisplayID, g_cgPrevDisplayMode);
	CGReleaseAllDisplays();
	ShowMenuBar();
}
Esempio n. 2
0
static void RLXAPI Shutdown(void)
{
	if (!g_pAGLC)
		return;

	if (g_cgOldDisplayModeRestore)
	{
		CGDisplaySwitchToMode(g_cgDisplayID, g_cgPrevDisplayMode);
		CGReleaseAllDisplays();
		g_cgOldDisplayModeRestore = 0;
		ShowMenuBar();
	}
}
void myShowMenuBar(void)
{
	switch (mbarstate)
	{
		case UNKNOWN:
		case HIDDEN:
			mbarstate = SHOWING;
			ShowMenuBar();
			break;
		case SHOWING:
			dprintf("ShowMenuBar called while menubar was already showing.");
			break;
	}
}
EXPORT(sqInt) primitiveShowMenuBar(void) {
	ShowMenuBar();
	return null;
}
Esempio n. 5
0
static void
winproc(void *a)
{
	MenuItemIndex index;

	winRect.left = 30;
	winRect.top = 60;
	winRect.bottom = (devRect.size.height * 0.75) + winRect.top;
	winRect.right = (devRect.size.width * 0.75) + winRect.left;

	ClearMenuBar();
	InitCursor();

	CreateStandardWindowMenu(0, &windMenu);
	InsertMenu(windMenu, 0);

	CreateNewMenu(1004, 0, &viewMenu);
	SetMenuTitleWithCFString(viewMenu, CFSTR("View"));
	AppendMenuItemTextWithCFString(viewMenu, CFSTR("Toggle Full Screen"), 0,
								kFullScreenCmd, &index);
	SetMenuItemCommandKey(viewMenu, index, FALSE, 'F');
	InsertMenu(viewMenu, GetMenuID(windMenu));

	DrawMenuBar();
	uint32_t windowAttrs = 0
				| kWindowCloseBoxAttribute
				| kWindowCollapseBoxAttribute
				| kWindowResizableAttribute
				| kWindowStandardHandlerAttribute
				| kWindowFullZoomAttribute
		;

	CreateNewWindow(kDocumentWindowClass, windowAttrs, &winRect, &theWindow);
	SetWindowTitleWithCFString(theWindow, CFSTR("Acme SAC"));

	if(PasteboardCreate(kPasteboardClipboard, &appleclip) != noErr)
		sysfatal("pasteboard create failed");

	const EventTypeSpec app_events[] = {
		{ kEventClassApplication, kEventAppQuit }
	};
	const EventTypeSpec commands[] = {
		{ kEventClassWindow, kEventWindowClosed },
		{ kEventClassWindow, kEventWindowBoundsChanged },
		{ kEventClassCommand, kEventCommandProcess }
	};
	const EventTypeSpec events[] = {
		{ kEventClassTextInput, kEventTextInputUpdateActiveInputArea },
		{ kEventClassTextInput, kEventTextInputUnicodeForKeyEvent },
		{ kEventClassTextInput, kEventTextInputOffsetToPos },
		{ kEventClassTextInput, kEventTextInputPosToOffset },
		{ kEventClassTextInput, kEventTextInputShowHideBottomWindow },
		{ kEventClassTextInput, kEventTextInputGetSelectedText },
		{ kEventClassTextInput, kEventTextInputUnicodeText },
		{ kEventClassTextInput, kEventTextInputFilterText },
		{ kEventClassKeyboard, kEventRawKeyDown },
		{ kEventClassKeyboard, kEventRawKeyModifiersChanged },
		{ kEventClassKeyboard, kEventRawKeyRepeat },
		{ kEventClassMouse, kEventMouseDown },
		{ kEventClassMouse, kEventMouseUp },
		{ kEventClassMouse, kEventMouseMoved },
		{ kEventClassMouse, kEventMouseDragged },
		{ kEventClassMouse, kEventMouseWheelMoved },
	};

	InstallApplicationEventHandler (
								NewEventHandlerUPP (ApplicationQuitEventHandler),
								GetEventTypeCount(app_events),
								app_events,
								NULL,
								NULL);

	InstallApplicationEventHandler (
								NewEventHandlerUPP (MainWindowEventHandler),
								GetEventTypeCount(events),
								events,
								NULL,
								NULL);
						
	InstallWindowEventHandler (
								theWindow,
								NewEventHandlerUPP (MainWindowCommandHandler),
								GetEventTypeCount(commands),
								commands,
								theWindow,
								NULL);

	ShowWindow(theWindow);
	ShowMenuBar();
	window_resized();
	Rectangle rect =  { { 0, 0 }, { bounds.size.width, bounds.size.height } };		
	wmtrack(0, rect.max.x, rect.max.y, 0);
	SelectWindow(theWindow);
	// Run the event loop
	readybit = 1;
	Wakeup(&rend);
	RunApplicationEventLoop();
}