a legkisebb alkalmazás

36
A legkisebb alkalmazás Symbian OS C++ 3rd Edition Szabóné Nacsa Rozália

Upload: cleta

Post on 23-Feb-2016

39 views

Category:

Documents


0 download

DESCRIPTION

A legkisebb alkalmazás. Symbian OS C++ 3rd Edition Szabóné Nacsa Rozália. Fájlkiterjesztések. A fordítás és szerkesztés folyamata. . bmp. Bmp konverter. . „.h”. . rsg. . hrh. . rh. . rls. . rss. . bmp. . mbm. . rss. . cpp. C++ fordító. Erőforrás fordító. Bmp konverter. - PowerPoint PPT Presentation

TRANSCRIPT

A legkisebb alkalmazs

A legkisebb alkalmazsSymbian OS C++ 3rd EditionSzabn Nacsa Rozlia

Fjlkiterjesztsekbld.infProjektfjlokat felsorol llomny.mmpProjekt ler fjl.h, .cppHagyomnyos C++ fejls- s forrsfjlok.pkgA teleptshez szksges lers. A makesis bemenete.sisSymbian telept fjl. A makesis kimenete.aifApplikcis ler fjl.libAz sszeszerkeszts sorn a knyvtri rutinokat tartalmaz fjl.dllFuts kzben betlthet programknyvtr.exeFuttatha fjl.mbmTbb kpet tartalmaz fjl.mbgAz mbm fjlokban tallhat kpek programbl trtn hasznlathoz szksge konstansokat tartalmaz fejlcfjl.rssErforrs ler fjl.rhErforrsokban hasznlt struktrkat definil fejlcfjl.hrhErforrsokkal kapcsoltaos konstanso.rsgErforrsok azonosti.lrsA tmogatott nyelv(ek)-en megadott stringek listja

.h.rsg.hrh.rh.rls.cpp.rss.bmpC++ fordt.obj.lib.exe; .dllErforrs fordtBmp konverter.mbm.rss.bmpBmp konverterlinkerAif fordt.rsc.pkg.mbm.aifSis kszt.sisA fordts s szerkeszts folyamata

MVC mintaControllerModelViewmanagesrendersmanagesA Symbian alkalmazsok felptseApplicationAppView (V)DocumentModel (M)AppUi (C)createscreatescreates, managesrendersmanagesmanagescreates, managesA legkisebb GUI projekt rklsi diagramjaCBaseCApaApplicationAppDllUid()CApaDocumentCCoeAppUiCCoeControlDraw()CEikApplicationCreateDocumentL()CEikDocumentCreateAppUiL()CEikAppUiHandleCommandL()CCoeAppUiBaseCAknApplicationCAknDocumentCAknAppUiApplication architecture, Control environmentUikon (Eikon)Avkon (Series 60)Symbian OS UI alkalmazs architektra

CxxAppViewAlkalmazs indulsaAz alkalmazs indtsakor az egyes objektumok az albbi sorrendben jnnek ltre:application (CAknApplication)document (CAknDocument)UI controller (CAknAppUI) view (CCoeControl)

Az alkalmazs indulsaE32Main()NewApplicationCHelloWorldApplicationConstructL

CHelloWorldDocumentCHelloWorldAppUiBaseConstructL

AppDllUidAppDllUidCreateDocumentLNewL

ConstructLCreateAppUiLbld.inf

bld.infLegkisebb.mmpLegkisebb.mmp

Legkisebb.mmpLegkisebb.mmp

A .mmp fjl tartalma garfikus felleten is bellthat.Legkisebb.rss

Legkisebb.pan, .rls, .hrhLegkisebb.pan

Legkisebb.hrh

Legkisebb.rlsLegkisebb.cpp

Legkisebb.cpp

E32Main()LegkisebbApplication osztly

LegkisebbApplication.hLegkisebbApplication.cpp

LegkisebbAppDocument osztly - definciLegkisebbAppDocument.h

LegkisebbAppDocument osztly - implementciLegkisebbAppDocument.cpp

LegkisebbAppUi osztly - definciLegkisebbAppUi.h

LegkisebbAppUi osztly - implementciLegkisebbAppUi.cpp

LegkisebbAppView osztly - definciLegkisebbAppView.h

LegkisebbAppView osztly implementci 1.LegkisebbAppView.cpp

LegkisebbAppView osztly implementci 2.LegkisebbAppView.cpp

Carbide C++j projekt ltrehozsa

A projekt fjljai

A Legkisebb GUI alkalmazs Carbide C++

Fordts, fjlok

Futtats

VgePRJ_PLATFORMSDEFAULT

PRJ_MMPFILESLegkisebb.mmpTARGETLegkisebb_0x0CBFF1BD.exeTARGETTYPEexe

UID 0x100039CE 0x0CBFF1BD

SOURCEPATH ..\srcSOURCE Legkisebb.cpp LegkisebbApplication.cpp LegkisebbAppView.cpp LegkisebbDocument.cpp LegkisebbAppUi.cpp

USERINCLUDE ..\incCAPABILITY ReadUserData

SOURCEPATH ..\data

START RESOURCE Legkisebb.rssTARGET Legkisebb_0x0CBFF1BDTARGETPATH resource\appsHEADEREND

START RESOURCE Legkisebb_reg.rssTARGET Legkisebb_0x0CBFF1BD_regTARGETPATH \private\10003a3f\appsENDLANG SC

SECUREID 0x0CBFF1BDVENDORID 0

SYSTEMINCLUDE \epoc32\include

LIBRARY euser.lib apparc.lib cone.lib eikcore.lib avkon.lib commonengine.lib efsrv.lib estor.lib aknnotify.lib gdi.lib#ifndef LEGKISEBB_PAN_#define LEGKISEBB_PAN_

enum TLegkisebbPanics{ELegkisebbUi = 1};

inline void Panic(TLegkisebbPanics aReason){_LIT(applicationName, "Legkisebb-0x0CBFF1BD");User::Panic(applicationName, aReason);}

#endif /*LEGKISEBB_PAN_*/#define qtn_caption_string "Legkisebb 0x0CBFF1BD"#ifndef __LEGKISEBB_HRH__#define __LEGKISEBB_HRH__

#define _UID3 0x0CBFF1BD

#endif // __LEGKISEBB_HRH__// Caption string for app.#define qtn_caption_string "Legkisebb 0x0CBFF1BD"#include #include "LegkisebbApplication.h"

LOCAL_C CApaApplication* NewApplication(){return new CLegkisebbApplication;}

GLDEF_C TInt E32Main(){return EikStart::RunApplication( NewApplication );}#include #include "Legkisebb.hrh"

const TUid KUidLegkisebbApp ={_UID3};

class CLegkisebbApplication : public CAknApplication{public:TUid AppDllUid() const;

protected:CApaDocument* CreateDocumentL();};#include "Legkisebb.hrh"#include "LegkisebbDocument.h"#include "LegkisebbApplication.h"

CApaDocument* CLegkisebbApplication::CreateDocumentL(){return CLegkisebbDocument::NewL(*this);}

TUid CLegkisebbApplication::AppDllUid() const{return KUidLegkisebbApp;}#include

class CLegkisebbAppUi;class CEikApplication;

class CLegkisebbDocument : public CAknDocument{public:static CLegkisebbDocument* NewL(CEikApplication& aApp);static CLegkisebbDocument* NewLC(CEikApplication& aApp);virtual ~CLegkisebbDocument();

public:CEikAppUi* CreateAppUiL();

private:void ConstructL();CLegkisebbDocument(CEikApplication& aApp);

};#include "LegkisebbAppUi.h"#include "LegkisebbDocument.h"

CLegkisebbDocument* CLegkisebbDocument::NewL(CEikApplication& aApp){CLegkisebbDocument* self = NewLC(aApp);CleanupStack::Pop(self);return self;}

CLegkisebbDocument* CLegkisebbDocument::NewLC(CEikApplication& aApp){CLegkisebbDocument* self = new ( ELeave ) CLegkisebbDocument( aApp );CleanupStack::PushL(self);self->ConstructL();return self;}

void CLegkisebbDocument::ConstructL(){}

CLegkisebbDocument::CLegkisebbDocument(CEikApplication& aApp) :CAknDocument(aApp){}

CLegkisebbDocument::~CLegkisebbDocument(){}

CEikAppUi* CLegkisebbDocument::CreateAppUiL(){return new ( ELeave )CLegkisebbAppUi;}

#include

class CLegkisebbAppView;

class CLegkisebbAppUi : public CAknAppUi{public:void ConstructL();CLegkisebbAppUi();virtual ~CLegkisebbAppUi();private:void HandleCommandL(TInt aCommand);void HandleStatusPaneSizeChange();private:CLegkisebbAppView* iAppView;};void CLegkisebbAppUi::ConstructL(){BaseConstructL(CAknAppUi::EAknEnableSkin);iAppView = CLegkisebbAppView::NewL(ClientRect() );}

CLegkisebbAppUi::CLegkisebbAppUi(){}

CLegkisebbAppUi::~CLegkisebbAppUi(){if (iAppView){delete iAppView;iAppView = NULL;}}

void CLegkisebbAppUi::HandleCommandL(TInt aCommand){switch (aCommand){case EEikCmdExit:case EAknSoftkeyExit:Exit();break;default:Panic(ELegkisebbUi);break;}}

void CLegkisebbAppUi::HandleStatusPaneSizeChange(){iAppView->SetRect(ClientRect());}#include

#include #include #include

#include

#include "Legkisebb.hrh"#include "Legkisebb.pan"#include "LegkisebbApplication.h"#include "LegkisebbAppUi.h"#include "LegkisebbAppView.h"#include

class CLegkisebbAppView : public CCoeControl{public:static CLegkisebbAppView* NewL(const TRect& aRect);static CLegkisebbAppView* NewLC(const TRect& aRect);virtual ~CLegkisebbAppView();

public:void Draw(const TRect& aRect) const;virtual void SizeChanged();

private:void ConstructL(const TRect& aRect);CLegkisebbAppView();private:HBufC *iHelloMessage;

};CLegkisebbAppView* CLegkisebbAppView::NewL(const TRect& aRect){CLegkisebbAppView* self = CLegkisebbAppView::NewLC(aRect);CleanupStack::Pop(self);return self;}

CLegkisebbAppView* CLegkisebbAppView::NewLC(const TRect& aRect){CLegkisebbAppView* self = new ( ELeave ) CLegkisebbAppView;CleanupStack::PushL(self);self->ConstructL(aRect);return self;}

_LIT(KHelloMessage,"Hello Legkisebb!");

void CLegkisebbAppView::ConstructL(const TRect& aRect){CreateWindowL();SetRect(aRect);ActivateL();iHelloMessage=HBufC::NewL(30);*iHelloMessage=KHelloMessage;}CLegkisebbAppView::CLegkisebbAppView(){}

CLegkisebbAppView::~CLegkisebbAppView(){delete iHelloMessage;}#include #include #include #include "LegkisebbAppView.h"void CLegkisebbAppView::Draw(const TRect& /*aRect*/) const{CWindowGc& gc = SystemGc();TRect drawRect(Rect());gc.Clear(drawRect);drawRect.Shrink(10,10);gc.DrawRect(drawRect);const CFont* fontUsed = CEikonEnv::Static()->TitleFont();gc.UseFont(fontUsed);TInt baselineOffset = (drawRect.Height() + fontUsed->HeightInPixels())/2;gc.DrawText(*iHelloMessage,drawRect,baselineOffset,CGraphicsContext::ECenter,0);gc.DiscardFont();}

void CLegkisebbAppView::SizeChanged(){DrawNow();}