⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vncviewerappview.cpp

📁 vncviewer_source_1.0
💻 CPP
字号:
/* Copyright (C) 2006 Lucas Gomez  All Rights Reserved.
 * 
 * This 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 2 of the License, or
 * (at your option) any later version.
 * 
 * This software 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 software; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
 * USA.
 */

// INCLUDE FILES
#include <aknmessagequerydialog.h>

#include "VncViewer.rsg"
#include "VncViewerAppView.h"
#include "VncViewerAppUi.h"
#include "VncViewer.pan"
#include "PreferencesDialog.h"

// ============================ MEMBER FUNCTIONS ===============================

// -----------------------------------------------------------------------------
// CVncViewerAppView::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CVncViewerAppView* CVncViewerAppView::NewL(CVncViewerAppUi* aCallback)
{
	CVncViewerAppView* self = CVncViewerAppView::NewLC(aCallback);
	CleanupStack::Pop(self);
	return self;
}

// -----------------------------------------------------------------------------
// CVncViewerAppView::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CVncViewerAppView* CVncViewerAppView::NewLC(CVncViewerAppUi* aCallback)
{
	CVncViewerAppView* self = new (ELeave) CVncViewerAppView(aCallback);
	CleanupStack::PushL(self);
	self->ConstructL();
	return self;
}

// -----------------------------------------------------------------------------
// CVncViewerAppView::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CVncViewerAppView::ConstructL()
{
	BaseConstructL(R_APPVIEW);
}

// -----------------------------------------------------------------------------
// CVncViewerAppView::CVncViewerAppView()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CVncViewerAppView::CVncViewerAppView(CVncViewerAppUi* aCallback) : CAknView()
{
	iCallback=aCallback;
}


// -----------------------------------------------------------------------------
// CVncViewerAppView::~CVncViewerAppView()
// Destructor.
// -----------------------------------------------------------------------------
//
CVncViewerAppView::~CVncViewerAppView()
{
	if(iContainer)
	{
		AppUi()->RemoveFromViewStack(*this,iContainer);
		delete iContainer;
		iContainer = NULL;
	}
}

// DoActivateL is called each time when a view is activated
// For example, this occurs when the user starts a new application
// or the active view in the foreground is changed by the system itself
void CVncViewerAppView::DoActivateL(const TVwsViewId& /* aPrevViewId */,
									TUid /* aCustomMessageId */, const TDesC8& /* aCustomMessage */)
{
	// Create view container control that will then create
	// all child controls
	if(!iContainer)
	{
		iContainer = CConnDetailsContainer::NewL(ClientRect());
		// Create view container control that will then create
		// all child controls
		iContainer->SetMopParent(this);
		// Add the container to the control stack
		// So that it and its children can receive key events
		AppUi()->AddToViewStackL(*this,iContainer);
		// Complete the initialization
		iContainer->ActivateL();
	}
}

// DoDeactivate is called whenever a view is deactivated
void CVncViewerAppView::DoDeactivate()
{
	// The controls are not needed anymore. Remove them to save
	// memory.
	if(iContainer)
	{
		AppUi()->RemoveFromViewStack(*this,iContainer);
		delete iContainer;
		iContainer = NULL;
	}
}

/*
 * HandleForegroundEvent()
 * Foreground event handling function
 *
 * @parameter aForeground  Indicates the required focus state of the control.
 */
void CVncViewerAppView::HandleForegroundEventL(TBool aForeground)
{
	CAknView::HandleForegroundEventL(aForeground);
}

/*
 * HandleCommandL()
 * Command handling function
 *
 * @parameter aCommand  ID of the command to respond to. 
 */
void CVncViewerAppView::HandleCommandL(TInt aCommand)
{
	switch(aCommand)
	{
		case EVncViewerCommand1:
		{
			AppUi()->ActivateLocalViewL(TUid::Uid(EViewportView));
			iCallback->Connect();
		}
		break;
		
		case EVncViewerCommand2:
		{
			CPreferencesDialog* dlg = new (ELeave) CPreferencesDialog(EFalse,iCallback);
			dlg->PrepareLC(R_PREFERENCES_DIALOG);
			dlg->RunLD();
		}
		break;
		
		case EVncViewerCommand3:
		{
			CAknMessageQueryDialog* dlg=new (ELeave) CAknMessageQueryDialog;
			dlg->ExecuteLD(R_ABOUT_DIALOG);

		}
		break;
		
		default:
		{
			AppUi()->HandleCommandL(aCommand);
        }
	}
}

/*
 * HandleStatusPaneSizeChange()
 * Event handler for status pane size changes.
 *
 */
void CVncViewerAppView::HandleStatusPaneSizeChange()
{
	if(iContainer)
		iContainer->SetRect(ClientRect());
}

// End of File

⌨️ 快捷键说明

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