--- a/idlehomescreen/xmluirendering/uiengine/src/xncontroladapterimpl.cpp Wed Sep 15 12:00:00 2010 +0300
+++ b/idlehomescreen/xmluirendering/uiengine/src/xncontroladapterimpl.cpp Wed Oct 13 14:18:30 2010 +0300
@@ -61,7 +61,6 @@
#include "xnscrollablecontroladapter.h"
#include "xnfocuscontrol.h"
#include "xneditmode.h"
-#include "xnviewswitcher.h"
_LIT8(KScrollableBoxNodeName, "scrollablebox");
_LIT8( KView, "view" );
@@ -208,6 +207,7 @@
CXnResource& aResource, RFile& aFile, RFs& aFsSession );
static void DrawFocusAppearance( CXnNode& aNode, CWindowGc& aGc );
static CXnDomNode* HasHoldTrigger( CXnDomNode* aNode );
+static void CancelFocusRefusalL( CXnUiEngine& aUiEngine );
// ============================= LOCAL FUNCTIONS ===============================
// -----------------------------------------------------------------------------
@@ -3414,6 +3414,30 @@
}
// -----------------------------------------------------------------------------
+// CancelFocusRefusalL
+// Cancels focus refusal
+// -----------------------------------------------------------------------------
+//
+static void CancelFocusRefusalL( CXnUiEngine& aUiEngine )
+ {
+ CXnNode* focused( aUiEngine.FocusedNode() );
+
+ if ( focused )
+ {
+ CXnControlAdapter* control( focused->Control() );
+
+ if ( control && control->RefusesFocusLoss() )
+ {
+ focused->HideTooltipsL();
+
+ // It is now time to give up holding focus
+ focused->UnsetStateL(
+ XnPropertyNames::style::common::KFocus );
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
// Calculates scaled bitmap size (rect)
// -----------------------------------------------------------------------------
//
@@ -3776,9 +3800,9 @@
if ( prop && prop->StringValue() == XnPropertyNames::KTrue )
{
CXnUiEngine* engine( node->UiEngine() );
- CXnAppUiAdapter& appui( engine->AppUiAdapter() );
-
- appui.ViewAdapter().CloseAllPopupsL();
+ CXnAppUiAdapter& appui( engine->AppUiAdapter() );
+
+ CancelFocusRefusalL( *engine );
appui.HideFocus();
@@ -3840,7 +3864,7 @@
//
TBool CXnControlAdapterImpl::HandlePointerEventL(
const TPointerEvent& aPointerEvent )
- {
+ {
const TPointerEvent& event( aPointerEvent );
CXnNode* node( &iNode.Node() );
@@ -3923,6 +3947,11 @@
if ( !menuBar )
{
+ CancelFocusRefusalL( *engine );
+ }
+
+ if ( !menuBar && !engine->FocusedNode() )
+ {
// save starting point
iButtonDownStartPoint = event.iPosition;
// Require focus to be shown
@@ -3991,41 +4020,21 @@
//
void CXnControlAdapterImpl::DoDrawL( const TRect& aRect, CWindowGc& aGc ) const
{
- if( !iComponent )
- {
- return;
- }
CXnNode& node = iComponent->Node()->Node();
DrawBordersL( aRect, node, aGc );
const_cast< CXnControlAdapterImpl* >( this )->DrawBackgroundDataL( aRect, node, aGc );
- if ( node.IsStateSet( XnPropertyNames::style::common::KFocus ) )
- {
- CXnProperty* prop( node.GetPropertyL(
- XnPropertyNames::common::KFocusAppearance ) );
-
- if ( prop && prop->StringValue() == XnPropertyNames::KNone )
- {
- // Current element refuses to draw focus appearance
- }
- else
- {
- DrawFocusAppearance( node, aGc );
- }
+ if ( iAdapter->IsFocused() )
+ {
+ DrawFocusAppearance( node, aGc );
}
// Draw plus sign for empty plugins in edit mode.
if( node.UiEngine()->EditMode()->EditState() )
{
- CXnControlAdapterImpl* adapter = const_cast< CXnControlAdapterImpl* >( this );
- TBool editstate = iNode.IsEditState();
-
- if( editstate )
- {
- adapter->DrawPlusSign( node, aGc );
- }
+ const_cast< CXnControlAdapterImpl* >( this )->DrawPlusSign( node, aGc );
}
if ( iAnimation )
@@ -4311,7 +4320,7 @@
// -----------------------------------------------------------------------------
//
void CXnControlAdapterImpl::DrawBackgroundImageL(
- const TRect& /*aRect*/,
+ const TRect& aRect,
CXnNode& aNode,
CWindowGc& aGc,
CFbsBitmap* aBitmap,
@@ -4402,7 +4411,7 @@
TPoint(
rect.iTl.iX + imageRect.Width(),
rect.iTl.iY + imageRect.Height() ) );
- //aGc.SetClippingRect( aRect );
+ aGc.SetClippingRect( aRect );
if ( aMask )
{
@@ -4419,7 +4428,7 @@
TPoint(
rect.iTl.iX + imageRect.Width(),
rect.iTl.iY + imageRect.Height() ) );
- //aGc.SetClippingRect( aRect );
+ aGc.SetClippingRect( aRect );
aGc.DrawBitmap( newRect, aBitmap, bitmapRect );
}
@@ -5723,26 +5732,22 @@
{
swipe = &XnPropertyNames::action::trigger::name::swipe::direction::KRight;
}
-
+
if ( swipe && iGestureDestination )
{
CXnUiEngine* engine = iNode.Node().UiEngine();
+ if ( iGestureDestination == &iNode.Node() )
+ {
+ CancelFocusRefusalL( *engine );
+ }
// Remove focus
engine->AppUiAdapter().HideFocus();
- if ( ( engine->AppUiAdapter().ViewSwitcher() != NULL ) &&
- ( engine->AppUiAdapter().ViewSwitcher()->FingerFollowSupported() ) &&
- ( !iGestureDestination || iGestureDestination == &iNode.Node() ) )
- {
- engine->AppUiAdapter().ViewSwitcher()->TouchGesture( type );
- }
- else if ( iGestureDestination )
- {
- CXnNode* trigger( BuildSwipeTriggerNodeLC( *engine, *swipe ) );
- iGestureDestination->ReportXuikonEventL( *trigger );
- CleanupStack::PopAndDestroy( trigger );
- }
+ CXnNode* trigger( BuildSwipeTriggerNodeLC( *engine, *swipe ) );
+ iGestureDestination->ReportXuikonEventL( *trigger );
+ CleanupStack::PopAndDestroy( trigger );
+
CXnAppUiAdapter& appui( engine->AppUiAdapter() );
CXnViewData& data( appui.ViewManager().ActiveViewData() );
@@ -5754,13 +5759,6 @@
}
}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-TBool CXnControlAdapterImpl::IsWidgetGestureDest()
- {
- return ( !iGestureDestination || iGestureDestination != &iNode.Node() );
- }
// ============================= TIconProvider ===============================