Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
TESample.r
/*------------------------------------------------------------------------------------------ |
Program: CPlusTESample 2.0 |
File: TESample.r |
Uses: TECommon.h |
by Andrew Shebanow |
of Apple Macintosh Developer Technical Support |
Copyright © 1989-1990 Apple Computer, Inc. |
All rights reserved. |
------------------------------------------------------------------------------------------*/ |
#include "SysTypes.r" |
#include "Types.r" |
#include "TECommon.h" |
resource 'vers' (1) { |
0x02, 0x00, release, 0x00, verUS, |
"2.00", |
"2.00, Copyright © 1989-1990 Apple Computer, Inc." |
}; |
/* we use an MBAR resource to conveniently load all the menus */ |
resource 'MBAR' (rMenuBar, preload) { |
{ mApple, mFile, mEdit }; /* three menus */ |
}; |
resource 'MENU' (mApple, preload) { |
mApple, textMenuProc, |
0b1111111111111111111111111111101, /* disable dashed line, enable About and DAs */ |
enabled, apple, |
{ |
"About TESampleÉ", |
noicon, nokey, nomark, plain; |
"-", |
noicon, nokey, nomark, plain |
} |
}; |
resource 'MENU' (mFile, preload) { |
mFile, textMenuProc, |
0b0000000000000000000100000000000, /* enable Quit only, program enables others */ |
enabled, "File", |
{ |
"New", |
noicon, "N", nomark, plain; |
"OpenÉ", |
noicon, "O", nomark, plain; |
"-", |
noicon, nokey, nomark, plain; |
"Close", |
noicon, "W", nomark, plain; |
"Save", |
noicon, "S", nomark, plain; |
"Save AsÉ", |
noicon, nokey, nomark, plain; |
"Revert", |
noicon, nokey, nomark, plain; |
"-", |
noicon, nokey, nomark, plain; |
"Page SetupÉ", |
noicon, nokey, nomark, plain; |
"PrintÉ", |
noicon, nokey, nomark, plain; |
"-", |
noicon, nokey, nomark, plain; |
"Quit", |
noicon, "Q", nomark, plain |
} |
}; |
resource 'MENU' (mEdit, preload) { |
mEdit, textMenuProc, |
0b0000000000000000000000000000000, /* disable everything, program does the enabling */ |
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; |
"-", |
noicon, nokey, nomark, plain; |
"Select All", |
noicon, "A", nomark, plain |
} |
}; |
/* this ALRT and DITL are used as an About screen */ |
resource 'ALRT' (rAboutAlert, purgeable) { |
{40, 20, 160, 337 }, rAboutAlert, { |
OK, visible, silent; |
OK, visible, silent; |
OK, visible, silent; |
OK, visible, silent |
}; |
}; |
resource 'DITL' (rAboutAlert, purgeable) { |
{ /* array DITLarray: 5 elements */ |
/* [1] */ |
{88, 227, 108, 305}, |
Button { |
enabled, |
"OK" |
}, |
/* [2] */ |
{8, 8, 24, 305 }, |
StaticText { |
disabled, |
"MultiFinder-Aware C++ TextEdit Application" |
}, |
/* [3] */ |
{32, 8, 48, 305}, |
StaticText { |
disabled, |
"Copyright © 1989-1990 Apple Computer, Inc." |
}, |
/* [4] */ |
{56, 8, 72, 305}, |
StaticText { |
disabled, |
"Brought to you by:" |
}, |
/* [5] */ |
{80, 24, 112, 222}, |
StaticText { |
disabled, |
"Macintosh Developer Technical Support" |
} |
} |
}; |
resource 'WIND' (rDocWindow, preload, purgeable) { |
{64, 60, 314, 460}, |
zoomDocProc, invisible, goAway, 0x0, "untitled" |
}; |
resource 'CNTL' (rVScroll, preload, purgeable) { |
{-1, 385, 236, 401}, |
0, visible, 0, 0, scrollBarProc, 0, "" |
}; |
resource 'CNTL' (rHScroll, preload, purgeable) { |
{235, -1, 251, 386}, |
0, visible, 0, 0, scrollBarProc, 0, "" |
}; |
resource 'STR#' (kTEDocErrStrings, purgeable) { |
{ |
"Not enough memory to run TESample."; |
"Not enough memory to do Cut."; |
"Error during Cut."; |
"Error during Copy."; |
"Cannot exceed 32,000 characters with Paste."; |
"Not enough memory to do Paste."; |
"Cannot create window for document."; |
"Document cannot exceed 32,000 characters."; |
"Error during Paste."; |
"Cannot open an unknown file type." |
} |
}; |
/* here is the quintessential MultiFinder friendliness device, the SIZE resource */ |
resource 'SIZE' (-1) { |
dontSaveScreen, |
acceptSuspendResumeEvents, |
enableOptionSwitch, |
canBackground, /* we can background; we don't currently, but our sleep value */ |
/* guarantees we don't hog the Mac while we are in the background */ |
multiFinderAware, /* this says we do our own activate/deactivate; don't fake us out */ |
backgroundAndForeground, /* this is definitely not a background-only application! */ |
dontGetFrontClicks, /* change this is if you want "do first click" behavior like the Finder */ |
ignoreChildDiedEvents, |
is32BitCompatible, |
reserved, reserved, reserved, reserved, |
reserved, reserved, reserved, |
kPrefSize * 1024, |
kMinSize * 1024 |
}; |
type 'MOOT' as 'STR '; |
resource 'MOOT' (0) { |
"MultiFinder-Aware TextEdit Sample Application" |
}; |
resource 'BNDL' (128) { |
'MOOT', |
0, |
{ |
'ICN#', |
{ |
0, 128; |
1, 129 |
}, |
'FREF', |
{ |
0, 128; |
1, 129 |
} |
} |
}; |
resource 'FREF' (128) { |
'APPL', |
0, |
"" |
}; |
resource 'ICN#' (128) { |
{ /* array: 2 elements */ |
/* [1] */ |
$"04 30 40 00 0A 50 A0 00 0B 91 10 02 08 22 08 03" |
$"12 24 04 05 20 28 02 09 40 10 01 11 80 0C 00 A1" |
$"80 03 FF C2 7E 00 FF 04 01 00 7F 04 03 00 1E 08" |
$"04 E0 00 0C 08 E0 00 0A 10 E0 00 09 08 C0 00 06" |
$"04 87 FE 04 02 88 01 04 01 88 00 84 00 88 00 44" |
$"00 88 00 44 00 88 00 C4 01 10 01 88 02 28 03 10" |
$"01 C4 04 E0 00 02 08 00 73 BF FB EE 4C A2 8A 2A" |
$"40 AA AA EA 52 AA AA 24 5E A2 8A EA 73 BE FB 8E", |
/* [2] */ |
$"04 30 40 00 0E 70 E0 00 0F F1 F0 02 0F E3 F8 03" |
$"1F E7 FC 07 3F EF FE 0F 7F FF FF 1F FF FF FF BF" |
$"FF FF FF FE 7F FF FF FC 01 FF FF FC 03 FF FF F8" |
$"07 FF FF FC 0F FF FF FE 1F FF FF FF 0F FF FF FE" |
$"07 FF FF FC 03 FF FF FC 01 FF FF FC 00 FF FF FC" |
$"00 FF FF FC 00 FF FF FC 01 FF FF F8 03 EF FF F0" |
$"01 C7 FC E0 00 03 F8 00 73 BF FB EE 7F BE FB EE" |
$"7F BE FB EE 7F BE FB E4 7F BE FB EE 73 BE FB 8E" |
} |
}; |
resource 'FREF' (129) { |
'TEXT', |
1, |
"" |
}; |
resource 'ICN#' (129) { |
{ /* array: 2 elements */ |
/* [1] */ |
$"FFFF FFFF 8A50 0001 8B97 7F73 8820 0003" |
$"922F 77C5 A020 0009 C011 EF11 800C 0021" |
$"8003 FFC3 FE00 FF05 8100 7F05 8100 1E09" |
$"B8E0 0009 80E0 0009 BCE0 0009 80C0 0005" |
$"9C87 FE05 8088 0105 BC8B E085 8088 0045" |
$"B08B 7845 8088 0045 9D13 DC89 8220 0111" |
$"B1CF 6EE1 8000 0001 F3BF FBEF CCA2 8A2B" |
$"C0AA AAEB D2AA AA25 DEA2 8AEB FFFF FFFF", |
/* [2] */ |
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" |
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" |
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" |
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" |
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" |
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" |
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" |
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" |
} |
}; |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14