javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtflipwatch.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*******************************************************************************
       
     2  * Copyright (c) 2007, 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved. This program and the accompanying materials
       
     4  * are made available under the terms of the Eclipse Public License v1.0
       
     5  * which accompanies this distribution, and is available at
       
     6  * http://www.eclipse.org/legal/epl-v10.html
       
     7  *
       
     8  * Contributors:
       
     9  *     Nokia Corporation - S60 implementation
       
    10  *******************************************************************************/
       
    11 
       
    12 
       
    13 #ifndef SWTFLIPWATCH_H
       
    14 #define SWTFLIPWATCH_H
       
    15 
       
    16 
       
    17 #include <e32base.h>
       
    18 #include <e32property.h>
       
    19 
       
    20 
       
    21 /**
       
    22  * MSwtFlipWatchTimerHandler
       
    23  */
       
    24 class MSwtFlipWatchTimerHandler
       
    25 {
       
    26 public:
       
    27     virtual void HandleTimeoutL() = 0;
       
    28 };
       
    29 
       
    30 
       
    31 /**
       
    32  * CSwtFlipWatchTimer
       
    33  * Timer used by the flip watch.
       
    34  * @lib eswt
       
    35  */
       
    36 NONSHARABLE_CLASS(CSwtFlipWatchTimer)
       
    37         : public CActive
       
    38 {
       
    39 // Own methods
       
    40 public:
       
    41     static CSwtFlipWatchTimer* NewL(MSwtFlipWatchTimerHandler* aHandler);
       
    42     virtual ~CSwtFlipWatchTimer();
       
    43     void SetTimer(TTimeIntervalMicroSeconds32 aDelay);
       
    44 private:
       
    45     CSwtFlipWatchTimer(MSwtFlipWatchTimerHandler* aHandler);
       
    46     void ConstructL();
       
    47     void RunL();
       
    48     void DoCancel();
       
    49 
       
    50 // Data
       
    51 private:
       
    52     RTimer iTimer;
       
    53     MSwtFlipWatchTimerHandler* iHandler;
       
    54 };
       
    55 
       
    56 
       
    57 /**
       
    58  * MSwtFlipObserver
       
    59  */
       
    60 class MSwtFlipObserver
       
    61 {
       
    62 public:
       
    63     /**
       
    64      * Flip being changed. In the case of several quick swaps of the flip
       
    65      * this notification will be sent continuosly.
       
    66      */
       
    67     virtual void FlipChangingL() = 0;
       
    68 
       
    69     /**
       
    70      * End of flip change. In the case of several quick swaps of the flip
       
    71      * this notification will be sent once after the quick swap stops.
       
    72      */
       
    73     virtual void FlipChangedL(TBool aState) = 0;
       
    74 };
       
    75 
       
    76 
       
    77 /**
       
    78  * CSwtFlipWatchTimer
       
    79  * Flip watch. Observers and reports changes in the flip status.
       
    80  * @lib eswt
       
    81  */
       
    82 NONSHARABLE_CLASS(CSwtFlipWatch)
       
    83         : public CActive
       
    84         , public MSwtFlipWatchTimerHandler
       
    85 {
       
    86 // Own methods
       
    87 public:
       
    88     static CSwtFlipWatch* NewL(MSwtFlipObserver* aObserver);
       
    89     virtual ~CSwtFlipWatch();
       
    90 private:
       
    91     CSwtFlipWatch(MSwtFlipObserver* aObserver);
       
    92     void ConstructL();
       
    93     void DoCancel();
       
    94     void RunL();
       
    95 
       
    96 // From MSwtFlipWatchTimerHandler
       
    97 public:
       
    98     void HandleTimeoutL();
       
    99 
       
   100 // Data
       
   101 private:
       
   102     RProperty iProperty;
       
   103     MSwtFlipObserver* iObserver;
       
   104     CSwtFlipWatchTimer* iTimer;
       
   105     TBool iFlipOpen;
       
   106 };
       
   107 
       
   108 
       
   109 #endif // SWTFLIPWATCH_H