xwords/xwords4/symbian/inc/xwappview.h

168 lines
4.7 KiB
C
Raw Normal View History

2005-01-04 15:34:36 +01:00
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
/*
* Copyright 2005 by Eric House (fixin@peak.org). (based on sample
* app helloworldbasic "Copyright (c) 2002, Nokia. All rights
* reserved.")
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _XWORDSAPPVIEW_H_
#define _XWORDSAPPVIEW_H_
#include <eikbctrl.h>
#include "game.h"
2005-01-08 19:12:26 +01:00
#include "memstream.h"
2005-01-04 15:34:36 +01:00
#include "symdraw.h"
2005-01-18 16:03:31 +01:00
#include "symgmmgr.h"
typedef enum {
EGamesLoc
,EDictsLoc
,EPrefsLoc
} TDriveReason;
2005-01-04 15:34:36 +01:00
/*!
@class CXWordsAppView
@discussion This is the main view for Crosswords. Owns all the
common-code-created objects, passes events to them, etc. Should be
the only sample code file modified to any significant degree.
*/
//class CXWordsAppView : public CEikBorderedControl // ( which : CCoeControl )
class CXWordsAppView : public CCoeControl
{
public:
/*!
@function NewL
@discussion Create a CXWordsAppView object, which will draw itself to aRect
@param aRect the rectangle this view will be drawn to
@result a pointer to the created instance of CXWordsAppView
*/
static CXWordsAppView* NewL(const TRect& aRect);
/*!
@function NewLC
@discussion Create a CXWordsAppView object, which will draw itself to aRect
@param aRect the rectangle this view will be drawn to
@result a pointer to the created instance of CXWordsAppView
*/
static CXWordsAppView* NewLC(const TRect& aRect);
/*!
@function ~CXWordsAppView
@discussion Destroy the object and release all memory objects
*/
~CXWordsAppView();
public: // from CEikBorderedControl
/*!
@function Draw
@discussion Draw this CXWordsAppView to the screen
@param aRect the rectangle of this view that needs updating
*/
void Draw(const TRect& aRect) const;
private:
/*!
@function ConstructL
@discussion Perform the second phase construction of a CXWordsAppView object
@param aRect the rectangle this view will be drawn to
*/
void ConstructL(const TRect& aRect);
/*!
@function CXWordsAppView
@discussion Perform the first phase of two phase construction
*/
CXWordsAppView();
/* Added by eeh */
public:
int HandleCommand( TInt aCommand );
2005-01-18 16:03:31 +01:00
void Exiting();
2005-01-04 15:34:36 +01:00
TBool HandleKeyEvent( const TKeyEvent& aKeyEvent );
2005-01-19 16:07:37 +01:00
void UserErrorFromID( TInt aResource );
XP_Bool UserQuery( UtilQueryID aId, XWStreamCtxt* aStream );
2005-01-04 15:34:36 +01:00
private:
/* open game from prefs or start a new one. */
2005-01-18 16:03:31 +01:00
void MakeOrLoadGameL();
2005-01-04 15:34:36 +01:00
void DeleteGame();
void SetUpUtil();
void PositionBoard();
2005-01-08 19:12:26 +01:00
void DisplayFinalScoresL();
XWStreamCtxt* MakeSimpleStream( MemStreamCloseCallback cb );
TBool AskFromResId( TInt aResource );
TBool FindAllDicts();
2005-01-18 16:03:31 +01:00
TBool LoadPrefs();
TBool AskSaveGame() { return ETrue; }
2005-01-13 03:08:35 +01:00
void SaveCurrentGame() {}
void NotImpl();
2005-01-18 16:03:31 +01:00
void GetXwordsRWDir( TFileName* aPathRef, TDriveReason aWhy );
void InitPrefs();
void WritePrefs();
void SaveCurGame();
void LoadOneGameL( TGameName* aGameName );
void StoreOneGameL( TGameName* aGameName );
TBool DoSavedGames();
TBool DoNewGame();
2005-01-20 03:42:51 +01:00
void DoImmediateDraw();
2005-01-13 03:08:35 +01:00
2005-01-04 15:34:36 +01:00
static void sym_util_requestTime( XW_UtilCtxt* uc );
static VTableMgr* sym_util_getVTManager( XW_UtilCtxt* uc );
static XP_U32 sym_util_getCurSeconds( XW_UtilCtxt* uc );
2005-01-08 19:12:26 +01:00
static void sym_util_notifyGameOverL( XW_UtilCtxt* uc );
static void sym_util_userError( XW_UtilCtxt* uc, UtilErrID id );
2005-01-18 16:03:31 +01:00
static DictionaryCtxt* sym_util_makeEmptyDict( XW_UtilCtxt* uc );
2005-01-04 15:34:36 +01:00
static TInt TimerCallback( TAny* aThis );
CurGameInfo iGi;
CommonPrefs iCp;
XW_UtilCtxt iUtil;
XWGame iGame;
DrawCtx* iDraw;
2005-01-18 16:03:31 +01:00
TGameName iCurGameName;
2005-01-04 15:34:36 +01:00
VTableMgr* iVtMgr;
TTime iStartTime;
TInt iTimerRunCount;
CIdle* iRequestTimer;
2005-01-18 16:03:31 +01:00
CXWGamesMgr* iGamesMgr;
CDesC16ArrayFlat* iDictList; /* to pass into the dialog */
2005-01-04 15:34:36 +01:00
MPSLOT
};
#endif // _XWORDSAPPVIEW_H_