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) |
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 |
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 // --------------------------------------------------------------------------- |
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 |