// BOSSENX.H
//
// Copyright (c) 1998 Symbian Ltd.  All rights reserved.
//
#if !defined(__BOSSENX_H__)
#define __BOSSENX_H__

#include <e32base.h>
#include <oplapi.h>
#include <opx.h>
#include "bosseng.h"


// OPL boolean constants

	const TInt16 KTrue = -1;
	const TInt16 KFalse = 0;

// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// The OPX's UID as used in the DECLARE OPX statement for your OPX
// NB. This UID must be reserved by contacting Symbian Ltd
//
const TInt KUidOpxBossEnxValue=0x100002A2;

const TUid KUidOpxBossEnx={KUidOpxBossEnxValue};

// The OPX's version number as used in the DECLARE OPX statement for your OPX
const TInt KOpxBossEnxVersion=0x100;


// The root class of the OPX - add any members and/or component classes
// that your particular OPX requires to this class
//
// An instance of this class is created immediately after the OPX is loaded (using LOADM)
// and the object pointer must be stored in the Tls (Thread local static).
// See the 1st EXPORT function NewOpxL(), which does this for you.
// The Tls contains the single global (32-bit) value available to any EPOC32 DLL.
// No other non-const static data may be used.
//
class CBossEnx : public COpxBase 
    {
public:
    static CBossEnx* NewL(OplAPI& aOplAPI);
	virtual void RunL(TInt aProcNum);
	virtual TInt CheckVersion(TInt aVersion);
	// Add any other members specific to your OPX
	// ...    

private:
	// OPL constants

	// the language extension procedures

	enum TExtensions
		{	
		ESetFullyOrdered = 1,
		ESetBossOrdered,
		EIsFullyOrdered,
		EIsBlank,
		ETile,
		ELocateTile,
		ELocateBlank,
		ECanMove,
		ECanMoveFrom,
		ECanMoveType,
		EMove,
		EMoveFrom
		};
	
	// from TBossPuzzle
	// initialize state

	
	void SetFullyOrdered();		// OPL procedure	SetFullyOrdered:
	void SetBossOrdered(); // 14 and 15 swapped		OPL procedure	SetBossOrdered
	// OPL procedure	IsFullyOrdered%: 
	void IsFullyOrdered() const;
	
	// OPL procedure	IsBlank%:(row&, col&) 
	void IsBlank() const;
	
	// OPL procedure	Tile&:(row&, col&) 
	void Tile();
	
	// OPL procedure	LocateTile:(tileNumber&,BYREF row&,BYREF col&) 
	void LocateTile() ;
	
	// OPL procedure	LocateBlank: (BYREF row&, BYREF col&): 
	void LocateBlank() ;
	// whether various moves are possible
	
	// OPL procedure	CanMove%:(move%) 
	void CanMove() ;
	
	// OPL procedure	CanMoveFrom%:(row&, col&) 
	void CanMoveFrom() ;
	
	// OPL procedure	CanMoveType%:(row&, col&) 
	void CanMoveType() ;
	// moving - these functions panic if impossible
	
	// OPL procedure	Move:(move%) 
	void Move();
	
	// OPL procedure	MoveFrom:(row&, col&) 
	void MoveFrom();
private:
	void ConstructL();
    CBossEnx(OplAPI& aOplAPI);
    ~CBossEnx() ;
private:
	TBossPuzzle iBossPuzzle;
    };



// BossEnx() accesses the Tls which contains the CBossEnx*, created and stored there by NewOpxL()
//
// BossEnx() is only required if you need to access your CBossEnx object
// in a deeply nested function which hasn't been passed this pointer directly
// Note that accessing the Tls in this way is relatively slow (about 4 microsecs) so
// it is often more efficient to pass the CBossEnx* down the chain of functions.
inline CBossEnx* BossEnx() { return((CBossEnx *)Dll::Tls()); }

    
#endif __BOSSENX_H__
