/* * * Blit * * File : DWindow.cpp * Purpose : Implement the window class * Author : JLV * Creation : 10/19/04 * Last Update : 10/28/04 * * (C) hexaZen 2004 * * This file is part of a demo application for Zinzala. It can be * used, distributed and modified without limitation. * * * $Id$ */ /* * $Log$ */ #include #include #include #include #include #include #include // Window beat rate const tUint32 kBeatRate = 150; /* * Method : cDWindow * Purpose : Constructor * Inputs : * * cSettings *aSettings, Application's settings * * Output : none * Side Effects : none * */ cDWindow::cDWindow(cSettings *aSettings) : cWindow(uRect(0,0),"window",eWinNormal,kFlgResizeToFit | kFlgNotResizable,kCurrentWorkspace) { iSettings = aSettings; iConsole = NULL; if(!iFault) { uPoint *lPos; SetTitle("Zinzala : Custom Widget Demo ..."); SetPadding(5,5); SetBGColor(kColorWhite); // Get position of the window is possible if(iSettings->HasItem("pos")) { iSettings->GetData("pos",eDataBuffer,(char **)&lPos,sizeof(uPoint)); MoveTo(*lPos); } } } /* * Method : ~cDWindow * Purpose : Destructor * Inputs : none * Output : none * Side Effects : none * */ cDWindow::~cDWindow() { } /* * Method : NewL * Purpose : Allocate and construct an object * Inputs : * * cSettings *aSettings, Application's settings * cDSkin &aSkin, Skin to use * * Output : CDWindow * * Side Effects : Can Leave * */ cDWindow *cDWindow::NewL(cSettings *aSettings,cDSkin &aSkin) { cDWindow *lWin = new cDWindow(aSettings); cDWindow::VerifyLC(lWin); lWin->ConstructL(aSkin); sCleanupStack::PopL(lWin); return lWin; } /* * Method : ConstructL * Purpose : 2nd phase constructor * Inputs : * * cDSkin &aSkin, Skin to use * * Output : none * Side Effects : Can Leave * */ void cDWindow::ConstructL(cDSkin &aSkin) { sEnv::LeaveIfError(iFault); iConsole = cMyConsoleView::NewL(aSkin); iConsole->AllowScripting(eLocal); AddChild(iConsole); } /* * Method : Ready * Purpose : Window is on screen and ready * Inputs : none * Output : none * Side Effects : none * */ void cDWindow::Ready() { SetBeatRate(kBeatRate); cWindow::Ready(); } /* * Method : CloseRequested * Purpose : The user requested the window to be closed * Inputs : none * Output : true * Side Effects : none * */ tBool cDWindow::CloseRequested() { // Store current position of the window in the settings uPoint pos = GetPosition(); iSettings->SetData("pos",eDataBuffer,(char *)&pos,sizeof(uPoint)); return true; }