当前位置: 首页>>代码示例>>C++>>正文


C++ TRawEvent::ScanCode方法代码示例

本文整理汇总了C++中TRawEvent::ScanCode方法的典型用法代码示例。如果您正苦于以下问题:C++ TRawEvent::ScanCode方法的具体用法?C++ TRawEvent::ScanCode怎么用?C++ TRawEvent::ScanCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TRawEvent的用法示例。


在下文中一共展示了TRawEvent::ScanCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CheckRotation

// -----------------------------------------------------------------------------
// CAknKeyRotatorImpl::CheckRotation
// Check if this is our own generated event.
// -----------------------------------------------------------------------------
//
TBool CAknKeyRotatorImpl::CheckRotation( 
    const TRawEvent &aRawEvent,
    MAnimGeneralFunctions& aAnimGeneralFunctions )
    {
    if ( KMaxTInt == iKeyRotatorCompensation )
        {
        // Key rotator is disabled - wsini.ini contains "S60_KEYROTATOR DISABLED".
        return EFalse;
        }

    // Check first that we are not processing just generated event again.
    if ( iRotatedRawEvent )
        {
        // This is the generated avent from the last round. Do not modify again.
        iRotatedRawEvent = EFalse;
        }
    else if ( aRawEvent.Type() == TRawEvent::EKeyDown || 
              aRawEvent.Type() == TRawEvent::EKeyUp || 
              aRawEvent.Type() == TRawEvent::EKeyRepeat )
        {
        // We get new event. Let's see if we need to modify that.
        TRawEvent newRawEvent( aRawEvent );
        DoCheckRotation( newRawEvent, aAnimGeneralFunctions );
        if ( aRawEvent.ScanCode() != newRawEvent.ScanCode() )   
            {
            // Generate new event,
            iRotatedRawEvent = ETrue;
            aAnimGeneralFunctions.PostRawEvent( newRawEvent ); // Calls this function again!
            return ETrue;
            }
        }
    
    return EFalse;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:39,代码来源:AknKeyRotatorImpl.cpp

示例2: DoCheckRotation

// -----------------------------------------------------------------------------
// CAknKeyRotatorImpl::DoCheckRotation
// Checks the scan codes and the orientations. Decides if we need to generate
// a new raw event.
// -----------------------------------------------------------------------------
//
void CAknKeyRotatorImpl::DoCheckRotation(
    TRawEvent& aNewRawEvent,
    MAnimGeneralFunctions& aAnimGeneralFunctions )
    {   
    // Current implementation is only for arrow keys
    if ( !KAknRotateArrowKeys )
        {
        return;
        }
    
    // Do not rotate external keyboard events.
    if ( aNewRawEvent.ScanCode() & EModifierKeyboardExtend )
        {
        return;
        }    
        
    // Also check only the arrow keys
    if ( !IsArrowScanCode( aNewRawEvent.ScanCode ()) )
        {
        return;
        }
    
    // If 'newCode' is changed something else than -1, 
    // a new event will be generated
    TInt newCode = KErrNotFound;
    
    // Check the rotation on down event. Use the same rotation for up event.
    
    // finalRotation variable at the end of this function is used to determine
    // the new scan code.
    CFbsBitGc::TGraphicsOrientation finalRotation = 
        CFbsBitGc::EGraphicsOrientationNormal;
    
    if ( aNewRawEvent.Type() == TRawEvent::EKeyUp || 
         aNewRawEvent.Type() == TRawEvent::EKeyRepeat )
        {
        // Use the same orintation for up event.
        finalRotation = iUsedRotationForDownEvent;
        }
    else // For down event, find out the rotation.
        {
        // Get SW screen rotation compared to the keyboard i.e. app orientation.
        CFbsBitGc::TGraphicsOrientation swRotation = 
            aAnimGeneralFunctions.ScreenDevice()->Orientation();
    
        // Get HW screen rotation
        CFbsBitGc::TGraphicsOrientation hwRotation = 
            CFbsBitGc::EGraphicsOrientationNormal;
        TInt hwState;
        if ( KAknRotateInKeyboardDriver && 
             ( iProperty.Get(hwState) == KErrNone ) )
            {
            if ( hwState < iHwRotations.Count() )
                {
                hwRotation = iHwRotations[hwState];
                }
            }
    
        // Calculate the difference
        TInt finalRotationInt = swRotation*90;
    
        if ( KAknRotateInKeyboardDriver )
            {
            // If the rotation is also done in the driver level, 
            // the rotation needs to be compensated so we do not 
            // rotate twice.
            finalRotationInt -= hwRotation*90;
            }
    
        finalRotationInt += iKeyRotatorCompensation;

        // Keep the value between 0 and 270.
        while ( finalRotationInt < 0 )
            {
            finalRotationInt += 360;
            }
        while ( finalRotationInt > 270 )
            {
            finalRotationInt -= 360;
            }
            
        finalRotation = 
            (CFbsBitGc::TGraphicsOrientation)( finalRotationInt / 90 );

        iUsedRotationForDownEvent = finalRotation;
        }
    
    // Find the new scan code from the rotation.
    switch( aNewRawEvent.ScanCode() )
        {
        case EStdKeyLeftArrow:
            switch ( finalRotation )
                {
                case CFbsBitGc::EGraphicsOrientationRotated90:
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:101,代码来源:AknKeyRotatorImpl.cpp


注:本文中的TRawEvent::ScanCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。