beautypg.com

Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 715

background image

C H A P T E R 1 9

Built-in Applications and System Data

Icons and the Extras Drawer

19-41

InstallScript := func (partFrame)

begin

local ed

:= GetRoot().extrasDrawer;

local iStore

:= GetStores()[0];

//check if our icon is already installed

if Length (ed:GetExtraIcons ('soupEntry,

kSoupPackageName, iStore)) = 0 then

call kAddExtraIconFunc with

('soupEntry,

{

//soups we are combining

soupNames: kMySoupNamesArray,

//title shown under the icon

text : kMySoupUserName,

//for the soupervisor mechanism

ownerApp : kAppSymbol,

//for access via SetExtrasInfo

app : kSoupPackageName,

}

//Note, we do not use kPackageName since

//we don’t want the icon moved when the

//package is moved.

kSoupPackageName,

iStore);

end;

The Extras Drawer method

GetExtraIcons

used in the above code to obtain an

array of soup icons that match the package name is described in

GetExtraIcons

(page 16-90) in Newton Programmer’s Reference.

Removing a Soup Icon

19

Use the Extras Drawer method

RemoveExtraIcon

to remove your soup icon, as

in the following code:

//A good place for this would be in a DeletionScript

local ed := GetRoot().extrasDrawer;

foreach icon in ed:GetExtraIcons ('soupEntry,

kSoupPackageName, GetStores()[0]) do

ed:RemoveExtraIcon (icon);