bencoolenappui.h

来自「Symbian_OS_code 初学Symbian_OS学习代码, 屏幕截图软」· C头文件 代码 · 共 189 行

H
189
字号
/*
 * BencoolenAppUi.h
 *
 * Copyright 2005 - 2008, Antony Pranata
 * http://www.antonypranata.com
 *
 * Project: Screenshot for Symbian OS
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef BENCOOLENAPPUI_H
#define BENCOOLENAPPUI_H

// INCLUDE FILES
#include <symbianvariant.h>

#ifdef __S60__
#include <aknviewappui.h>
#include "BencoolenAppView.h"
#else
#include <qikappui.h>
#include <QikMediaFolderMonitor.h>
#endif

class CFakeOverlay;

#include "ScreenShot.h"

// FORWARD DECLARATIONS
class CBencoolenSettingsView;
class CBencoolenAppContainer;
class CScreenShotData;
class CSendUi;
class CSendAppUi;

// CLASS DECLARATION

/**
 * Application UI class.
 */
#ifdef __S60__
class CBencoolenAppUi: public CAknViewAppUi, public MScreenShotObserver
#else
class CBencoolenAppUi: public CSymbianAppUi, public MScreenShotObserver,
        public MQikMediaFolderMonitorObserver
#endif
	{

public: // Constructor and destructor
	/**
	 * Second phase constructor.
	 */
	void ConstructL();

	/**
	 * Destructor.
	 */	  
	~CBencoolenAppUi();
		
public: // New methods
	void SetCaptureKey();
	void CancelCaptureKey();

private: // from MScreenShotObserver;
	void OnCaptureCompleted(TInt aError);
	void OnSaveCompleted(TInt aError);

private: // from MEikMenuObserver
	void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);

#ifndef __S60__

private: // from MQikMediaFolderMonitorObserver
	void FolderChangeL(const TDriveNumber& /*aDrive*/, const TDesC& aFolder,
		const TBool aUpdateNeeded);
	void FolderChangeToAllL(const TBool aUpdateNeeded);

#endif

private: // From CEikAppUi
	/**
	 * Takes care of command handling.
	 * @param aCommand command to be handled
	 */
	void HandleCommandL(TInt aCommand);

	/**
	 * Handles key events.
	 * @param aKeyEvent Event to handled.
	 * @param aType Type of the key event. 
	 * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). 
	 */
	TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,
		TEventCode aType);

	void HandleForegroundEventL(TBool aForeground);
	
#if (__S60__ >= 203)
	void HandleWsEventL(const TWsEvent &aEvent, CCoeControl *aDestination);
	void HandleResourceChangeL(TInt aType);
#endif

private: // New methods
#ifdef __S60__
	CBencoolenAppContainer* AppContainer()
	{ return (iAppView) ? iAppView->AppContainer() : 0; }
	void DoHandleSendL(TInt aCommand);
#else
	CBencoolenAppContainer* AppContainer()
	{ return iAppContainer; }
	void DoHandleSendL();
#endif

	void DoHandleAboutDlgL();
	void DoHandleSettingsDlgL();
	void DoHandleStop();

	void DoLoadSettingsL();
	void DoSaveSettingsL();

	void DoSetCaptureKey(TInt aCaptureKey, TInt aCaptureKey2 = 0,
		TInt aCaptureKeySecondary = 0, TInt aCaptureKey2Secondary = 0,
		TUint aModifierMask = 0, TInt aRepeats = 0);

	void DisplayGlobalDlg(TInt aResourceId);
	void DisplayGlobalDlg(const TDesC& aMessage);
	void DisplayErrorDlg(TInt aError);

private: // Data
	TBool                   iIsCapturing;
	TBool                   iIsContinuous;
#ifdef __S60__
	CBencoolenAppView*      iAppView;
	CBencoolenSettingsView* iSettingsView;
	CFbsBitmap*             iBackgroundBitmap;
#else
	CBencoolenAppContainer* iAppContainer;
#endif
	CScreenShot*            iScreenShot;
	CScreenShotData*        iScreenShotData;
	TUint                   iCaptureKey;
	TInt32                  iHandleCaptureKey;
	TUint                   iCaptureKeySecondary;
    TInt32                  iHandleCaptureKeySecondary;	

    // iCaptureKey2 is used to capture iCode.
    // In S60, we need to capture iCode too. Normally we only need to capture iScanCode.
    // If we only capture iScanCode, the key event will still be sent to
    // other applications.
    TUint                   iCaptureKey2;
    TInt32                  iHandleCaptureKey2;
	TUint                   iCaptureKey2Secondary;
    TInt32                  iHandleCaptureKey2Secondary;
	TUint                   iModifierMask;
	TBool                   iIsSecondary;
	TInt                    iRepeats;

#ifdef __S60__

#if (__S60__ >= 300) // Starting from S60 3.x, we use CSendUi to send files.
	CSendUi*                iSendUi;
#else
	CSendAppUi*             iSendUi;
#endif

#else
	CQikMediaFolderMonitor* iMonitor;
#endif

	CFakeOverlay* iOverlay;
	RWindowGroup  iWindowGroup;
	};

#endif

// End of File

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?