src/hbcore/vkbhosts/hbshrinkingvkbhost.cpp
changeset 30 80e4d18b72f5
parent 6 c3690ec91ef8
equal deleted inserted replaced
28:b7da29130b0e 30:80e4d18b72f5
    32 #include "hbmainwindow.h"
    32 #include "hbmainwindow.h"
    33 #include "hbmainwindow_p.h"
    33 #include "hbmainwindow_p.h"
    34 
    34 
    35 /*!
    35 /*!
    36 \proto
    36 \proto
       
    37 @hbcore
    37 \class HbShrinkingVkbHost
    38 \class HbShrinkingVkbHost
    38 \brief A virtual keyboard host that doesn't move the active mainwindow view but shrinks it.
    39 \brief A virtual keyboard host that doesn't move the active mainwindow view but shrinks it.
    39 
    40 
    40 The default virtual keyboard host moves the editor container widget in order to keep the
    41 The default virtual keyboard host moves the editor container widget in order to keep the
    41 cursor line visible. In some situations that doesn't work and the container should be shrunk
    42 cursor line visible. In some situations that doesn't work and the container should be shrunk
    55     HbShrinkingVkbHostPrivate(HbAbstractVkbHost *myHost, HbWidget *widget);
    56     HbShrinkingVkbHostPrivate(HbAbstractVkbHost *myHost, HbWidget *widget);
    56     bool prepareContainerAnimation(HbVkbHost::HbVkbStatus status);
    57     bool prepareContainerAnimation(HbVkbHost::HbVkbStatus status);
    57     void closeKeypad();
    58     void closeKeypad();
    58     void closeKeypadWithoutAnimation();
    59     void closeKeypadWithoutAnimation();
    59     void openKeypadWithoutAnimation();
    60     void openKeypadWithoutAnimation();
    60     void minimizeKeypadWithoutAnimation();
       
    61 
    61 
    62     void shrinkView();
    62     void shrinkView();
    63     void resetViewSize();
    63     void resetViewSize();
       
    64 
       
    65     void getViewFlagsForVisibilityChange(HbView::HbViewFlags &viewFlags, bool visible, HbView *view);
    64 
    66 
    65 public:
    67 public:
    66     QSizeF mContainerOriginalSize;
    68     QSizeF mContainerOriginalSize;
    67 };
    69 };
    68 
    70 
    95 {
    97 {
    96     HbAbstractVkbHostPrivate::openKeypadWithoutAnimation();
    98     HbAbstractVkbHostPrivate::openKeypadWithoutAnimation();
    97     shrinkView();
    99     shrinkView();
    98 }
   100 }
    99 
   101 
   100 void HbShrinkingVkbHostPrivate::minimizeKeypadWithoutAnimation()
       
   101 {
       
   102     HbAbstractVkbHostPrivate::minimizeKeypadWithoutAnimation();
       
   103     shrinkView();
       
   104 }
       
   105 
       
   106 void HbShrinkingVkbHostPrivate::resetViewSize()
   102 void HbShrinkingVkbHostPrivate::resetViewSize()
   107 {
   103 {
   108     HbMainWindow *mainWin = mainWindow();
   104     HbMainWindow *mainWin = mainWindow();
   109     if (mainWin && mContainerOriginalSize.isValid()) {
   105     if (mainWin && mContainerOriginalSize.isValid()) {
   110         HbMainWindowPrivate::d_ptr(mainWin)->setViewportSize(mContainerOriginalSize);
   106         HbMainWindowPrivate::d_ptr(mainWin)->setViewportSize(mContainerOriginalSize);
   121         if (!mContainerOriginalSize.isValid()) {
   117         if (!mContainerOriginalSize.isValid()) {
   122             mContainerOriginalSize = HbMainWindowPrivate::d_ptr(mainWin)->viewPortSize();
   118             mContainerOriginalSize = HbMainWindowPrivate::d_ptr(mainWin)->viewPortSize();
   123         }
   119         }
   124         HbMainWindowPrivate::d_ptr(mainWin)->setViewportSize(q->applicationArea().size());
   120         HbMainWindowPrivate::d_ptr(mainWin)->setViewportSize(q->applicationArea().size());
   125     }
   121     }
       
   122 }
       
   123 
       
   124 void HbShrinkingVkbHostPrivate::getViewFlagsForVisibilityChange(HbView::HbViewFlags &viewFlags, bool visible, HbView *view)
       
   125 {
       
   126     // First let base class set all the flags
       
   127     HbAbstractVkbHostPrivate::getViewFlagsForVisibilityChange(viewFlags, visible, view);
       
   128 
       
   129     // Then make sure re-layout is allowed
       
   130     viewFlags &= ~HbView::ViewDisableRelayout;
   126 }
   131 }
   127 
   132 
   128 /// @endcond
   133 /// @endcond
   129 
   134 
   130 /*!
   135 /*!