src/hbwidgets/widgets/hbcombobox_p.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
--- a/src/hbwidgets/widgets/hbcombobox_p.cpp	Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbwidgets/widgets/hbcombobox_p.cpp	Mon Oct 04 00:38:12 2010 +0300
@@ -174,10 +174,10 @@
             mDropDown->mList->setCurrentIndex( 
                 mModel->index( 0, 0 ), QItemSelectionModel::Select );
         }
+        positionDropDown( );
         #ifdef HB_EFFECTS
         HbEffect::start( mDropDown, HB_DROPD0WN_ITEM_TYPE, "appear" );
         #endif
-        positionDropDown( );
     }
 }
 
@@ -211,7 +211,12 @@
             mDropDown->mList->scrollTo( aModel->index( 0, 0 ) );
         }
         positionDropDown( );
-        mDropDown->setVisible( true );
+        if( !mDropDown->isVisible( ) ) {
+            mDropDown->setVisible( true );
+            #ifdef HB_EFFECTS
+            HbEffect::start( mDropDown, HB_DROPD0WN_ITEM_TYPE, "appear" );
+            #endif
+        }
     }
 }
 
@@ -261,6 +266,15 @@
     }
 }
 
+void HbComboBoxPrivate::showDismissEffect( )
+{
+    #ifdef HB_EFFECTS
+    HbEffect::start( mDropDown, HB_DROPD0WN_ITEM_TYPE, "disappear", mDropDown, "dismissEffectFinished" );
+    #else
+    mDropDown->setVisible( false );
+    #endif
+}
+
 void HbComboBoxPrivate::positionDropDown( )
 {
     Q_Q( HbComboBox );
@@ -293,17 +307,15 @@
             if ( !mHasDownEffect ) {
                  mHasDownEffect = true;
                  mHasUpEffect = false;
-                 // this is temporary until proper effect theming comes.
                  //this Effect will be shown when there is space in the view bottom.
                  HbEffectInternal::add( mDropDown, "combo_appear_down", "appear" );
-                 HbEffectInternal::add( mDropDown, "combo_disappear_downl", "disappear" );
+                 HbEffectInternal::add( mDropDown, "combo_disappear_down", "disappear" );
             }
             #endif
         } else if( widgetPos.y( ) - maxPopupHeight  > 0.0 ) {
             popupPos = QPointF( widgetPos.x( ), widgetPos.y( ) - maxPopupHeight );
             #ifdef HB_EFFECTS
             if ( !mHasUpEffect ) {
-                 // this is temporary until proper effect theming comes.
                  //this Effect will be shown when there is no space in the view bottom
                  mHasUpEffect = true;
                  mHasDownEffect = false;
@@ -319,7 +331,6 @@
                 if ( !mHasDownEffect ) {
                     mHasDownEffect = true;
                     mHasUpEffect = false;
-                    // this is temporary until proper effect theming comes.
                     //this Effect will be shown when there is more space in the view bottom.
                     HbEffectInternal::add( mDropDown, "combo_appear_down", "appear" );
                     HbEffectInternal::add( mDropDown, "combo_disappear_down", "disappear" );
@@ -331,7 +342,6 @@
                 if ( !mHasUpEffect ) {
                      mHasUpEffect = true;
                      mHasDownEffect = false;
-                     // this is temporary until proper effect theming comes.
                      //this Effect will be shown when there is more space in the view bottom.
                      HbEffectInternal::add( mDropDown, "combo_appear_up", "appear" );
                      HbEffectInternal::add( mDropDown, "combo_disappear_up", "disappear" );
@@ -365,7 +375,6 @@
                 if ( !mHasUpEffect ) {
                      mHasUpEffect = true;
                      mHasDownEffect = false;
-                     // this is temporary until proper effect theming comes.
                      //this Effect will be shown when there is more space in the view bottom.
                      HbEffectInternal::add( mDropDown, "combo_appear_up", "appear" );
                      HbEffectInternal::add( mDropDown, "combo_disappear_up", "disappear" );
@@ -381,7 +390,6 @@
                 if ( !mHasDownEffect ) {
                     mHasDownEffect = true;
                     mHasUpEffect = false;
-                    // this is temporary until proper effect theming comes.
                     //this Effect will be shown when there is more space in the view bottom.
                     HbEffectInternal::add( mDropDown, "combo_appear_down", "appear" );
                     HbEffectInternal::add( mDropDown, "combo_disappear_down", "disappear" );
@@ -433,7 +441,7 @@
            SLOT( _q_textChanged( QString ) ) );
     }
     if ( mDropDown->isVisible( ) ) {
-        mDropDown->setVisible( false );
+        showDismissEffect( );
         q->setProperty( "state", "normal" );
     }
     currentIndexChanged( mCurrentIndex );
@@ -462,7 +470,7 @@
         }
     } else {
         if( mDropDown ) {
-            mDropDown->setVisible( false );
+            showDismissEffect( );
         }
         //showPopup( mModel, mCurrentIndex);
     }