javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swttextbase.cpp
branchRCL_3
changeset 19 71c436fe3ce0
parent 18 9ac0a0a7da70
child 24 6c158198356e
equal deleted inserted replaced
18:9ac0a0a7da70 19:71c436fe3ce0
    15 #include <EIKCOCTL.rsg>
    15 #include <EIKCOCTL.rsg>
    16 #include <AknsUtils.h>
    16 #include <AknsUtils.h>
    17 #include <swtlaffacade.h>
    17 #include <swtlaffacade.h>
    18 #include <AknUtils.h>
    18 #include <AknUtils.h>
    19 #include <AknDef.h>
    19 #include <AknDef.h>
       
    20 #ifdef RD_JAVA_S60_RELEASE_9_2
       
    21 #include <AknPriv.hrh>
       
    22 #endif
       
    23 #include <aknappui.h>
       
    24 #include <akntouchpane.h>
    20 #include "swtscrollbar.h"
    25 #include "swtscrollbar.h"
    21 #include "swtfont.h"
    26 #include "swtfont.h"
    22 #include "swttextbase.h"
    27 #include "swttextbase.h"
    23 #include "swtcaptionedcontrol.h"
    28 #include "swtcaptionedcontrol.h"
    24 
    29 
   293         static_cast<CGlobalText*>(iEditor->Text())->
   298         static_cast<CGlobalText*>(iEditor->Text())->
   294         ApplyCharFormatL(charFormat, charMask, 0, iEditor->TextLength());
   299         ApplyCharFormatL(charFormat, charMask, 0, iEditor->TextLength());
   295         iTextColor = ETrue;
   300         iTextColor = ETrue;
   296     }
   301     }
   297     Redraw();
   302     Redraw();
       
   303 }
       
   304 
       
   305 void CSwtTextBase::SetBounds(const TRect& aRect)
       
   306 {
       
   307     // Divert the job to UiUtils if this is an editor open for split view editing.
       
   308     MSwtUiUtils& utils = iDisplay.UiUtils();
       
   309     if (utils.SplitInputView() == this)
       
   310     {
       
   311         utils.SetSplitInputViewSize(aRect.Size());
       
   312         SetLocation(aRect.iTl);
       
   313     }
       
   314     else
       
   315     {
       
   316         ASwtScrollableBase::SetBounds(aRect);
       
   317     }
       
   318 }
       
   319 
       
   320 void CSwtTextBase::SetWidgetSize(const TSize& aSize)
       
   321 {
       
   322     // Divert the job to UiUtils if this is an editor open for split view editing.
       
   323     MSwtUiUtils& utils = iDisplay.UiUtils();
       
   324     if (utils.SplitInputView() == this)
       
   325     {
       
   326         utils.SetSplitInputViewSize(aSize);
       
   327     }
       
   328     else
       
   329     {
       
   330         ASwtScrollableBase::SetWidgetSize(aSize);
       
   331     }
       
   332 }
       
   333 
       
   334 TSwtPeer CSwtTextBase::Dispose()
       
   335 {
       
   336     // Close VKB.
       
   337     if (iEditor->IsFocused())
       
   338     {
       
   339         CCoeFep* fep = iDisplay.CoeEnv()->Fep();
       
   340         if (fep)
       
   341         {
       
   342             fep->HandleDestructionOfFocusedItem();
       
   343         }
       
   344     }
       
   345     return ASwtScrollableBase::Dispose();
   298 }
   346 }
   299 
   347 
   300 // ---------------------------------------------------------------------------
   348 // ---------------------------------------------------------------------------
   301 // CSwtTextBase::ComputeDelta
   349 // CSwtTextBase::ComputeDelta
   302 // ---------------------------------------------------------------------------
   350 // ---------------------------------------------------------------------------
   708     if ((aVisible && oldVisibility) || (!aVisible && !oldVisibility))
   756     if ((aVisible && oldVisibility) || (!aVisible && !oldVisibility))
   709     {
   757     {
   710         return;
   758         return;
   711     }
   759     }
   712 
   760 
       
   761     // Close VKB. Do it here instead of FocusChange to avoid split input flicker.
       
   762     if (iEditor->IsFocused() && !aVisible)
       
   763     {
       
   764         CCoeFep* fep = iDisplay.CoeEnv()->Fep();
       
   765         if (fep)
       
   766         {
       
   767             fep->HandleDestructionOfFocusedItem();
       
   768         }
       
   769     }
       
   770 
   713     CCoeControl::MakeVisible(aVisible);
   771     CCoeControl::MakeVisible(aVisible);
   714     if (iEditor)
   772     if (iEditor)
   715     {
   773     {
   716         iEditor->MakeVisible(aVisible);
   774         iEditor->MakeVisible(aVisible);
   717 
   775 
   726             {
   784             {
   727                 sbFrame->ComponentControl(i)->MakeVisible(aVisible);
   785                 sbFrame->ComponentControl(i)->MakeVisible(aVisible);
   728             }
   786             }
   729         }
   787         }
   730     }
   788     }
       
   789 
   731     FocusabilityChanged();
   790     FocusabilityChanged();
   732 }
   791 }
   733 
   792 
   734 // ---------------------------------------------------------------------------
   793 // ---------------------------------------------------------------------------
   735 // CSwtTextBase::SetDimmed
   794 // CSwtTextBase::SetDimmed
   736 // From CCoeControl
   795 // From CCoeControl
   737 // ---------------------------------------------------------------------------
   796 // ---------------------------------------------------------------------------
   738 //
   797 //
   739 void CSwtTextBase::SetDimmed(TBool aDimmed)
   798 void CSwtTextBase::SetDimmed(TBool aDimmed)
   740 {
   799 {
       
   800     // Close VKB. Do it here instead of FocusChange to avoid split input flicker.
       
   801     if (iEditor->IsFocused() && aDimmed)
       
   802     {
       
   803         CCoeFep* fep = iDisplay.CoeEnv()->Fep();
       
   804         if (fep)
       
   805         {
       
   806             fep->HandleDestructionOfFocusedItem();
       
   807         }
       
   808     }
       
   809 
   741     CCoeControl::SetDimmed(aDimmed);
   810     CCoeControl::SetDimmed(aDimmed);
   742     if (iEditor)
   811     if (iEditor)
   743     {
   812     {
   744         iEditor->SetDimmed(aDimmed);
   813         iEditor->SetDimmed(aDimmed);
   745     }
   814     }
   773         else
   842         else
   774         {
   843         {
   775             ProcessFontUpdateL();
   844             ProcessFontUpdateL();
   776         }
   845         }
   777     }
   846     }
       
   847 #ifdef RD_JAVA_S60_RELEASE_9_2
       
   848     else if (aType == KAknSplitInputEnabled)
       
   849     {
       
   850         const MSwtShell* activeShell = iDisplay.UiUtils().GetActiveShell();
       
   851         if (activeShell && activeShell->FocusControl() == this)
       
   852         {
       
   853             iDisplay.UiUtils().SetSplitInputEditor(this);
       
   854         }
       
   855     }
       
   856 #endif
   778 }
   857 }
   779 
   858 
   780 // ---------------------------------------------------------------------------
   859 // ---------------------------------------------------------------------------
   781 // CSwtTextBase::FixPadding
   860 // CSwtTextBase::FixPadding
   782 // ---------------------------------------------------------------------------
   861 // ---------------------------------------------------------------------------
   799     CEikScrollBar* vsb = sbFrame ? sbFrame->GetScrollBarHandle(CEikScrollBar::EVertical) : NULL;
   878     CEikScrollBar* vsb = sbFrame ? sbFrame->GetScrollBarHandle(CEikScrollBar::EVertical) : NULL;
   800 
   879 
   801     TBool hit = ETrue;
   880     TBool hit = ETrue;
   802 
   881 
   803 #ifdef RD_JAVA_S60_RELEASE_9_2
   882 #ifdef RD_JAVA_S60_RELEASE_9_2
       
   883     TBool isActiveSplitEditor = iDisplay.UiUtils().SplitInputEditor() == this;
   804     hit = Rect().Contains(aPointerEvent.iPosition);
   884     hit = Rect().Contains(aPointerEvent.iPosition);
   805     TBool pressed = iPressed;
   885     TBool pressed = iPressed;
   806 #endif
   886 #endif
   807 
   887 
   808     // Check if we should start scrollbar grabbing
   888     // Check if we should start scrollbar grabbing
   813             iVScrollBarGrabsPointerEvents = ETrue;
   893             iVScrollBarGrabsPointerEvents = ETrue;
   814         }
   894         }
   815 #ifdef RD_JAVA_S60_RELEASE_9_2
   895 #ifdef RD_JAVA_S60_RELEASE_9_2
   816         else
   896         else
   817         {
   897         {
   818             iPressed = ETrue;
   898             iPressed = !isActiveSplitEditor;
   819         }
   899         }
   820 #endif
   900 #endif
   821     }
   901     }
   822 
   902 
   823     // Deliver event to scrollbar
   903     // Deliver event to scrollbar
   881 #endif
   961 #endif
   882     }
   962     }
   883 #ifdef RD_JAVA_S60_RELEASE_9_2
   963 #ifdef RD_JAVA_S60_RELEASE_9_2
   884     else if (aPointerEvent.iType == TPointerEvent::EDrag)
   964     else if (aPointerEvent.iType == TPointerEvent::EDrag)
   885     {
   965     {
   886         iPressed = hit;
   966         iPressed = hit && !iVScrollBarGrabsPointerEvents && !isActiveSplitEditor;
   887     }
   967     }
   888 
   968 
   889     if (pressed != iPressed)
   969     if (pressed != iPressed)
   890         Redraw();
   970         Redraw();
   891 #endif
   971 #endif
   892 
   972 
   893 #ifndef RD_JAVA_S60_RELEASE_9_2
   973 #ifndef RD_JAVA_S60_RELEASE_9_2
   894     // We got a pointer event, so any subsequent events should not be ignored.
   974     // We got a pointer event, so any subsequent events should not be ignored.
   895     iIgnorePointerDown = EFalse;
   975     iIgnorePointerDown = EFalse;
   896 #endif // RD_JAVA_S60_RELEASE_9_2
   976 #endif // RD_JAVA_S60_RELEASE_9_2
       
   977 
       
   978     PostMouseEventL(aPointerEvent);
   897 }
   979 }
   898 #else //RD_SCALABLE_UI_V2
   980 #else //RD_SCALABLE_UI_V2
   899 void CSwtTextBase::HandlePointerEventL(
   981 void CSwtTextBase::HandlePointerEventL(
   900     const TPointerEvent& /*aPointerEvent*/)
   982     const TPointerEvent& /*aPointerEvent*/)
   901 {
   983 {
   919         if (iIndicator)
  1001         if (iIndicator)
   920         {
  1002         {
   921             if (!IsFocused())
  1003             if (!IsFocused())
   922                 iIndicator->SetState(EStateNone);
  1004                 iIndicator->SetState(EStateNone);
   923         }
  1005         }
   924         
  1006 
   925         // Aparenlty this is the only way of forcing the VKB to close.
       
   926         if (iEditor->IsFocused() && !IsFocused())
       
   927         {
       
   928             iDisplay.CoeEnv()->Fep()->HandleDestructionOfFocusedItem();
       
   929         }
       
   930         
       
   931         iEditor->SetFocus(IsFocused());
  1007         iEditor->SetFocus(IsFocused());
   932     }
  1008     }
   933 
  1009 
   934     HandleFocusChanged(aDrawNow);
  1010     HandleFocusChanged(aDrawNow);
   935 }
  1011 }
   986         editorRect.iTl.iX += sbDelta.iWidth;
  1062         editorRect.iTl.iX += sbDelta.iWidth;
   987     }
  1063     }
   988 
  1064 
   989     iEditor->SetRect(editorRect);
  1065     iEditor->SetRect(editorRect);
   990     HandlePositionChanged();
  1066     HandlePositionChanged();
       
  1067 
       
  1068     // Notify change to UiUtils if this is an editor open for split view editing.
       
  1069     MSwtUiUtils& utils = iDisplay.UiUtils();
       
  1070     if (utils.SplitInputView() == this)
       
  1071     {
       
  1072         utils.AdjustSplitInputShellPos();
       
  1073     }
   991 }
  1074 }
   992 
  1075 
   993 // ---------------------------------------------------------------------------
  1076 // ---------------------------------------------------------------------------
   994 // CSwtTextBase::SizeChanged
  1077 // CSwtTextBase::SizeChanged
   995 // From CCoeControl
  1078 // From CCoeControl