javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtflipwatch.h
branchRCL_3
changeset 14 04becd199f91
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtflipwatch.h	Tue Apr 27 16:30:29 2010 +0300
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Nokia Corporation - S60 implementation
+ *******************************************************************************/
+
+
+#ifndef SWTFLIPWATCH_H
+#define SWTFLIPWATCH_H
+
+
+#include <e32base.h>
+#include <e32property.h>
+
+
+/**
+ * MSwtFlipWatchTimerHandler
+ */
+class MSwtFlipWatchTimerHandler
+{
+public:
+    virtual void HandleTimeoutL() = 0;
+};
+
+
+/**
+ * CSwtFlipWatchTimer
+ * Timer used by the flip watch.
+ * @lib eswt
+ */
+NONSHARABLE_CLASS(CSwtFlipWatchTimer)
+        : public CActive
+{
+// Own methods
+public:
+    static CSwtFlipWatchTimer* NewL(MSwtFlipWatchTimerHandler* aHandler);
+    virtual ~CSwtFlipWatchTimer();
+    void SetTimer(TTimeIntervalMicroSeconds32 aDelay);
+private:
+    CSwtFlipWatchTimer(MSwtFlipWatchTimerHandler* aHandler);
+    void ConstructL();
+    void RunL();
+    void DoCancel();
+
+// Data
+private:
+    RTimer iTimer;
+    MSwtFlipWatchTimerHandler* iHandler;
+};
+
+
+/**
+ * MSwtFlipObserver
+ */
+class MSwtFlipObserver
+{
+public:
+    /**
+     * Flip being changed. In the case of several quick swaps of the flip
+     * this notification will be sent continuosly.
+     */
+    virtual void FlipChangingL() = 0;
+
+    /**
+     * End of flip change. In the case of several quick swaps of the flip
+     * this notification will be sent once after the quick swap stops.
+     */
+    virtual void FlipChangedL(TBool aState) = 0;
+};
+
+
+/**
+ * CSwtFlipWatchTimer
+ * Flip watch. Observers and reports changes in the flip status.
+ * @lib eswt
+ */
+NONSHARABLE_CLASS(CSwtFlipWatch)
+        : public CActive
+        , public MSwtFlipWatchTimerHandler
+{
+// Own methods
+public:
+    static CSwtFlipWatch* NewL(MSwtFlipObserver* aObserver);
+    virtual ~CSwtFlipWatch();
+private:
+    CSwtFlipWatch(MSwtFlipObserver* aObserver);
+    void ConstructL();
+    void DoCancel();
+    void RunL();
+
+// From MSwtFlipWatchTimerHandler
+public:
+    void HandleTimeoutL();
+
+// Data
+private:
+    RProperty iProperty;
+    MSwtFlipObserver* iObserver;
+    CSwtFlipWatchTimer* iTimer;
+    TBool iFlipOpen;
+};
+
+
+#endif // SWTFLIPWATCH_H