# -*- coding: utf-8 -*-

# Copyright 2001-2003, Danger, Inc.  All Rights Reserved.
# This file is subject to the Danger, Inc. Sample Code License,
# which is provided in the file SAMPLE_CODE_LICENSE.
# Copies are also available from http://developer.danger.com/


#---------------------------------------------------------------------
# This resource file is incomplete for a standard Danger Application,
# because this sample program's purpose is to demonstrate how to use the
# SettingsDB.  To see all of the assets and resources necessary for
# a regular application, please see the HelloWorld/Template application.
#
# In particular, this sample specifically excludes SplashScreen resources
# both Large and Small application Icons, and the associated bitmaps.
# It will run correctly, but will not be as pretty as a shipping app.
#
# Please use the HelloWorld application as a Template application which
# contains everything necessary to be a proper app.
#
# There are a number of resource IDs defined here, which are not used
# by the application code itself.  To simplify the generated Resources.java
# file, the unused ones are preceded with an underbar, so that they 
# will only be used in this file.  e.g. CNTRL_ID_HIGHSCORE becomes
# _CNTRL_ID_HIGHSCORE to avoid exporting to Resources.java.
#---------------------------------------------------------------------


package "com.example.SettingsDemo"

interface "{source}/com/example/SettingsDemo/Resources.java"
events "{source}/com/example/SettingsDemo/Commands.java"

#---------------------------------------------------------------------
# Class ID
#---------------------------------------------------------------------
string ID_APP_CLASS "com.example.SettingsDemo.SettingsDemo"

#---------------------------------------------------------------------
# helloworld Application Name
#---------------------------------------------------------------------
string ID_APP_NAME "SettingsDemo"

#---------------------------------------------------------------------
# App I18N Locale String
#---------------------------------------------------------------------
string ID_LOCALE    "en_US"

#---------------------------------------------------------------------
# Submenu for General Settings, leading to the SettingsScreen window.
#---------------------------------------------------------------------
menu _ID_MENU_SETTINGS_WINDOW

	# The soundIcon is added here because the Settings dialog includes
	# a RingTonePicker.  If the settings does not involve sound, the
	# icon should be excluded.  
	# Under 1.1, the icon does not show up, but causes no problems.
	menuItem
		title = "General"
		icon = soundIcon
		event = EVENT_GENERAL_SETTINGS
		id = _ID_MENU_GENERAL_SETTINGS
endMenu

#---------------------------------------------------------------------
# SettingsDemo MainWindow menu
#---------------------------------------------------------------------
menu _ID_MENU_SETTINGS_DEMO

	menuItem
		title = "Settings"
		subMenu = _ID_MENU_SETTINGS_WINDOW

	divider
	
	menuItem 
		title = "Score 1000"
		id = _ID_MENU_SCORE_1000
		event = EVENT_SCORE_1000
		shortcut = '1'
		
	menuItem
		title = "Score 2000"
		id = _ID_MENU_SCORE_2000
		event = EVENT_SCORE_2000
		shortcut ='2'
endMenu

#---------------------------------------------------------------------
#			MainWindow Screen
# The primary window for the App, which shows the current Settings state.
# Created using DRE.  
#---------------------------------------------------------------------
screen ID_MAIN_SCREEN

	title = "SettingsDemo..."
	className = "MainWindow"
	actionMenu = _ID_MENU_SETTINGS_DEMO

	staticText
		text = "High Score:"
		id = _CNTRL_ID_HIGHSCORE
		alignWithParentLeft = 0
		alignWithParentTop = 5
		justifyLeft
		font = boldSysFont

	staticText
		text = "Score Text"
		id = ID_HIGHSCORE
		justifyLeft
		positionToRight = _CNTRL_ID_HIGHSCORE : 3
		alignBottom = _CNTRL_ID_HIGHSCORE

	staticText
		text = "Checkbox 1:"
		id = _CNTRL_ID_1
		positionBelow = _CNTRL_ID_HIGHSCORE : 12
		justifyLeft
		left = 15
		font = boldSysFont

	staticText
		text = "cb1 state"
		id = ID_CHECKSTATE_1
		justifyLeft
		positionToRight = _CNTRL_ID_1 : 3
		alignBottom = _CNTRL_ID_1

	staticText
		text = "Checkbox 2:"
		id = _CNTRL_ID_2
		positionBelow = _CNTRL_ID_1 : 2
		justifyLeft
		alignLeft = _CNTRL_ID_1
		font = boldSysFont

	staticText
		text = "cb2 state"
		id = ID_CHECKSTATE_2
		justifyLeft
		positionToRight = _CNTRL_ID_2 : 3
		alignBottom = _CNTRL_ID_2

	staticText
		text = "Checkbox 3:"
		id = _CNTRL_ID_3
		positionBelow = _CNTRL_ID_2 : 2
		justifyLeft
		alignLeft = _CNTRL_ID_2
		font = boldSysFont

	staticText
		text = "cb3 state"
		id = ID_CHECKSTATE_3
		justifyLeft
		positionToRight = _CNTRL_ID_3 : 3
		alignBottom = _CNTRL_ID_3

	staticText
		text = "Checkbox 4:"
		id = _CNTRL_ID_4
		positionBelow = _CNTRL_ID_3 : 2
		justifyLeft
		font = boldSysFont
		alignLeft = _CNTRL_ID_3

	staticText
		text = "cb4 state"
		id = ID_CHECKSTATE_4
		justifyLeft
		positionToRight = _CNTRL_ID_4 : 3
		alignBottom = _CNTRL_ID_4

	staticText
		text = "RadioGroup:"
		id = _CNTRL_ID_RADIOGROUP
		positionBelow = _CNTRL_ID_4 : 2
		justifyLeft
		font = boldSysFont
		alignLeft = _CNTRL_ID_4

	staticText
		text = "radio state"
		id = ID_RADIO_STATE
		justifyLeft
		positionToRight = _CNTRL_ID_RADIOGROUP : 3
		alignBottom = _CNTRL_ID_RADIOGROUP

	staticText
		text = "RingTone: "
		id = _CNTRL_ID_RINGTONEPICKER
		positionBelow = _CNTRL_ID_RADIOGROUP : 2
		justifyLeft
		font = boldSysFont
		alignLeft = _CNTRL_ID_RADIOGROUP

	staticText
		text = "ring state"
		id = ID_RINGTONE_STATE
		justifyLeft
		positionToRight = _CNTRL_ID_RINGTONEPICKER : 3
		alignBottom = _CNTRL_ID_RINGTONEPICKER
		widthPct = 100

	staticText
		text = "Edit Text:"
		id = _CNTRL_ID_EDITTEXT
		positionBelow = _CNTRL_ID_RINGTONEPICKER : 2
		justifyLeft
		font = boldSysFont
		alignLeft = _CNTRL_ID_RINGTONEPICKER

	staticText
		text = "edit text"
		id = ID_EDITTEXT_STATE
		justifyLeft
		positionToRight = _CNTRL_ID_EDITTEXT : 3
		alignBottom = _CNTRL_ID_EDITTEXT
		fillToBottom = 10
		widthPct = 100
endScreen

#---------------------------------------------------------------------
#			Settings Screen
# This is the Settings dialog itself, with associated widgets.
#
# It is OK to edit this file directly.  However, it was developed using 
# DRE, and for UI creation DRE is generally simpler.
#---------------------------------------------------------------------
screen ID_SETTINGS_SCREEN

	title = "Settings"
#	icon = _ID_SMALL_ICON			Unused here, to simplify the sample.
	className = "SettingsScreen"

	scrollView
		alignWithParentLeft = 0
		alignWithParentTop = 0
		widthPct = 100
		heightPct = 100
		
		roundRectContainer
			id = _ID_BATTERY_BOX_GROUP
			alignWithParentTop = 2
			alignWithParentLeft = 2
			fillToRight = 3
			height = 22
			doesNotAcceptFocus

			staticText
				text = "Some Icons:"
				id = _ID_ICONTEXT
				justifyLeft
				alignWithParentTop = 5
				font = sysFont
				alignWithParentLeft = 5

			batteryStatusView
				id = _ID_BATTERY
				alignWithParentTop = 5
				positionToRight = _ID_ICONTEXT : 4
				doesNotAcceptFocus

			radioStatusView
				id = _ID_RADIOSTATUS
				positionToRight = _ID_BATTERY : 8
				alignWithParentTop = 5
				doesNotAcceptFocus

			staticText
				text = "Oval Shape:"
				id = _ID_OVAL_TEXT
				justifyLeft
				positionToRight = _ID_RADIOSTATUS : 15
				alignWithParentTop = 5
				doesNotAcceptFocus

			shape
				height = 10
				id = _ID_OVALSHAPE
				type = oval
				positionToRight = _ID_OVAL_TEXT : 3
				width = 10
				alignWithParentTop = 5
				fillColor = defaultFrameColor
				doesNotAcceptFocus
		endRoundRectContainer

		checkBoxGroup
			id = _ID_CHECKBOX_GROUP
			positionBelow = _ID_BATTERY_BOX_GROUP : 3
			title = "Group of Checkboxes"
			alignWithParentLeft = 3
			acceptsFocus
			initialFocus

			checkBox
				title = "Checkbox 1"
				checked
				id = ID_CHECKBOX_1

			checkBox
				title = "Checkbox 2"
				id = ID_CHECKBOX_2

			checkBox
				title = "Checkbox 3"
				id = ID_CHECKBOX_3

			checkBox
				title = "Checkbox 4"
				id = ID_CHECKBOX_4
		endCheckBoxGroup

		image
			positionBelow = _ID_BATTERY_BOX_GROUP : 5
			positionToRight = _ID_CHECKBOX_GROUP : 8
			bitmap = stopIcon
			doesNotAcceptFocus
			width = 50
			height = 50
			hasBorder

		radioButtonGroup
			id = ID_RADIOBUTTON_GROUP
			positionBelow = _ID_CHECKBOX_GROUP : 3
			title = "Radio Buttons"
			alignWithParentLeft = 3
			fillToRight = 3

			radioButton
				title = "Radio 1"

			radioButton
				title = "Radio 2"

			radioButton
				title = "Radio 3"
		endRadioButtonGroup

		ringTonePicker
			id = ID_RINGTONE_PICKER
			positionBelow = ID_RADIOBUTTON_GROUP : 5
			title = "RingTone Picker"
			widthPct = 50

		staticTextBox
			text = "Static Text Box, not selectable."
			fillToRight = 5
			id = _ID_STATICTEXT_BOX
			positionBelow = ID_RINGTONE_PICKER : 5
			justifyLeft
			doesNotAcceptFocus
			title = "Static"
			alignWithParentLeft = 3
			height = 25

		editText
			fillToRight = 5
			id = ID_EDITTEXT
			positionBelow = _ID_STATICTEXT_BOX : 3
			justifyLeft
			initialText = "Editable Text.  Accepts\nmultiple lines."
			title = "Editable"
			alignWithParentLeft = 3
			height = 33
	endScrollView
endScreen

#---------------------------------------------------------------------
# Delete All Alert
# To reset the DB back to a zero state. For debugging purposes.
#---------------------------------------------------------------------
alert ID_DELETE_ALL_ALERT

	title = "Delete All Settings?"
	text = "Permanently discard all saved settings?"
	icon = trashIcon
	appAlertStyle

	button
		position = buttonBottom1
		title = cancelButton
		shortcut = doneButton		// under 1.1 it's an X, otherwise it's Check.
		defaultButton

	button
		position = buttonBottom2
		title = "Delete All"
		id = _ID_DELETE_ALL_OK
		eventListener = application
		event = EVENT_DELETE_ALL_OK
endAlert

