// Copyright 2001-2005, 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/

package com.example.GUIDemo;

import danger.app.Application;
import danger.ui.ScreenWindow;

/**
 * This application demonstrates how to use every user interface screen, window
 * and widget that are available in the Danger APIs.  It is a comprehensive list.
 * Items left out were specifically avoided because they were abstract classes,
 * a class that is not expected to be used, or was a class that had bugs preventing
 * it from working correctly.
 * 
 * Every item that can be created via Resources is represented, and is the preferred 
 * choice for using those widgets.  For items that do not have resource definitions
 * there is the other half of the program, where the widgets are created dynamically
 * at runtime.
 * 
 * Not every possible item has been shown because some are mutually exclusive, and 
 * there are simply too many possibilities to show reasonably. In general, the effort
 * was to try show at least one example of every field and option use, so search 
 * for the object or option in question to see if it is represented.
 * 
 * This program thus shows two important things:
 * 1) How to create and use any UI widget, including the resource definition and the
 * 	code necessary to activate it.
 * 2) A visual example of each UI widget, in order to show everything that can be done.
 * 
 * The program also implements a left/right shoulder button navigation, so that it is
 * possible to skim through all items quickly.
 * 
 * There are four classes that show how to fetch the end result of the dialog, rather
 * than just showing how to create them.  Not all classes were done, to avoid making
 * the program overly large and complex.  This approach can be used for any item. 
 * The four classes are: 
 * 		NumberEditor, PasswordEditText, RingTonePicker, TextInputAlertWindow.
 */

/**
 * Implements the main application class.
 */
public class GUIDemo extends Application implements Resources, Commands {
	private ScreenWindow mProgWindow;

	private ScreenWindow mResWindow;

	// * -------------------- GUIDemo

	/**
	 * Creates the main application class.
	 */
	public GUIDemo() {
		// Create the application's windows from resources.
		mProgWindow = (ScreenWindow) getResources().getScreen(
				ID_PROGRAMBASED_SCREEN);
		mResWindow = (ScreenWindow) getResources().getScreen(
				ID_RESOURCEBASED_SCREEN);

		// Start on the resource side to encourage resource usage.
		mResWindow.show();
	}

	/**
	 * Utility routines to allow easy switching between the two main halves of
	 * the program. This way the other objects merely need to know how to get
	 * ahold of the application to switch.
	 */
	public void showProgWindow() {
		mProgWindow.show();
	}

	public void showResWindow() {
		mResWindow.show();
	}
}
