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

📄 linkedmessageboxappui.cpp

📁 这是Symbian平台下软件里实现超链接的对话框,非常方便实用.只要点按下超链接就可以打开指定的网页,打开指定的文件等功能.
💻 CPP
字号:
/*
============================================================================
 Name        : LinkedMessageboxAppUi.cpp
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : Main application UI class (controller)
============================================================================
*/

// INCLUDE FILES
#include <avkon.hrh>
#include <aknnotewrappers.h>
#include <aknmessagequerydialog.h>
#include <stringloader.h>
#include <LinkedMessagebox.rsg>
#include <f32file.h>
#include <s32file.h>

#include "LinkedMessagebox.pan"
#include "LinkedMessageboxAppUi.h"
#include "LinkedMessageboxAppView.h"
#include "LinkedMessagebox.hrh"

// ============================ MEMBER FUNCTIONS ===============================
LOCAL_C TInt CallbackText1(TAny* /*aAny*/)
	{
	CAknInformationNote* msg = new (ELeave) CAknInformationNote(ETrue);
	msg->ExecuteLD(_L("You clicked the first link"));
	return EFalse;
	}

LOCAL_C TInt CallbackText2(TAny* /*aAny*/)
	{
	CAknInformationNote* msg = new (ELeave) CAknInformationNote(ETrue);
	msg->ExecuteLD(_L("You clicked the second link"));
	return EFalse;
	}

LOCAL_C void DisplayMessageBox()
	{
	_LIT(KHeader, "Example Link Box");
	_LIT(KLink1, "Link 1");
	_LIT(KLink2, "Link 2");
	_LIT(KMessageboxText, "Click here for Link 1\nhere for Link 2");
	__ASSERT_DEBUG(KMessageboxText().Find(KLink1) != KErrNotFound, User::Panic(_L("Link 1 missing"), 1));
	__ASSERT_DEBUG(KMessageboxText().Find(KLink2) != KErrNotFound, User::Panic(_L("Link 2 missing"), 2));

	CAknMessageQueryDialog* dialog = CAknMessageQueryDialog::NewL(CONST_CAST(TDesC&, KMessageboxText()));
	CleanupStack::PushL(dialog);

	dialog->SetHeaderText(KHeader);

	TCallBack callback1(CallbackText1);
	dialog->SetLink(callback1);
	dialog->SetLinkTextL(KLink1);

	TCallBack callback2(CallbackText2);
	dialog->SetLink(callback2);
	dialog->SetLinkTextL(KLink2);

	CleanupStack::Pop(dialog);
	dialog->ExecuteLD(R_AVKON_MESSAGE_QUERY_DIALOG);
	}

// -----------------------------------------------------------------------------
// CLinkedMessageboxAppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CLinkedMessageboxAppUi::ConstructL()
    {
    // Initialise app UI with standard value.
    BaseConstructL();

    // Create view object
    iAppView = CLinkedMessageboxAppView::NewL( ClientRect() );
    }
// -----------------------------------------------------------------------------
// CLinkedMessageboxAppUi::CLinkedMessageboxAppUi()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CLinkedMessageboxAppUi::CLinkedMessageboxAppUi()
    {
    // No implementation required
    }

// -----------------------------------------------------------------------------
// CLinkedMessageboxAppUi::~CLinkedMessageboxAppUi()
// Destructor.
// -----------------------------------------------------------------------------
//
CLinkedMessageboxAppUi::~CLinkedMessageboxAppUi()
    {
    if ( iAppView )
        {
        delete iAppView;
        iAppView = NULL;
        }

    }

// -----------------------------------------------------------------------------
// CLinkedMessageboxAppUi::HandleCommandL()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
void CLinkedMessageboxAppUi::HandleCommandL( TInt aCommand )
    {
    switch( aCommand )
        {
        case EEikCmdExit:
        case EAknSoftkeyExit:
            Exit();
            break;
        case ELinkedMessageboxCommand1:
            {
			DisplayMessageBox();
            }
            break;
        default:
            Panic( ELinkedMessageboxUi );
            break;
        }
    }
// -----------------------------------------------------------------------------
//  Called by the framework when the application status pane
//  size is changed.  Passes the new client rectangle to the
//  AppView
// -----------------------------------------------------------------------------
//
void CLinkedMessageboxAppUi::HandleStatusPaneSizeChange()
{
	iAppView->SetRect( ClientRect() );
	
} 


// End of File

⌨️ 快捷键说明

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