// BOSS.H
//
// Copyright (c) 1998 Symbian Ltd.  All rights reserved.
//

#ifndef __BOSS2_H
#define __BOSS2_H

#include <coecntrl.h>
#include <coeccntx.h>

#include <eikappui.h>
#include <eikapp.h>
#include <eikdoc.h>

#include "bossview.h"
#include "bosseng.h"

// UID of app

const TUid KUidBossApp= { 0x10000253 } ;

//
// class CBossAppView
//

class CBossAppView : public CCoeControl, public MCoeControlBrushContext
    {
public:
    void ConstructL(const TRect& aRect, TBossPuzzle* aModel);
    ~CBossAppView();
	// changing view
	void ConstructViewL();
	// various types of update
	void Move(TBossPuzzle::TMoveType aMoveType);
	void SetFullyOrdered();
	void SetBossOrdered();
private: // from CCoeControl
	void Draw(const TRect& /*aRect*/) const;
	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
    TInt CountComponentControls() const;
    CCoeControl* ComponentControl(TInt aIndex) const;
private: // phased update stuff
public: // also from MGraphicsExampleObserver
	void NotifyStatus(const TDesC& aMessage);
private: // new function
	void CreateLabelL();
private: // data
	CBossView* iView; // view of boss puzzle
	CEikLabel* iLabel; // label for status messages
	TBossPuzzle* iModel; // model we're working with
    };

//
// CBossAppUi
//

class CBossAppUi : public CEikAppUi
    {
public:
    void ConstructL();
	~CBossAppUi();
private: // from CEikAppUi
	void HandleCommandL(TInt aCommand);
	TBool ProcessCommandParametersL(TApaCommand aCommand,TFileName& aDocumentName,const TDesC& aTail);
	void HandleModelChangeL();
private:
    CBossAppView* iAppView;
	TBossPuzzle* iModel;
    };

//
// CBossDocument
//

class CBossDocument : public CEikDocument
	{
public:
	CBossDocument(CEikApplication& aApp): CEikDocument(aApp) { }
	TBossPuzzle* Model() { return(&iModel); }
private: // from CEikDocument
	CEikAppUi* CreateAppUiL();
private: // from CApaDocument
	void StoreL(CStreamStore& aStore,CStreamDictionary& aStreamDic) const;
	void RestoreL(const CStreamStore& aStore,const CStreamDictionary& aStreamDic);
private:
	TBossPuzzle iModel;
	};

//
// CBossApplication
//

class CBossApplication : public CEikApplication
	{
private: // from CApaApplication
	CApaDocument* CreateDocumentL();
	TUid AppDllUid() const;
	};

#endif
