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.
GetZoneList.r
/*----------------------------------------------------------------------------- |
# |
# Apple Macintosh Developer Technical Support |
# |
# AppleTalk GetZoneList Sample Application |
# |
# GetZoneList |
# |
# GetZoneList.r - Rez Source |
# |
# Copyright © 1988-1990 Apple Computer, Inc. |
# All rights reserved. |
# |
# Versions: 1.00 November 1988 |
# 1.01 October 1989 |
# 1.02 May 1990 |
# 1.03 June 1992 |
# 1.04 July 1992 |
# |
# Components: GetZoneList.c May 1, 1990 |
# GetZoneList.p May 1, 1990 |
# GetZoneList.r May 1, 1990 |
# MakeFile May 1, 1990 |
# UFailure.a November 1, 1988 |
# UFailure.h November 1, 1988 |
# UFailure.inc1.p November 1, 1988 |
# UFailure.p November 1, 1988 |
# |
# GetZoneList is a sample application that uses |
# AppleTalk ATP and ZIP to obtain a list of zones |
# on an AppleTalk internet. |
# |
# GetZoneList also demonstrates using a signal, or |
# failure-catching mechanism to recover from error |
# situations. |
# |
# GetZoneList is based on DTS Sample.p. For more |
# description and explanantion of the non-example |
# specific areas of this application, please refer to |
# either Sample.p or TESample.p. |
# |
# -----------------------------------------------------------------------------*/ |
#include "Types.r" |
#define kMinSize 62 /* application's minimum size (in K) */ |
#define kPrefSize 66 /* application's preferred size (in K) */ |
#define rAboutAlert 128 /* about alert */ |
#define rZoneDialog 129 /* zone list dialog */ |
#define rUserAlert 130 /* error alert */ |
#define sErrStrings 128 /* error strings STR# ID */ |
#define rMenuBar 128 /* application's menu bar */ |
#define mApple 128 /* Apple menu */ |
#define mFile 129 /* File menu */ |
#define mEdit 130 /* Edit menu */ |
/* these #defines are used to set enable/disable flags of a menu */ |
#define AllItems 0b1111111111111111111111111111111 /* 31 flags */ |
#define NoItems 0b0000000000000000000000000000000 |
#define MenuItem1 0b0000000000000000000000000000001 |
#define MenuItem2 0b0000000000000000000000000000010 |
#define MenuItem3 0b0000000000000000000000000000100 |
#define MenuItem4 0b0000000000000000000000000001000 |
#define MenuItem5 0b0000000000000000000000000010000 |
#define MenuItem6 0b0000000000000000000000000100000 |
#define MenuItem7 0b0000000000000000000000001000000 |
#define MenuItem8 0b0000000000000000000000010000000 |
#define MenuItem9 0b0000000000000000000000100000000 |
#define MenuItem10 0b0000000000000000000001000000000 |
#define MenuItem11 0b0000000000000000000010000000000 |
#define MenuItem12 0b0000000000000000000100000000000 |
/* 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, |
AllItems & ~MenuItem2, /* Disable dashed line, enable About and DAs */ |
enabled, apple, |
{ |
"About GetZoneListÉ", |
noicon, nokey, nomark, plain; |
"-", |
noicon, nokey, nomark, plain |
} |
}; |
resource 'MENU' (mFile, preload) { |
mFile, textMenuProc, |
MenuItem1 | MenuItem12, /* enable Quit and New 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, |
NoItems, /* 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 |
} |
}; |
/* this ALRT and DITL are used as an About screen */ |
resource 'ALRT' (rAboutAlert) { |
{40, 20, 160, 292}, rAboutAlert, { |
OK, visible, silent; |
OK, visible, silent; |
OK, visible, silent; |
OK, visible, silent |
}; |
}; |
resource 'DITL' (rAboutAlert) { |
{ |
{88, 180, 108, 260}, |
Button { |
enabled, "OK" |
}; |
{8, 8, 24, 214}, |
StaticText { |
disabled, "GetZoneList" |
}; |
{32, 8, 48, 237}, |
StaticText { |
disabled, "© 1989-90 Apple Computer, Inc." |
}; |
{56, 8, 72, 136}, |
StaticText { |
disabled, "Brought to you by:" |
}; |
{80, 24, 112, 167}, |
StaticText { |
disabled, "Macintosh Developer " $"CA" "Technical Support" |
} |
} |
}; |
/* this DLOG and DITL are used for the Zone List dialog */ |
resource 'DLOG' (rZoneDialog) { |
{100, 100, 290, 400}, |
dBoxProc, |
invisible, |
noGoAway, |
0x0, |
rZoneDialog, |
"" |
}; |
resource 'DITL' (rZoneDialog) { |
{ |
{160, 220, 180, 280}, |
Button { |
enabled, |
"OK" |
}, |
{20, 20, 148, 280}, |
UserItem { |
enabled |
}, |
{160, 220, 180, 280}, |
UserItem { |
disabled |
} |
} |
}; |
/* this ALRT and DITL are used as an error screen */ |
resource 'ALRT' (rUserAlert, purgeable) { |
{40, 20, 180, 260}, |
rUserAlert, |
{ /* array: 4 elements */ |
/* [1] */ |
OK, visible, silent, |
/* [2] */ |
OK, visible, silent, |
/* [3] */ |
OK, visible, silent, |
/* [4] */ |
OK, visible, silent |
} |
}; |
resource 'DITL' (rUserAlert, purgeable) { |
{ /* array DITLarray: 4 elements */ |
/* [1] */ |
{110, 150, 130, 230}, |
Button { |
enabled, |
"OK" |
}, |
/* [2] */ |
{10, 60, 60, 230}, |
StaticText { |
disabled, |
"Error. ^0." |
}, |
/* [3] */ |
{70, 60, 90, 230}, |
StaticText { |
disabled, |
"^1" |
}, |
/* [4] */ |
{8, 8, 40, 40}, |
Icon { |
disabled, |
2 |
} |
} |
}; |
resource 'STR#' (sErrStrings, purgeable) { |
{ |
"An error occurred. The error number is: "; |
"You must run on 512Ke or later"; |
"Application Memory Size is too small"; |
"Not enough memory to run GetZoneList"; |
"An AppleTalk-related error occurred"; |
"There are no zones" |
} |
}; |
/* 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 note 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 |
}; |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14