amiga-bootcamp/09_intuition/menus.md
Ilia Sharin 21751c0025 docs(amiga): complete AmigaOS 3.1/3.2 developer reference — 172 files across 17 sections
Comprehensive technical documentation covering:
- Hardware: OCS/ECS/AGA custom chip registers, Copper & Blitter deep dives
- Boot sequence: cold boot through startup-sequence
- Binary format: HUNK executable spec, relocation, debug info
- Linking & ABI: .fd files, LVO tables, register calling conventions
- Exec kernel: tasks, interrupts, memory, signals, semaphores
- AmigaDOS: file I/O, FFS/OFS layout, CLI/Shell scripting
- Graphics: planar bitmaps, Copper programming, HAM/EHB modes
- Intuition: screens, windows, IDCMP, BOOPSI
- Devices: trackdisk, SCSI, serial, timer, audio, keyboard
- Libraries: utility, expansion, IFFParse, locale, ARexx
- Networking: bsdsocket API, SANA-II, TCP/IP stack comparison
- Toolchain: GCC, vasm/vlink, SAS/C, NDK, debugging
- Reverse engineering: IDA/Ghidra setup, compiler fingerprints, case studies
- CPU & MMU: 68040/060 emulation libs, PMMU, cache management
- Driver development: SANA-II, Picasso96/RTG, AHI audio

All files include breadcrumb navigation. No local paths or proprietary content.
2026-04-23 12:17:35 -04:00

64 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[← Home](../README.md) · [Intuition](README.md)
# Menus — MenuStrip Construction
## Overview
Intuition menus are structured as: `Menu``MenuItem``SubItem`. Menus are attached to windows and appear when the user presses the right mouse button.
---
## GadTools Menu Creation (OS 2.0+)
```c
struct NewMenu nm[] = {
{ NM_TITLE, "Project", NULL, 0, 0, NULL },
{ NM_ITEM, "New", "N", 0, 0, NULL },
{ NM_ITEM, "Open...", "O", 0, 0, NULL },
{ NM_ITEM, NM_BARLABEL, NULL, 0, 0, NULL }, /* separator */
{ NM_ITEM, "Quit", "Q", 0, 0, NULL },
{ NM_TITLE, "Edit", NULL, 0, 0, NULL },
{ NM_ITEM, "Cut", "X", 0, 0, NULL },
{ NM_ITEM, "Copy", "C", 0, 0, NULL },
{ NM_ITEM, "Paste", "V", 0, 0, NULL },
{ NM_END, NULL, NULL, 0, 0, NULL }
};
struct Menu *menu = CreateMenus(nm, TAG_DONE);
LayoutMenus(menu, vi, TAG_DONE);
SetMenuStrip(win, menu);
/* In event loop on IDCMP_MENUPICK: */
UWORD code = imsg->Code;
while (code != MENUNULL) {
struct MenuItem *item = ItemAddress(menu, code);
UWORD menuNum = MENUNUM(code);
UWORD itemNum = ITEMNUM(code);
UWORD subNum = SUBNUM(code);
/* process selection */
code = item->NextSelect;
}
/* Cleanup: */
ClearMenuStrip(win);
FreeMenus(menu);
```
---
## Menu Selection Macros
```c
#define MENUNUM(code) ((code) & 0x1F) /* menu number (031) */
#define ITEMNUM(code) (((code) >> 5) & 0x3F) /* item number (063) */
#define SUBNUM(code) (((code) >> 11) & 0x1F) /* subitem number */
#define FULLMENUNUM(m,i,s) ((m)|((i)<<5)|((s)<<11))
#define MENUNULL 0xFFFF /* no selection */
```
---
## References
- NDK39: `libraries/gadtools.h`, `intuition/intuition.h`
- ADCD 2.1: `CreateMenus`, `LayoutMenus`, `SetMenuStrip`