/******************************************************************************
FILE:  WhiteBoard.h

SERVICES:  AEE WhiteBoard Drawing example application

GENERAL DESCRIPTION:
  WhiteBoard is drawing program which allows the user to render simple
  geometric shapes to the phone's display.  The user can select shapes,
  set their border, and in some cases, their fill color.  A cursor is
  used to plot points on the screen which are used to draw the selected
  geometric shape.

  This is a sample application to be used as a model by developers in
  developing BREW applications.  The application demonstrates proper
  initialization and freeing of application objects and resources, 
  event handling and GUI development.

  Several BREW API interfaces are demonstrated by the application.  These
  include the interfaces for IGraphics, IBitmap, and IDisplay.  A custom
  control CRGBCtl is also implemented to demonstrate the development
  of controls with application specific functionality.

PUBLIC CLASSES AND STATIC FUNCTIONS:
	Classes:
    IBitmap
    IGraphics
    IDisplay
    IMenuCtl
    IStatic
    IFile

INITIALIZATION & SEQUENCING REQUIREMENTS:

	See Exported Routines

       Copyright © 2002 QUALCOMM Incorporated.
               All Rights Reserved.
            QUALCOMM Proprietary/GTDR
******************************************************************************/

#ifndef WHITEBOARD_H
#define WHITEBOARD_H

//*****************************************************************************
// INCLUDE FILES
//*****************************************************************************

#include "AEEAppGen.h"
#include "AEEFile.h"
#include "AEEGraphics.h"
#include "AEEMenu.h"
#include "AEEStdLib.h"
#include "WhiteBoard.bid"
#include "WhiteBoard.brh"
#include "WB_RGBCtl.h"

//*****************************************************************************
// DEFINITIONS
//*****************************************************************************

#define WHITEBOARD_HELP_FILE           "help.txt"  // The name of the application help file
#define WHITEBOARD_MIF_FILE      "whiteboard.mif"  // The name of the application MIF file

#define MAIN_MENU_HEIGHT                      44   // The height of the Main Menu control
#define MAX_RES_STRING_BUF_SIZE               200  // Used for allocating resource string buffers
#define SCROLLBAR_HEIGHT                      5    // The pixel height of the horizontal scroll bar
#define SPLASH_TIMER_DURATION                 750  // Number of milliseconds the splash screen is displayed
#define VERTEX_BLINK_TIMER_DURATION           300  // The number of milliseconds for the vertex blink rate
#define MAX_NUM_POINTS                        100  // Max number of points the user can specify on the drawing screen
#define PEN_SIZE                              5    // The height/width of the pen crosshairs

// Define the number of point values for the shapes supported by the application.

#define NUM_POINTS_2                          2
#define NUM_POINTS_3                          3
#define NUM_POINTS_VARIABLE                   -1

// Constant values for the List control items for the Mode control

// Utility Macros

#define ABS_VALUE( x ) ( (x) >= 0 ? (x) : (x) * -1 )  // Return the absolute value of x

//*****************************************************************************
// ENUMERATED TYPE DEFINITIONS
//*****************************************************************************

// The application state machine values

typedef enum
{
  APP_STATE_START,
  APP_STATE_MAIN_MENU,
  APP_STATE_DRAW,
  APP_STATE_OPTIONS_MENU,
  APP_STATE_SHAPES_MENU,
  APP_STATE_COLORS_MENU,
  APP_STATE_LINES_MENU,
  APP_STATE_FILLED_SHAPES_MENU,
  APP_STATE_UNFILLED_SHAPES_MENU,
  APP_STATE_HELP,
  APP_STATE_ABOUT

} EAppStateType;

// The state of the pen (used in calls to WB_UpdatePenPosition function)

typedef enum
{
  PEN_UP,    // Moves pen up
  PEN_DOWN,  // Moves pen down
  PEN_LEFT,  // Moves pen left
  PEN_RIGHT, // Moves pen right
  PEN_SHOW   // Draws pen at current pen location

} EPenDirectionType;

//*****************************************************************************
// GLOBAL APPLICATION DATA STRUCTURES
//*****************************************************************************

// All the data and GUI object pointers need for controls that are not
// defines in the application's resource file

typedef struct _CWhiteBoardApp
{
  AEEApplet               a;                        // Manditory AEEApplet data member appears first

  EAppStateType           m_eAppState;              // Represents the current application state
  int                     m_nFontHeight;            // The height of the AEE_FONT_BOLD font
  AEERect                 m_rScreenRect;            // Rectangle coordinates of the screen minus the titlebar
  uint16                  m_nScreenColorDepth;      // The number of color bits of the device display
  AEERect                 m_rTitleBarRect;          // The rectangle coordinates of the titlebar
  uint16                  m_nShapeType;             // The currently selected drawing shape
  uint16                  m_nShapeTypeBeforeClip;   // Stores the current drawing shape during clipping
  flg                     m_bFillShape:1;           // Indicates if the currently selected shape is to be filled
  flg                     m_bBlinkMode:1;           // Indicates if the WB_UpdateVertexDisplay shows or hides the verticies (causes the pixels to blink)

  IBitmap*                m_pSuspendBitmap;         // This is used to store the display on an EVT_APP_RESUME event.
  IImage*                 m_pTitleBarImage;         // Pointer to the application titlebar image

  IMenuCtl*               m_pModeCtl;               // An IMenuCtl object used to select the color mode
  IMenuCtl*               m_pColorCtl;              // An IMenuCtl object used to select the color for 1,2 & 4 bit screens
  CRGBCtl*                m_pRGBRedCtl;             // An custom control used to select the Red color for 8 and 24 bit screens
  CRGBCtl*                m_pRGBGreenCtl;           // An custom control used to select the Green color for 8 and 24 bit screens
  CRGBCtl*                m_pRGBBlueCtl;            // An custom control used to select the Blue color for 8 and 24 bit screens

  IStatic*                m_pMainTextCtl;           // An IStatic which displays text information for the Help & Abount screens
  IMenuCtl*               m_pIconViewCtl;           // An Icon List control used to select various drawing shapes and screens
  IMenuCtl*               m_pSoftKeyCtl;            // A Soft Key control used for selecting various screen options

  IGraphics*              m_pGraphics;              // Pointer to the application IGraphics object
  IBitmap*                m_pBitmap;                // Pointer to the IBitmap drawing canvas

  uint16                  m_nDrawIconID;            // The ID of the current icon displayed in the Draw button of the Main Menu.

  uint8                   m_nFillColor;             // Indicates the current selected Color RGB fill value for 1, 2, & 4 bit screens
  uint8                   m_nBorderColor;           // Indicates the current selected Color RGB border value for 1, 2, & 4 bit screens

  AEERect                 m_rHScrollBarRect;        // An AEERect containing the dimesions of the horizontal scroll bar

  AEEPoint                m_pPointList[ MAX_NUM_POINTS ];  // The list of pointes specified by the user on the drawing screen
  uint16                  m_nNumPoints;             // The number of points currently specified by the user on the drawing screen
  AEEPoint                m_rPenLoc;                // The x,y coordinates of the current drawing pen position
  uint16                  m_nPenStepSize;           // The number of pixels the pen travels each time one of the direction keys is pressed
  AEERect                 m_rViewportRect;          // The rectangle of the drawing viewport
  int16                   m_nWindowXOrigin;         // The starting X coordinate of the canvas displayed in left most pixel of the viewport
  uint16                  m_nBitmapWidth;           // The width of the drawing canvas
  int16                   m_pShapeInfo[ IDC_MAX_SHAPES ];  // indicates the number of points required to specify the parameters of a specific shape

} CWhiteBoardApp;


#endif
