javauis/coreui_akn/src/javauiavkonimpl.h
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Classes for creating the Avkon based UI framework.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef JAVAUIAVKONIMPL_H
       
    19 #define JAVAUIAVKONIMPL_H
       
    20 
       
    21 // Includes
       
    22 #include <aknapp.h>
       
    23 #include <AknDoc.h>
       
    24 #include <aknappui.h>
       
    25 
       
    26 #include "coreuiappui.h"
       
    27 #include "coreuiavkonimpl.h"
       
    28 
       
    29 // Forward declaration
       
    30 class CEikonEnv;
       
    31 class CApaWindowGroupName;
       
    32 class CStartScreenContainer;
       
    33 
       
    34 namespace java // codescanner::namespace
       
    35 {
       
    36 namespace ui // codescanner::namespace
       
    37 {
       
    38 
       
    39 class JavaUiAvkonAppUi;
       
    40 class JavaUiAvkon;
       
    41 
       
    42 NONSHARABLE_CLASS(JavaUiAvkonAppUi) : public CAknAppUi, public CoreUiAvkonAppUi
       
    43 {
       
    44 public:
       
    45     JavaUiAvkonAppUi();
       
    46     virtual ~JavaUiAvkonAppUi();
       
    47     /**
       
    48      * Called by the Avkon framework.
       
    49      * @see CAknAppUi::ConstructL.
       
    50      */
       
    51     void ConstructL();
       
    52 
       
    53     /**
       
    54      * @see CAknAppUi::HandleCommandL.
       
    55      */
       
    56     void HandleCommandL(TInt aCommand);
       
    57 
       
    58     /**
       
    59      * @see CAknAppUi::HandleForegroundEventL.
       
    60      */
       
    61     void HandleForegroundEventL(TBool aForeground);
       
    62 
       
    63     /**
       
    64      * @see CAknAppUi::HandleSwitchOnEventL.
       
    65      */
       
    66     void HandleSwitchOnEventL(CCoeControl* aDestination);
       
    67 
       
    68     /**
       
    69      * @see CAknAppUi::HandleResourceChangeL.
       
    70      */
       
    71     void HandleResourceChangeL(TInt aType);
       
    72 
       
    73     /**
       
    74      * @see CAknAppUi::HandleApplicationSpecificEventL.
       
    75      */
       
    76     void HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent);
       
    77 
       
    78     /**
       
    79      * @see CAknAppUi::HandleWsEventL.
       
    80      */
       
    81     void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);
       
    82 
       
    83     /**
       
    84      * For asking whether it is ok to start closing procedures.
       
    85      */
       
    86     bool isClosingPossible() const;
       
    87 
       
    88     /**
       
    89      * Get the moment of startup.
       
    90      */
       
    91     TInt64 startupTime() const;
       
    92     
       
    93     /**
       
    94      * Returns true, after the app has started to be destroyed.
       
    95      */
       
    96     bool destroying() const {return mDestroying;};
       
    97 
       
    98 public: // From CoreUiAvkonAppUi
       
    99     /**
       
   100      * Sets the LCDUI as a child. This also sets the LCDUI to be the active
       
   101      * child, if the eSWT has been previously set as active child. When the
       
   102      * toolkit sets a child this means in practice that all the window server
       
   103      * events are propagated to the child as long as it is active child. NOTE:
       
   104      * Setting a child doesn't mean that the toolkit's window would be shown
       
   105      * to the user. It is shown to the user after the toolkit calls
       
   106      * stopStartScreen method.
       
   107      * @param child The LCDUI child object. CoreUi takes the ownership of the
       
   108      *              child.
       
   109      * @param resourceFileOffset Offset of the resource file of the LCDUI. This
       
   110      *                           is needed when deleting the resource file by
       
   111      *                           using CCoeEnv::Static()->DeleteResourceFile().
       
   112      */
       
   113     virtual void setLcduiChild(CoreAppUiChild* child, int resourceFileOffset);
       
   114 
       
   115     /**
       
   116      * Sets the eSWT as a child. This also sets the eSWT to be the active
       
   117      * child, if the LCDUI has been previously set as active child. When the
       
   118      * toolkit sets a child this means in practice that all the window server
       
   119      * events are propagated to the child as long as it is active child. NOTE:
       
   120      * Setting a child doesn't mean that the toolkit's window would be shown
       
   121      * to the user. It is shown to the user after the toolkit calls
       
   122      * stopStartScreen method.
       
   123      * @param child The eSWT child object. CoreUi takes the ownership of the
       
   124      *              child.
       
   125      */
       
   126     virtual void setEswtChild(CoreAppUiChild* child);
       
   127 
       
   128     /**
       
   129      * Removes the given child. This means that the window server events are no
       
   130      * longer propagated to this child. If the child to be removed was active
       
   131      * and there was another toolkit as a secondary child, the secondary child
       
   132      * will be set as active child. Calling this method will lead to deletion
       
   133      * of the child.
       
   134      */
       
   135     virtual void removeChild(CoreAppUiChild* child);
       
   136 
       
   137     /**
       
   138      * Gets the LCDUI child.
       
   139      */
       
   140     virtual CoreAppUiChild* getLcduiChild() const;
       
   141 
       
   142     /**
       
   143      * Checks if the appui is still having the start screen.
       
   144      */
       
   145     virtual bool hasStartScreen() const;
       
   146 
       
   147     /**
       
   148      * Stops and destroys the start screen. This must be done right after the
       
   149      * app draws for the first time.
       
   150      */
       
   151     virtual void stopStartScreen(bool aFullScreenUi = true);
       
   152 
       
   153     /**
       
   154      * Gets whether the application is in foreground.
       
   155      */
       
   156     virtual bool isForeground() const;
       
   157 
       
   158     /**
       
   159      * A delegating method for calling CAknAppUi::SetKeyBlockMode which
       
   160      * is a protected method.
       
   161      * @see CAknAppUi::SetKeyBlockMode
       
   162      */
       
   163     virtual void glueSetKeyBlockMode(TAknKeyBlockMode aMode);
       
   164 
       
   165     /**
       
   166      * Check if status pane indicators are hidden.
       
   167      */
       
   168     virtual bool hidesIndicators() const;
       
   169 
       
   170     /**
       
   171      * Check if the startup has been cancelled.
       
   172      */
       
   173     virtual bool isStartupCancelled() const;
       
   174 
       
   175 private:
       
   176     /**
       
   177      * Call back for the timer in case where the orientation timer elapses.
       
   178      */
       
   179     static TInt orientationTimerCallback(TAny*);
       
   180 
       
   181     /**
       
   182      * Handler for the timer case where the orientation timer elapses.
       
   183      */
       
   184     void handleElapsedTimer();
       
   185 
       
   186     /**
       
   187      * Sets a process to use default priority.
       
   188      */
       
   189     /**
       
   190      * Sets a process to use default priorityfor given time.
       
   191      * @param time A time to use default priority until changed to background
       
   192      *             priority. Zero means that no timer should be started.
       
   193      * @return KErrNone in success cases, Symbian error code in failure cases.
       
   194      */
       
   195     int setDefaultProcessPriority(TInt time);
       
   196 
       
   197     /**
       
   198      * Sets a process to use background priority for given time.
       
   199      * @param time A time to use background priority until changed to default
       
   200      *             priority. Zero means that no timer should be started.
       
   201      * @return KErrNone in success cases, Symbian error code in failure cases.
       
   202      */
       
   203     int setBackgroundProcessPriority(TInt time);
       
   204 
       
   205     /**
       
   206      * Starts the timer for given time. If the timer is already running, the
       
   207      * timer will be reset.
       
   208      * @param time A time for the timer in milliseconds.
       
   209      */
       
   210     void startTimerL(TInt time);
       
   211 
       
   212     /**
       
   213      * Notification received when the start screen finished saving to disk.
       
   214      */
       
   215     static TInt AsyncSaveComplete(TAny* aObj);
       
   216     void DoAsyncSaveComplete();
       
   217 
       
   218 private:
       
   219     CStartScreenContainer*  mAppView;
       
   220     bool                    mAppViewExiting;
       
   221     CoreAppUiChild*         mActiveChild;
       
   222     CoreAppUiChild*         mPassiveChild;
       
   223     CoreAppUiChild*         mEswtChild;
       
   224     CoreAppUiChild*         mLcduiChild;
       
   225     TInt                    mLcduiResourceFile;
       
   226     bool                    mIsForeground;
       
   227     CPeriodic*              mOrientationTimer;
       
   228     bool                    mIsDefaultPriorityInUse;
       
   229     TInt64                  mStartupTime;
       
   230     bool                    mStartupCancelled;
       
   231     bool                    mDestroying;
       
   232 };
       
   233 
       
   234 NONSHARABLE_CLASS(JavaUiAvkonApplication): public CAknApplication
       
   235 {
       
   236 public:
       
   237     /**
       
   238      * @see CAknApplication::AppDllUid.
       
   239      */
       
   240     TUid          AppDllUid() const;
       
   241 
       
   242     /**
       
   243      * @see CAknApplication::CreateDocumentL.
       
   244      */
       
   245     CApaDocument* CreateDocumentL();
       
   246 
       
   247     /**
       
   248      * @see CAknApplication::ResourceFileName.
       
   249      */
       
   250     TFileName     ResourceFileName() const;
       
   251 };
       
   252 
       
   253 NONSHARABLE_CLASS(JavaUiAvkonDocument) : public CAknDocument
       
   254 {
       
   255 public:
       
   256     JavaUiAvkonDocument(JavaUiAvkonApplication& application);
       
   257 public:
       
   258     /**
       
   259      * @see CAknDocument::CreateAppUiL.
       
   260      */
       
   261     CAknAppUi* CreateAppUiL();
       
   262 };
       
   263 } // end namespace ui
       
   264 } // end namespace java
       
   265 
       
   266 CApaApplication* newJavaApplication();
       
   267 
       
   268 #endif // JAVAUIAVKONIMPL_H