/* * * Custom widget Demo * * File : DApplication.cpp * Purpose : Implement the application 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 #include #include #include /* * Method : cDApplication * Purpose : Constructor * Inputs : none * Output : none * Side Effects : none * */ cDApplication::cDApplication() : cApplication("hexaZen/Custom",0,0) { iWindow = NULL; if(!iFault) { // Create the object to read/write application settings iSettings = new cSettings("Custom"); if(!iSettings) iFault = kErrOutOfMemory; else iFault = iSettings->GetFault(); } else iSettings = NULL; } /* * Method : ~cDApplication * Purpose : Destructor * Inputs : none * Output : none * Side Effects : none * */ cDApplication::~cDApplication() { if(iSettings) { // save settings iSettings->Save(); delete iSettings; } // delete the window if(iWindow) delete iWindow; } /* * Method : Ready * Purpose : The application is running now * Inputs : none * Output : none * Side Effects : none * */ void cDApplication::Ready() { // load settings if(iSettings) iSettings->Load(); if(sArgs::Presents("s")) { // load the skin cDSkin lSkin(sArgs::Value("s")); if(lSkin.IsValid()) { // create & show window try { sCleanupStack::WindL(); iWindow = cDWindow::NewL(iSettings,lSkin); iWindow->Show(); sCleanupStack::UnWind(); } catch (uException &lException) { sEnv::PrintToStream("The exception \"%s\" was raised in %s\n", sEnv::ErrorToString(lException.iWhy),lException.iWhere); Quit(); sCleanupStack::UnWind(); } } else { sEnv::PrintToStream("Invalid skin\n"); Quit(); } } else { sEnv::PrintToStream("No skin given\n"); Quit(); } cApplication::Ready(); }