/* Copyright 2017 Wolfgang Thaller. This file is part of Retro68. Retro68 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Retro68 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Retro68. If not, see . */ #include "Processes.r" #include "Menus.r" #include "Windows.r" #include "MacTypes.r" resource 'MENU' (128) { 128, textMenuProc; allEnabled, enabled; apple; { "About WDEF Shell...", noIcon, noKey, noMark, plain; "-", noIcon, noKey, noMark, plain; } }; resource 'MENU' (129) { 129, textMenuProc; allEnabled, enabled; "File"; { "New Document Window", noIcon, "N", noMark, plain; "New Rounded Window", noIcon, "M", noMark, plain; "New Custom Window (10-byte stub)", noIcon, "1", noMark, plain; "New Custom Window (code resource)", noIcon, "2", noMark, plain; "Close", noIcon, "W", noMark, plain; "-", noIcon, noKey, noMark, plain; "Quit", noIcon, "Q", noMark, plain; } }; resource 'MENU' (130) { 130, textMenuProc; 0, enabled; "Edit"; { "Undo", noIcon, "Z", noMark, plain; "-", noIcon, noKey, noMark, plain; "Cut", noIcon, "X", noMark, plain; "Copy", noIcon, "C", noMark, plain; "Paste", noIcon, "V", noMark, plain; "Clear", noIcon, noKey, noMark, plain; } }; resource 'MBAR' (128) { { 128, 129, 130 }; }; resource 'STR#' (128) { { "Standard Document Window", "Rounded Document Window", "Custom Window (10-byte stub)", "Custom Window (code resource)"; } }; data 'TEXT' (128) { "About WDEF Shell\r\r" "A Sample program that tries to show both how to write a basic classic Mac application, " "and how to write a custom window definition procedure (WDEF) using Retro68.\r" "Other code resources (CDEF, MDEF, LDEF, ...) aren't that much different.\r" "\r\rWritten in 2018, so everything here has been obsolete for two decades." }; resource 'WIND' (128) { {0, 0, 220, 320}, altDBoxProc; invisible; noGoAway; 0, ""; noAutoCenter; }; /* The 10-byte code resource stub trick. * * The bytes in this resource are 68K machine code for * move.l L1(pc), -(sp) | 2F3A 0004 * rts | 4E75 * L1: dc.l 0x00000000 | 0000 0000 * * The application loads this resource and replaces the final four bytes * with the address of the WDEF function in wdef.c, which is compiled as part * of the application. */ data 'WDEF' (128) { $"2F3A 0004 4E75 0000 0000" }; resource 'SIZE' (-1) { reserved, acceptSuspendResumeEvents, reserved, canBackground, doesActivateOnFGSwitch, backgroundAndForeground, dontGetFrontClicks, ignoreChildDiedEvents, is32BitCompatible, isHighLevelEventAware, onlyLocalHLEvents, notStationeryAware, dontUseTextEditServices, reserved, reserved, reserved, #ifdef TARGET_API_MAC_CARBON 500 * 1024, // Carbon apparently needs additional memory. 500 * 1024 #else 100 * 1024, 100 * 1024 #endif };