65816-llvm-mos/runtime/include/iigs/desktop.h
Scott Duensing da095402ec Updated
2026-06-02 23:17:57 -05:00

58 lines
2.1 KiB
C

// iigs/desktop.h - Full Window Manager desktop startup helper.
//
// Equivalent to ORCA-C's `startdesk` library function: brings up the
// stack of toolsets needed to open titled windows, draw menus,
// dispatch events, etc. Use this before `NewWindow` for any titled-
// window application. See demos/orcaFrame.c for a minimal usage
// example.
//
// On success, `desktopUserId()` returns the Memory Manager userID
// assigned to this application. Pass it to other toolsets that need
// a userID (e.g. ID arg to `DisposeAll`).
//
// startdesk() takes a screen-width hint:
// 320 - SHR 320 mode (16 colors)
// 640 - SHR 640 mode (4 colors)
// This is passed to QDStartUp's masterSCB and to EMStartUp's
// xMax/yMax. Other dimensions are derived.
#ifndef IIGS_DESKTOP_H
#define IIGS_DESKTOP_H
#ifdef __cplusplus
extern "C" {
#endif
// Returns the user-ID assigned by MMStartUp. Pass to enddesk().
unsigned short startdesk(unsigned short screenWidth);
// Tears down the desktop environment in reverse-startup order.
void enddesk(unsigned short userId);
// Read-only accessor — same value startdesk() returned.
unsigned short desktopUserId(void);
// Read-only accessor — base of the per-toolset 0x700-byte DP block
// startdesk() allocated. Slot $300 (256 bytes) is reserved for the
// Menu Manager: pass `desktopDpBase() + 0x300` to MenuStartUp.
unsigned short desktopDpBase(void);
// Paint a clean Finder-style backdrop directly into SHR: white menu
// bar (rows 0..12), 1-pixel black separator (row 13), white desktop
// (rows 14..199). Bypasses the WM's dithered desktop fill (which
// MAME's NTSC chroma simulator renders as colored noise). Call
// AFTER startdesk() and BEFORE NewWindow.
void paintDesktopBackdrop(void);
// Paint menu bar titles via QD's DrawString. Each entry is a
// pascal-string pointer (byte length + chars). Fallback for demos
// running a stripped-down toolset chain - DrawMenuBar() works in
// the standard startdesk() environment as of the post-InitCursor
// landing; prefer iigs/uiBuilder.h's uiBuilderInstallMenuBar.
void paintMenuBarTitles(const unsigned char *const *pascalTitles, unsigned short count);
#ifdef __cplusplus
}
#endif
#endif