// Text of project WhereInTheWorld written on 11/21/95 at 4:05 PM
// Beginning of file WhereInTheWorld Layout

// Before Script for "WhereInTheWorld"
// Copyright 1995 Apple Computer, Inc.
// Written by J. Christopher Bell


WhereInTheWorld :=
    {title: "WhereInTheWorld",
     viewBounds: {left: 0, top: 2, right: 236, bottom: 318},
     viewFormat: 83951953,
     startWith: 'world,
     debug: "WhereInTheWorld",
     _proto: @157
    };

pickers :=
    {viewBounds: {left: 0, top: 50, right: 0, bottom: 200},
     viewFlags: 513,
     viewFormat: 0,
     Select:
       func(symbol)
       	begin
       		world:close();
       		country:close();
       		state:close();
       		province:close();
       		self.(symbol):open();
       	end,
     viewSetupChildrenScript:
       func()
       	begin
       		// turn on visible bit of default value
       		self.(startWith).viewFlags := BOR(self.(startWith).viewFlags, vVisible);
       	end,
     viewJustify: 48,
     debug: "pickers",
     viewClass: 74
    };
AddStepForm(WhereInTheWorld, pickers);
StepDeclare(WhereInTheWorld, pickers, 'pickers);

world :=
    {viewBounds: {left: 0, top: 0, right: 0, bottom: 0},
     PickWorld:
       func(locInfo)
       	begin
       		if kDebugOn then print(locInfo);
       	
       		where:WeAreAt(locInfo.name);
       	end,
     viewJustify: 240,
     viewFlags: 545,
     autoClose: nil,
     debug: "world",
     _proto: @455
    };
AddStepForm(pickers, world);
StepDeclare(pickers, world, 'world);



country :=
    {viewBounds: {left: 0, top: 0, right: 0, bottom: 0},
     PickWorld:
       func(locInfo)
       	begin
       		if kDebugOn then print(locInfo);
       	
       		where:WeAreAt(locInfo.name);
       	end,
     viewJustify: 240,
     viewFlags: 544,
     autoClose: nil,
     debug: "country",
     _proto: @458
    };
AddStepForm(pickers, country);
StepDeclare(pickers, country, 'country);



state :=
    {viewBounds: {left: 0, top: 0, right: 0, bottom: 0},
     PickWorld:
       func(locInfo)
       	begin
       		if kDebugOn then print(locInfo);
       	
       		where:WeAreAt(locInfo.name);
       	end,
     viewJustify: 240,
     viewFlags: 544,
     autoClose: nil,
     debug: "state",
     _proto: @456
    };
AddStepForm(pickers, state);
StepDeclare(pickers, state, 'state);



province :=
    {viewBounds: {left: 0, top: 0, right: 0, bottom: 0},
     PickWorld:
       func(locInfo)
       	begin
       		if kDebugOn then print(locInfo);
       	
       		where:WeAreAt(locInfo.name);
       	end,
     viewJustify: 240,
     viewFlags: 544,
     autoClose: nil,
     debug: "province"
     ,
     _proto: @457
    };
AddStepForm(pickers, province);
StepDeclare(pickers, province, 'province);





popit :=
    {viewBounds: {left: 0, top: 220, right: 40, bottom: 233},
     viewFlags: 515,
     text:
       nil // set to appropriate item by viewSetupFormScript based on startWith in base
       ,
     pickActionScript:
       func(itemSelected)
       begin
       	// determine the symbol identifying the view to display
       	local viewSymbol := popup[itemSelected].value;
       
       	pickers:Select(viewSymbol);
       
       	inherited:?pickActionScript(itemSelected);		// this method is defined internally
       end,
     popup:
       [
       	{item: "World", 	value: 'world}, 
       	{item: "Country", 	value: 'country},
       	{item: "State", 	value: 'state},
       	{item: "Province",	value: 'province}
       ],
     viewJustify: 22,
     viewSetupFormScript:
       func()
       begin
       	if not text then
       		foreach item in popup do
       			if item.value = startWith then
       				text := item.item;	// set initial value based on 'startWith slot (in base view)
       	inherited:?viewSetupFormScript();		// this method is defined internally
       end,
     debug: "popit",
     _proto: @377
    };
AddStepForm(WhereInTheWorld, popit);



where :=
    {text: "Where in the world is… <tap on the map>",
     viewBounds: {left: 2, top: 256, right: -2, bottom: 288},
     WeAreAt:
       func(dest)
       	begin
       		SetValue(self, 'text, "Where in the world is " & dest & "?");
       	end,
     viewJustify: 8388662,
     debug: "where",
     _proto: @218
    };
AddStepForm(WhereInTheWorld, where);
StepDeclare(WhereInTheWorld, where, 'where);




constant |layout_WhereInTheWorld Layout| := WhereInTheWorld;
// End of file WhereInTheWorld Layout



