javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtuiutils.cpp
branchRCL_3
changeset 34 71c436fe3ce0
parent 24 0fd27995241b
child 60 6c158198356e
equal deleted inserted replaced
25:9ac0a0a7da70 34:71c436fe3ce0
    22 #include <AknsUtils.h>
    22 #include <AknsUtils.h>
    23 #include <eswtcore.rsg>
    23 #include <eswtcore.rsg>
    24 #include <AknUtils.h>
    24 #include <AknUtils.h>
    25 #include <AknsDrawUtils.h>
    25 #include <AknsDrawUtils.h>
    26 #include <AknTextDecorationMetrics.h>
    26 #include <AknTextDecorationMetrics.h>
       
    27 #ifdef RD_JAVA_S60_RELEASE_9_2
       
    28 #include <AknPriv.hrh>
       
    29 #include <aknappui.h>
       
    30 #endif
    27 #include <coreuiavkoneswt.h>
    31 #include <coreuiavkoneswt.h>
    28 #include <swtlaffacade.h>
    32 #include <swtlaffacade.h>
    29 #include "eswtmobileextensions.h"
    33 #include "eswtmobileextensions.h"
    30 #include "eswtwidgetsexpanded.h"
    34 #include "eswtwidgetsexpanded.h"
    31 #include "swtcontrolhelper.h"
    35 #include "swtcontrolhelper.h"
   348         iLastTopMostShell = NULL;
   352         iLastTopMostShell = NULL;
   349         TRAP_IGNORE(UpdateStatusPaneL());
   353         TRAP_IGNORE(UpdateStatusPaneL());
   350     }
   354     }
   351 }
   355 }
   352 
   356 
   353 
       
   354 // ---------------------------------------------------------------------------
       
   355 // CSwtUiUtils::SetPointerCaptureControl
       
   356 // ---------------------------------------------------------------------------
       
   357 //
       
   358 void CSwtUiUtils::SetPointerCaptureControl(MSwtControl* aControl)
       
   359 {
       
   360     if (aControl)
       
   361     {
       
   362         iPointerCaptureControl = aControl;
       
   363     }
       
   364     else
       
   365     {
       
   366         iPointerCaptureControl = NULL;
       
   367     }
       
   368 }
       
   369 
       
   370 // ---------------------------------------------------------------------------
       
   371 // CSwtUiUtils::PointerCaptureControl
       
   372 // ---------------------------------------------------------------------------
       
   373 //
       
   374 MSwtControl* CSwtUiUtils::PointerCaptureControl()
       
   375 {
       
   376     return iPointerCaptureControl;
       
   377 }
       
   378 
       
   379 // ---------------------------------------------------------------------------
   357 // ---------------------------------------------------------------------------
   380 // CSwtUiUtils::SetNextFocusedControl
   358 // CSwtUiUtils::SetNextFocusedControl
   381 // ---------------------------------------------------------------------------
   359 // ---------------------------------------------------------------------------
   382 //
   360 //
   383 void CSwtUiUtils::SetNextFocusedControl(MSwtControl* aNextFocusedControl)
   361 void CSwtUiUtils::SetNextFocusedControl(MSwtControl* aNextFocusedControl)
   557                 ESwtWinPriorityStatusPane);
   535                 ESwtWinPriorityStatusPane);
   558         }
   536         }
   559     }
   537     }
   560 
   538 
   561     // Title pane priority.
   539     // Title pane priority.
       
   540     ctrl = NULL;
   562     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   541     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   563                            TUid::Uid(EEikStatusPaneUidTitle)));
   542                            TUid::Uid(EEikStatusPaneUidTitle)));
   564     if (ctrl)
   543     if (ctrl)
   565     {
   544     {
   566         win = ctrl->DrawableWindow();
   545         win = ctrl->DrawableWindow();
   571                 ESwtWinPriorityStatusPane);
   550                 ESwtWinPriorityStatusPane);
   572         }
   551         }
   573     }
   552     }
   574 
   553 
   575     // Navi pane priority.
   554     // Navi pane priority.
       
   555     ctrl = NULL;
   576     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   556     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   577                            TUid::Uid(EEikStatusPaneUidNavi)));
   557                            TUid::Uid(EEikStatusPaneUidNavi)));
   578     if (ctrl)
   558     if (ctrl)
   579     {
   559     {
   580         win = ctrl->DrawableWindow();
   560         win = ctrl->DrawableWindow();
   585                 ESwtWinPriorityStatusPane);
   565                 ESwtWinPriorityStatusPane);
   586         }
   566         }
   587     }
   567     }
   588 
   568 
   589     // Empty pane priority.
   569     // Empty pane priority.
       
   570     ctrl = NULL;
   590     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   571     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   591                            TUid::Uid(EEikStatusPaneUidEmpty)));
   572                            TUid::Uid(EEikStatusPaneUidEmpty)));
   592     if (ctrl)
   573     if (ctrl)
   593     {
   574     {
   594         win = ctrl->DrawableWindow();
   575         win = ctrl->DrawableWindow();
   599                 ESwtWinPriorityStatusPane);
   580                 ESwtWinPriorityStatusPane);
   600         }
   581         }
   601     }
   582     }
   602 
   583 
   603     // Indi pane priority.
   584     // Indi pane priority.
       
   585     ctrl = NULL;
   604     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   586     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   605                            TUid::Uid(EEikStatusPaneUidIndic)));
   587                            TUid::Uid(EEikStatusPaneUidIndic)));
   606     if (ctrl)
   588     if (ctrl)
   607     {
   589     {
   608         win = ctrl->DrawableWindow();
   590         win = ctrl->DrawableWindow();
   613                 ESwtWinPriorityStatusPane);
   595                 ESwtWinPriorityStatusPane);
   614         }
   596         }
   615     }
   597     }
   616 
   598 
   617     // Clock pane priority.
   599     // Clock pane priority.
       
   600     ctrl = NULL;
   618     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   601     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   619                            TUid::Uid(EEikStatusPaneUidClock)));
   602                            TUid::Uid(EEikStatusPaneUidClock)));
   620     if (ctrl)
   603     if (ctrl)
   621     {
   604     {
   622         win = ctrl->DrawableWindow();
   605         win = ctrl->DrawableWindow();
   627                 ESwtWinPriorityStatusPane);
   610                 ESwtWinPriorityStatusPane);
   628         }
   611         }
   629     }
   612     }
   630 
   613 
   631     // Digital clock pane priority.
   614     // Digital clock pane priority.
       
   615     ctrl = NULL;
   632     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   616     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   633                            TUid::Uid(EEikStatusPaneUidDigitalClock)));
   617                            TUid::Uid(EEikStatusPaneUidDigitalClock)));
   634     if (ctrl)
   618     if (ctrl)
   635     {
   619     {
   636         win = ctrl->DrawableWindow();
   620         win = ctrl->DrawableWindow();
   641                 ESwtWinPriorityStatusPane);
   625                 ESwtWinPriorityStatusPane);
   642         }
   626         }
   643     }
   627     }
   644 
   628 
   645     // Signal pane priority.
   629     // Signal pane priority.
       
   630     ctrl = NULL;
   646     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   631     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   647                            TUid::Uid(EEikStatusPaneUidSignal)));
   632                            TUid::Uid(EEikStatusPaneUidSignal)));
   648     if (ctrl)
   633     if (ctrl)
   649     {
   634     {
   650         win = ctrl->DrawableWindow();
   635         win = ctrl->DrawableWindow();
   655                 ESwtWinPriorityStatusPane);
   640                 ESwtWinPriorityStatusPane);
   656         }
   641         }
   657     }
   642     }
   658 
   643 
   659     // Battery pane priority.
   644     // Battery pane priority.
       
   645     ctrl = NULL;
   660     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   646     TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL(
   661                            TUid::Uid(EEikStatusPaneUidBattery)));
   647                            TUid::Uid(EEikStatusPaneUidBattery)));
   662     if (ctrl)
   648     if (ctrl)
   663     {
   649     {
   664         win = ctrl->DrawableWindow();
   650         win = ctrl->DrawableWindow();
   845     }
   831     }
   846     ASSERT(iInlineFont);
   832     ASSERT(iInlineFont);
   847     return *iInlineFont;
   833     return *iInlineFont;
   848 }
   834 }
   849 
   835 
       
   836 // ---------------------------------------------------------------------------
       
   837 // CSwtUiUtils::HideIndicator
       
   838 // ---------------------------------------------------------------------------
       
   839 //
   850 void CSwtUiUtils::HideIndicator(TInt aId)
   840 void CSwtUiUtils::HideIndicator(TInt aId)
   851 {
   841 {
   852     TUid uid = TUid::Uid(aId);
   842     TUid uid = TUid::Uid(aId);
   853     CEikStatusPaneBase::TPaneCapabilities subPane = iStatusPane->PaneCapabilities(uid);
   843     CEikStatusPaneBase::TPaneCapabilities subPane = iStatusPane->PaneCapabilities(uid);
   854     if (subPane.IsPresent() && subPane.IsAppOwned())
   844     if (subPane.IsPresent() && subPane.IsAppOwned())
   860             ctrl->MakeVisible(EFalse);
   850             ctrl->MakeVisible(EFalse);
   861         }
   851         }
   862     }
   852     }
   863 }
   853 }
   864 
   854 
       
   855 // ---------------------------------------------------------------------------
       
   856 // CSwtUiUtils::HideIndicators
       
   857 // ---------------------------------------------------------------------------
       
   858 //
   865 void CSwtUiUtils::HideIndicators()
   859 void CSwtUiUtils::HideIndicators()
   866 {
   860 {
   867     if (!iStatusPane)
   861     if (!iStatusPane)
   868         return;
   862         return;
   869 
   863 
   871     HideIndicator(EEikStatusPaneUidBattery);
   865     HideIndicator(EEikStatusPaneUidBattery);
   872     HideIndicator(EEikStatusPaneUidIndic);
   866     HideIndicator(EEikStatusPaneUidIndic);
   873     HideIndicator(EEikStatusPaneUidMessage);
   867     HideIndicator(EEikStatusPaneUidMessage);
   874     HideIndicator(EEikStatusPaneUidClock);
   868     HideIndicator(EEikStatusPaneUidClock);
   875     HideIndicator(EEikStatusPaneUidDigitalClock);
   869     HideIndicator(EEikStatusPaneUidDigitalClock);
       
   870 }
       
   871 
       
   872 // ---------------------------------------------------------------------------
       
   873 // CSwtUiUtils::DoSetSplitInputShellPos
       
   874 // ---------------------------------------------------------------------------
       
   875 //
       
   876 void CSwtUiUtils::DoSetSplitInputShellPos(const TPoint& aPos)
       
   877 {
       
   878     MSwtShell& shell = iSplitInputView->GetShell();
       
   879     MSwtControl* temp = iSplitInputView;
       
   880     iSplitInputView = 0; // stop recursion.
       
   881     shell.DoSetLocation(aPos);
       
   882     iSplitInputView = temp;
       
   883 }
       
   884 
       
   885 // ---------------------------------------------------------------------------
       
   886 // CSwtUiUtils::DoSetSplitInputViewSize
       
   887 // ---------------------------------------------------------------------------
       
   888 //
       
   889 void CSwtUiUtils::DoSetSplitInputViewSize(const TSize& aSize)
       
   890 {
       
   891     MSwtControl* temp = iSplitInputView;
       
   892     iSplitInputView = 0; // stop recursion.
       
   893     temp->SetWidgetSize(aSize);
       
   894     iSplitInputView = temp;
       
   895 }
       
   896 
       
   897 // ---------------------------------------------------------------------------
       
   898 // CSwtUiUtils::ScrolledCompositeAncestor
       
   899 // ---------------------------------------------------------------------------
       
   900 //
       
   901 MSwtControl* CSwtUiUtils::ScrolledCompositeAncestor(const MSwtControl& aControl) const
       
   902 {
       
   903     MSwtComposite* parent = aControl.GetParent();
       
   904     const MSwtControl* control = &aControl;
       
   905     while (parent)
       
   906     {
       
   907         if (parent->ScrolledCompositeContent() == control)
       
   908         {
       
   909             return parent->Control();
       
   910         }
       
   911         control = parent->Control();
       
   912         parent = parent->Control()->GetParent();
       
   913     }
       
   914 
       
   915     return 0;
   876 }
   916 }
   877 
   917 
   878 // ---------------------------------------------------------------------------
   918 // ---------------------------------------------------------------------------
   879 // CSwtUiUtils::GetSystemColor
   919 // CSwtUiUtils::GetSystemColor
   880 // From MSwtUiUtils
   920 // From MSwtUiUtils
  1147     }
  1187     }
  1148 
  1188 
  1149     MSwtShell* topShell = TopMostTopShell();
  1189     MSwtShell* topShell = TopMostTopShell();
  1150     if (!topShell || topShell->FullScreenMode())
  1190     if (!topShell || topShell->FullScreenMode())
  1151     {
  1191     {
  1152         if (iStatusPane->IsVisible())
  1192         if (iSplitInputEditor)
  1153         {
  1193         {
  1154             iStatusPane->SetObserver(NULL);
  1194             // Split input editing is ongoing and the status pane is hidden.
  1155             iStatusPane->MakeVisible(EFalse);
  1195             // Cache the new status pane visibility for when the split input ends.
       
  1196             iSplitInputSPVisible = EFalse;
       
  1197         }
       
  1198         else
       
  1199         {
       
  1200             if (iStatusPane->IsVisible())
       
  1201             {
       
  1202                 iStatusPane->SetObserver(NULL);
       
  1203                 iStatusPane->MakeVisible(EFalse);
       
  1204             }
  1156         }
  1205         }
  1157         return;
  1206         return;
  1158     }
  1207     }
  1159 
  1208 
  1160     // Title
  1209     // Title
  1259 
  1308 
  1260     // Style changed last to avoid flickering
  1309     // Style changed last to avoid flickering
  1261     iStatusPane->SetObserver(NULL);
  1310     iStatusPane->SetObserver(NULL);
  1262     if (!topShell || style == MSwtShell::EStyleNoStatusPane)
  1311     if (!topShell || style == MSwtShell::EStyleNoStatusPane)
  1263     {
  1312     {
  1264         iStatusPane->MakeVisible(EFalse);
  1313         if (iSplitInputEditor)
       
  1314         {
       
  1315             // Split input editing is ongoing and the status pane is hidden.
       
  1316             // Cache the new status pane visibility for when the split input ends.
       
  1317             iSplitInputSPVisible = EFalse;
       
  1318         }
       
  1319         else
       
  1320         {
       
  1321             iStatusPane->MakeVisible(EFalse);
       
  1322         }
  1265     }
  1323     }
  1266     else
  1324     else
  1267     {
  1325     {
  1268         if (style == MSwtShell::EStyleLargeStatusPane)
  1326         if (style == MSwtShell::EStyleLargeStatusPane)
  1269         {
  1327         {
  1271         }
  1329         }
  1272         else if (style == MSwtShell::EStyleSmallStatusPane)
  1330         else if (style == MSwtShell::EStyleSmallStatusPane)
  1273         {
  1331         {
  1274             iStatusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE);
  1332             iStatusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE);
  1275         }
  1333         }
  1276         iStatusPane->MakeVisible(ETrue);
  1334 
  1277 
  1335         if (iSplitInputEditor)
  1278         java::ui::CoreUiAvkonAppUi* appUi = java::ui::CoreUiAvkonEswt::getInstance().getJavaUiAppUi();
  1336         {
  1279         if (appUi && appUi->hidesIndicators())
  1337             // Split input editing is ongoing and the status pane is hidden.
  1280         {
  1338             // Cache the new status pane visibility for when the split input ends.
  1281             HideIndicators();
  1339             iSplitInputSPVisible = ETrue;
  1282         }
  1340         }
  1283 
  1341         else
  1284         // The above relies on DrawDeferred which is too slow for some cases.
  1342         {
  1285         // For instance, the pane must draw immediately when the app draws the
  1343             iStatusPane->MakeVisible(ETrue);
  1286         // first time otherwise the startup screenshot will miss the pane.
  1344 
  1287         iStatusPane->DrawNow();
  1345             java::ui::CoreUiAvkonAppUi* appUi = java::ui::CoreUiAvkonEswt::getInstance().getJavaUiAppUi();
       
  1346             if (appUi && appUi->hidesIndicators())
       
  1347             {
       
  1348                 HideIndicators();
       
  1349             }
       
  1350 
       
  1351             // The above relies on DrawDeferred which is too slow for some cases.
       
  1352             // For instance, the pane must draw immediately when the app draws the
       
  1353             // first time otherwise the startup screenshot will miss the pane.
       
  1354             iStatusPane->DrawNow();
       
  1355         }
  1288     }
  1356     }
  1289 
  1357 
  1290     // This will cause HandleStatusPaneSizeChange notifications again
  1358     // This will cause HandleStatusPaneSizeChange notifications again
  1291     iStatusPane->SetObserver(this);
  1359     if (!iSplitInputEditor)
       
  1360     {
       
  1361         iStatusPane->SetObserver(this);
       
  1362     }
  1292 
  1363 
  1293     // Shells are trusted to have the correct size already.
  1364     // Shells are trusted to have the correct size already.
  1294 }
  1365 }
  1295 
  1366 
  1296 // ---------------------------------------------------------------------------
  1367 // ---------------------------------------------------------------------------
  1542         if (shell != iActiveShell)
  1613         if (shell != iActiveShell)
  1543         {
  1614         {
  1544             shell->Control()->CoeControl().HandleResourceChange(aType);
  1615             shell->Control()->CoeControl().HandleResourceChange(aType);
  1545         }
  1616         }
  1546     }
  1617     }
       
  1618 #ifdef RD_JAVA_S60_RELEASE_9_2
       
  1619     if (aType == KAknSplitInputDisabled)
       
  1620     {
       
  1621         SetSplitInputEditor(0);
       
  1622     }
       
  1623 #endif
  1547 }
  1624 }
  1548 
  1625 
  1549 // ---------------------------------------------------------------------------
  1626 // ---------------------------------------------------------------------------
  1550 // CSwtUiUtils::ScrollBarBreadth
  1627 // CSwtUiUtils::ScrollBarBreadth
  1551 // From MSwtUiUtils
  1628 // From MSwtUiUtils
  1671     TRect mainPaneRect = layoutMainPane.Rect();
  1748     TRect mainPaneRect = layoutMainPane.Rect();
  1672     TAknLayoutRect layoutShell = CSwtLafFacade::GetLayoutRect(
  1749     TAknLayoutRect layoutShell = CSwtLafFacade::GetLayoutRect(
  1673                                      CSwtLafFacade::EPopupEswtTasktipWindow,
  1750                                      CSwtLafFacade::EPopupEswtTasktipWindow,
  1674                                      mainPaneRect);
  1751                                      mainPaneRect);
  1675     return layoutShell.Rect();
  1752     return layoutShell.Rect();
       
  1753 }
       
  1754 
       
  1755 // ---------------------------------------------------------------------------
       
  1756 // CSwtUiUtils::SetPointerCaptureControl
       
  1757 // From MSwtUtils
       
  1758 // ---------------------------------------------------------------------------
       
  1759 //
       
  1760 void CSwtUiUtils::SetPointerCaptureControl(MSwtControl* aControl)
       
  1761 {
       
  1762     if (aControl)
       
  1763     {
       
  1764         iPointerCaptureControl = aControl;
       
  1765     }
       
  1766     else
       
  1767     {
       
  1768         iPointerCaptureControl = NULL;
       
  1769     }
       
  1770 }
       
  1771 
       
  1772 // ---------------------------------------------------------------------------
       
  1773 // CSwtUiUtils::PointerCaptureControl
       
  1774 // From MSwtUtils
       
  1775 // ---------------------------------------------------------------------------
       
  1776 //
       
  1777 MSwtControl* CSwtUiUtils::PointerCaptureControl()
       
  1778 {
       
  1779     return iPointerCaptureControl;
       
  1780 }
       
  1781 
       
  1782 // ---------------------------------------------------------------------------
       
  1783 // CSwtUiUtils::SetSplitInputEditor
       
  1784 // From MSwtUtils
       
  1785 // ---------------------------------------------------------------------------
       
  1786 //
       
  1787 void CSwtUiUtils::SetSplitInputEditor(MSwtControl* aEditor)
       
  1788 {
       
  1789     if (iSplitInputEditor == aEditor)
       
  1790     {
       
  1791         // This can happen when pressing Enter in a multi line editor.
       
  1792         return;
       
  1793     }
       
  1794 
       
  1795     CAknAppUi* appUi = (CAknAppUi*)iDisplay.CoeEnv()->EikAppUi();
       
  1796 
       
  1797     if (aEditor)
       
  1798     {
       
  1799         MSwtShell& shell = aEditor->GetShell();
       
  1800         MSwtControl* view = ScrolledCompositeAncestor(*aEditor);
       
  1801         TBool editorSwitch(iSplitInputEditor != 0);
       
  1802         TBool keepView(view && view == iSplitInputView);
       
  1803         TBool keepShell(editorSwitch && ((&iSplitInputEditor->GetShell()) == (&shell)));
       
  1804 
       
  1805         if (editorSwitch)
       
  1806         {
       
  1807             if (!keepShell)
       
  1808             {
       
  1809                 // Move back the previous split input Shell keeping the SP hidden.
       
  1810                 DoSetSplitInputShellPos(iSplitInputShellPos);
       
  1811             }
       
  1812             // Otherwise no need for the shell to restore its original
       
  1813             // position as it is going to be moved again right after this.
       
  1814 
       
  1815             if (!keepView)
       
  1816             {
       
  1817                 // Resize back the previous split input view
       
  1818                 DoSetSplitInputViewSize(iSplitInputViewSize);
       
  1819             }
       
  1820         }
       
  1821 
       
  1822         iSplitInputEditor = aEditor;
       
  1823         iSplitInputView = view;
       
  1824         if (!iSplitInputView)
       
  1825         {
       
  1826             iSplitInputView = iSplitInputEditor;
       
  1827         }
       
  1828 
       
  1829         if (!editorSwitch || !keepShell)
       
  1830         {
       
  1831             iSplitInputShellPos = shell.Control()->GetLocation();
       
  1832         }
       
  1833 
       
  1834         if (!editorSwitch)
       
  1835         {
       
  1836             iSplitInputSPVisible = iStatusPane->IsVisible();
       
  1837         }
       
  1838 
       
  1839         if (iStatusPane->IsVisible())
       
  1840         {
       
  1841             // Hide the SP. The observer must be cleared before so that
       
  1842             // HandleStatusPaneSizeChange is not called on the Shell.
       
  1843             iStatusPane->SetObserver(NULL);
       
  1844             iStatusPane->MakeVisible(EFalse);
       
  1845         }
       
  1846 
       
  1847         if (!keepView)
       
  1848         {
       
  1849             iSplitInputViewSize = TSize(0, 0);
       
  1850             SetSplitInputViewSize(iSplitInputView->GetWidgetSize());
       
  1851         }
       
  1852 
       
  1853         if (!editorSwitch && view)
       
  1854         {
       
  1855             TRAP_IGNORE(iDisplay.PostShowFocusedControlEventL(view->JavaPeer()));
       
  1856         }
       
  1857     }
       
  1858     else
       
  1859     {
       
  1860         ASSERT(iSplitInputEditor);
       
  1861         if (iSplitInputSPVisible)
       
  1862         {
       
  1863             iStatusPane->MakeVisible(ETrue);
       
  1864             iStatusPane->SetObserver(this);
       
  1865         }
       
  1866         DoSetSplitInputShellPos(iSplitInputShellPos);
       
  1867         DoSetSplitInputViewSize(iSplitInputViewSize);
       
  1868         iSplitInputEditor = 0;
       
  1869         iSplitInputView = 0;
       
  1870     }
       
  1871 }
       
  1872 
       
  1873 // ---------------------------------------------------------------------------
       
  1874 // CSwtUiUtils::SetSplitInputEditor
       
  1875 // From MSwtUtils
       
  1876 // ---------------------------------------------------------------------------
       
  1877 //
       
  1878 MSwtControl* CSwtUiUtils::SplitInputEditor() const
       
  1879 {
       
  1880     return iSplitInputEditor;
       
  1881 }
       
  1882 
       
  1883 // ---------------------------------------------------------------------------
       
  1884 // CSwtUiUtils::SetSplitInputEditor
       
  1885 // From MSwtUtils
       
  1886 // ---------------------------------------------------------------------------
       
  1887 //
       
  1888 MSwtControl* CSwtUiUtils::SplitInputView() const
       
  1889 {
       
  1890     return iSplitInputView;
       
  1891 }
       
  1892 
       
  1893 // ---------------------------------------------------------------------------
       
  1894 // CSwtUiUtils::SetSplitInputShellPos
       
  1895 // From MSwtUtils
       
  1896 // ---------------------------------------------------------------------------
       
  1897 //
       
  1898 void CSwtUiUtils::SetSplitInputShellPos(const TPoint& aOriginalPos)
       
  1899 {
       
  1900     iSplitInputShellPos = aOriginalPos;
       
  1901 }
       
  1902 
       
  1903 // ---------------------------------------------------------------------------
       
  1904 // CSwtUiUtils::SetSplitInputViewSize
       
  1905 // From MSwtUtils
       
  1906 // ---------------------------------------------------------------------------
       
  1907 //
       
  1908 void CSwtUiUtils::SetSplitInputViewSize(const TSize& aOriginalSize)
       
  1909 {
       
  1910     if (aOriginalSize == iSplitInputViewSize)
       
  1911     {
       
  1912         return;
       
  1913     }
       
  1914 
       
  1915     // Remember the size of the editor and resize it if needed
       
  1916     // to fit into remaining space above the vkb.
       
  1917     iSplitInputViewSize = aOriginalSize;
       
  1918     CAknAppUi* appUi = (CAknAppUi*)iDisplay.CoeEnv()->EikAppUi();
       
  1919     TRect appUiRect(appUi->ClientRect());
       
  1920     TSize size(iSplitInputViewSize);
       
  1921     if (size.iHeight > appUiRect.Height())
       
  1922     {
       
  1923         size.iHeight = appUiRect.Height();
       
  1924     }
       
  1925     DoSetSplitInputViewSize(size);
       
  1926     AdjustSplitInputShellPos();
       
  1927 }
       
  1928 
       
  1929 // ---------------------------------------------------------------------------
       
  1930 // CSwtUiUtils::AdjustSplitInputShellPos
       
  1931 // From MSwtUtils
       
  1932 // ---------------------------------------------------------------------------
       
  1933 //
       
  1934 void CSwtUiUtils::AdjustSplitInputShellPos()
       
  1935 {
       
  1936     if (!iSplitInputView)
       
  1937     {
       
  1938         return;
       
  1939     }
       
  1940 
       
  1941     CAknAppUi *appUi = (CAknAppUi*)(iDisplay.CoeEnv()->EikAppUi());
       
  1942     TInt appUiHeight(appUi->ClientRect().Height());
       
  1943     MSwtShell & shell = iSplitInputView->GetShell();
       
  1944     TInt shellHeight(shell.Control()->GetWidgetSize().iHeight);
       
  1945     TRect rect(iSplitInputView->VisibleRect());
       
  1946     TInt y(-rect.iTl.iY + (appUiHeight - rect.Height()) / 2);
       
  1947     if (y < (appUiHeight - shellHeight))
       
  1948         y = appUiHeight - shellHeight;
       
  1949 
       
  1950     if (!shell.GetParentShell())
       
  1951     {
       
  1952         if (y > 0)
       
  1953             y = 0;
       
  1954     }
       
  1955     else
       
  1956     {
       
  1957         if (y > iSplitInputShellPos.iY)
       
  1958             y = iSplitInputShellPos.iY;
       
  1959 
       
  1960     }
       
  1961     DoSetSplitInputShellPos(TPoint(iSplitInputShellPos.iX, y));
  1676 }
  1962 }
  1677 
  1963 
  1678 // ---------------------------------------------------------------------------
  1964 // ---------------------------------------------------------------------------
  1679 // CSwtUiUtils::HandleFreeRamEventL
  1965 // CSwtUiUtils::HandleFreeRamEventL
  1680 // From MSwtUiUtils
  1966 // From MSwtUiUtils
  1775 
  2061 
  1776     // Shouldnt happen
  2062     // Shouldnt happen
  1777     return NULL;
  2063     return NULL;
  1778 }
  2064 }
  1779 
  2065 
       
  2066 // ---------------------------------------------------------------------------
       
  2067 // CSwtUiUtils::SetShellFade
       
  2068 // ---------------------------------------------------------------------------
       
  2069 //
  1780 void CSwtUiUtils::SetShellFade(MSwtShell* aShell, TBool aStatus)
  2070 void CSwtUiUtils::SetShellFade(MSwtShell* aShell, TBool aStatus)
  1781 {
  2071 {
  1782     if (CanBeFaded(aShell))
  2072     if (CanBeFaded(aShell))
  1783     {
  2073     {
  1784         if (aStatus)
  2074         if (aStatus)
  1791             iFadingShell = NULL;
  2081             iFadingShell = NULL;
  1792         }
  2082         }
  1793     }
  2083     }
  1794 }
  2084 }
  1795 
  2085 
       
  2086 // ---------------------------------------------------------------------------
       
  2087 // CSwtUiUtils::CanBeFaded
       
  2088 // ---------------------------------------------------------------------------
       
  2089 //
  1796 TBool CSwtUiUtils::CanBeFaded(MSwtShell* aShell) const
  2090 TBool CSwtUiUtils::CanBeFaded(MSwtShell* aShell) const
  1797 {
  2091 {
  1798     return (aShell && aShell->GetParentShell() && IsApplicationModal(*aShell));
  2092     return (aShell && aShell->GetParentShell() && IsApplicationModal(*aShell));
  1799 }
  2093 }
       
  2094