browser/ui/inc/ARContainer.h
author David Caabeiro <david.caabeiro@seqpoint.com>
Fri, 25 Jun 2010 12:50:05 +0200
changeset 0 c316ab048e9d
permissions -rw-r--r--
First public commit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     1
/*
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     2
 * Name        : ARContainer.h
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     3
 * Description : 
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     4
 * Project     : This file is part of OpenMAR, an Open Mobile Augmented Reality browser
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     5
 * Website     : http://OpenMAR.org
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     6
 *
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     7
 * Copyright (c) 2010 David Caabeiro
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     8
 *
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     9
 * All rights reserved. This program and the accompanying materials are made available 
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    10
 * under the terms of the Eclipse Public License v1.0 which accompanies this 
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    11
 * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    12
 *
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    13
 */
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    14
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    15
#ifndef __ARCONTAINER_H__
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    16
#define __ARCONTAINER_H__
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    17
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    18
#include <coecntrl.h>
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    19
#include <coecobs.h>
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    20
#include <AknButton.h>
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    21
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    22
#include "POIOverlay.h"
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    23
#include "Camera.h"
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    24
#include "Screenshot.h"
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    25
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    26
class CAknView;
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    27
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    28
/**
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    29
 * @brief AR control class
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    30
 * 
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    31
 * This class provides the basic view and is in charge of initializing the camera, 
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    32
 * which dictates the refresh rate of the overlays
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    33
 */
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    34
class CARContainer : public CCoeControl,
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    35
            public MCoeControlObserver,
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    36
            public MCoeForegroundObserver,
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    37
            public CDigitalCamera::MObserver,
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    38
            public CScreenshot::MObserver
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    39
{
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    40
public:
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    41
    static CARContainer* NewL(CAknView& aView, const TRect& aRect);
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    42
    ~CARContainer();
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    43
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    44
private:
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    45
    CARContainer(CAknView& aView);
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    46
    void ConstructL(const TRect& aRect);
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    47
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    48
    void CreateButtonGroupL();
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    49
    void DeleteButtonGroup();
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    50
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    51
    static TInt SensorStart(TAny* aPtr);
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    52
    void DoSensorStart();
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    53
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    54
    static TInt SensorStop(TAny* aPtr);
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    55
    void DoSensorStop();
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    56
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    57
    void ScreenshotStartL();
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    58
    void ScreenshotStop();
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    59
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    60
protected:
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    61
    void SizeChanged();
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    62
    void HandlePointerEventL(const TPointerEvent& aPointerEvent);
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    63
    void HandleResourceChange(TInt aType);
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    64
    void Draw(const TRect& aRect) const;
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    65
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    66
    TInt CountComponentControls() const;
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    67
    CCoeControl* ComponentControl(TInt aIndex) const;
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    68
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    69
protected:
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    70
    // From MCoeControlObserver
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    71
    void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType);
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    72
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    73
    // From MCoeForegroundObserver
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    74
    void HandleGainingForeground();
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    75
    void HandleLosingForeground();
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    76
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    77
    // From CDigitalCamera::MObserver
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    78
    void CameraReady(TInt aError);
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    79
    void CameraFrame(CFbsBitmap& aFrame);
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    80
    void FocusReady(TInt aError);
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    81
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    82
    // From CScreenshot::MObserver
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    83
    void ScreenshotReadyL(TInt aError, const TDesC& aFilename);
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    84
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    85
private:
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    86
    CAknView& iView;
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    87
    CAknButton* iScreenshotButton;
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    88
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    89
    CFbsBitmap* iBitmap;
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    90
    CFbsBitmapDevice* iBitmapDevice;
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    91
    CFbsBitGc* iBitmapContext;
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    92
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    93
    enum TButtonId {
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    94
        EScreenshot,
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    95
        ETotal
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    96
    };
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    97
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    98
private:
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    99
    RPointerArray<OpenMAR::CPOIOverlay> iOverlayList;
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
   100
    CDigitalCamera* iCamera;
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
   101
    CScreenshot* iScreenshot;
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
   102
    CIdle* iSensorTask;
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
   103
};
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
   104
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
   105
#endif // __ARCONTAINER_H__