📄 s60uicodeexappui.cpp
字号:
/*
* ==============================================================================
* Name : S60UICodeExAppUi.cpp
* Part of : S60UICodeEx
* Interface :
* Description :
* Version :
*
* Copyright (c) 2005-2006 Nokia Corporation.
* This material, including documentation and any related
* computer programs, is protected by copyright controlled by
* Nokia Corporation.
* ==============================================================================
*/
// INCLUDE FILES
#include <aknviewappui.h>
#include <aknview.h>
#include <avkon.hrh>
#include <avkon.rsg>
#include <aknquerydialog.h>
#include <S60UICodeEx.rsg>
#include <eikbtgpc.h>
#include "S60UICodeEx.hrh"
#include "S60UICodeEx.h"
// ============================ MEMBER FUNCTIONS ==============================
// ----------------------------------------------------------------------------
// CS60UICodeExAppUi::ConstructL
// Symbian 2nd phase constructor.
// ----------------------------------------------------------------------------
//
void CS60UICodeExAppUi::ConstructL()
{
BaseConstructL( EAppOrientationAutomatic );
iMainView = CS60UICodeExView::NewLC();
AddViewL(iMainView);
CleanupStack::Pop();
iEikonEnv->RootWin().EnableScreenChangeEvents();
SetDefaultViewL(*iMainView);
iStatusPaneState = EStatusPaneStateNormal;
iForcedRotateState = EFalse;
}
// ----------------------------------------------------------------------------
// CS60UICodeExAppUi::~CS60UICodeExAppUi
// Destructor.
// ----------------------------------------------------------------------------
//
CS60UICodeExAppUi::~CS60UICodeExAppUi()
{
}
// ----------------------------------------------------------------------------
// CS60UICodeExAppUi::HandleCommandL
//
// ----------------------------------------------------------------------------
//
void CS60UICodeExAppUi::HandleCommandL(TInt aCommand)
{
switch (aCommand)
{
case ES60ExCmdNormalSP:
{
iStatusPaneState = EStatusPaneStateNormal;
CEikStatusPane* statusPane = StatusPane();
statusPane->MakeVisible( ETrue );
statusPane->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL );
break;
}
case ES60ExCmdSP:
{
iStatusPaneState = EStatusPaneStateSmall;
CEikStatusPane* statusPane = StatusPane();
statusPane->MakeVisible( ETrue );
statusPane->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT );
break;
}
case ES60ExCmdNoSP:
{
iStatusPaneState = EStatusPaneStateNone;
CEikStatusPane* statusPane = StatusPane();
statusPane->MakeVisible( EFalse );
break;
}
case ES60ExCmdRotate:
{
iForcedRotateState = ETrue;
if( !ScreenState() )
{
SetOrientationL(CAknViewAppUi::EAppUiOrientationPortrait);
}
else
{
SetOrientationL(CAknViewAppUi::EAppUiOrientationLandscape);
}
break;
}
case ES60ExCmdInsertText:
{
CAknTextQueryDialog *dlg = new (ELeave)
CAknTextQueryDialog( mybuf );
dlg->SetMaxLength( 20 );
dlg->ExecuteLD( R_DIALOG_TEXT_EDIT_QUERY );
iMainView->SetDrawText( &mybuf );
break;
}
case EAknCmdExit:
case EEikCmdExit:
case EAknSoftkeyExit:
Exit();
break;
}
}
// ----------------------------------------------------------------------------
// CS60UICodeExAppUi::HandleStatusPaneSizeChange
//
// ----------------------------------------------------------------------------
//
void CS60UICodeExAppUi::HandleStatusPaneSizeChange()
{
CEikStatusPane* statusPane = StatusPane();
//landscape and no status pane, set status pane visible
if( !ScreenState() && iStatusPaneState == EStatusPaneStateNone )
{
statusPane->MakeVisible( ETrue );
}
else if( iStatusPaneState == EStatusPaneStateNone && ScreenState() )
{
statusPane->MakeVisible( EFalse );
}
iMainView->HandleStatusPaneSizeChange();
}
// ----------------------------------------------------------------------------
// CS60UICodeExAppUi::HandleScreenDeviceChangedL
//
// ----------------------------------------------------------------------------
//
void CS60UICodeExAppUi::HandleScreenDeviceChangedL()
{
CAknViewAppUi::HandleScreenDeviceChangedL();
iMainView->HandleScreenDeviceChangedL();
}
// ----------------------------------------------------------------------------
// CS60UICodeExAppUi::HandleForegroundEventL
//
// ----------------------------------------------------------------------------
//
void CS60UICodeExAppUi::HandleForegroundEventL( TBool aForeground )
{
if( aForeground)
{
SetOrientationL(CAknViewAppUi::EAppUiOrientationAutomatic);
iMainView->HandleScreenDeviceChangedL();
}
}
// ----------------------------------------------------------------------------
// CS60UICodeExAppUi::DynInitMenuPaneL
//
// ----------------------------------------------------------------------------
//
void CS60UICodeExAppUi::DynInitMenuPaneL( TInt aResourceId,CEikMenuPane* aMenuPane )
{
if( aResourceId == R_EXAMPLE_FIRST_MENU )
{
if ( iStatusPaneState == EStatusPaneStateSmall )
{
aMenuPane->SetItemDimmed( ES60ExCmdNormalSP, EFalse);
aMenuPane->SetItemDimmed( ES60ExCmdSP, ETrue );
aMenuPane->SetItemDimmed( ES60ExCmdNoSP, EFalse );
}
else if( iStatusPaneState == EStatusPaneStateNone )
{
aMenuPane->SetItemDimmed( ES60ExCmdSP, EFalse );
aMenuPane->SetItemDimmed( ES60ExCmdNoSP, ETrue );
aMenuPane->SetItemDimmed( ES60ExCmdNormalSP, EFalse);
}
else if( iStatusPaneState == EStatusPaneStateNormal )
{
aMenuPane->SetItemDimmed( ES60ExCmdNormalSP, ETrue);
aMenuPane->SetItemDimmed( ES60ExCmdSP, EFalse );
aMenuPane->SetItemDimmed( ES60ExCmdNoSP, EFalse );
}
// when in landscape, always small status pane, no need to change
if( !ScreenState() )
{
aMenuPane->SetItemDimmed( ES60ExCmdNoSP, ETrue );
aMenuPane->SetItemDimmed( ES60ExCmdSP, ETrue );
aMenuPane->SetItemDimmed( ES60ExCmdNormalSP, ETrue);
}
}
}
// ----------------------------------------------------------------------------
// CS60UICodeExAppUi::ScreenState
//
// ----------------------------------------------------------------------------
//
TBool CS60UICodeExAppUi::ScreenState()
{
TRect rect( iMainView->ClientRect());
if( rect.iBr.iX < rect.iBr.iY ) // Portrait
{
return ETrue;
}
else
{
return EFalse;
}
}
// End of file.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -