summaryrefslogtreecommitdiff
path: root/vcl/unx/generic/app/i18n_status.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx/generic/app/i18n_status.cxx')
-rw-r--r--vcl/unx/generic/app/i18n_status.cxx195
1 files changed, 1 insertions, 194 deletions
diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx
index 4e08c3b45711..cca11999e6b6 100644
--- a/vcl/unx/generic/app/i18n_status.cxx
+++ b/vcl/unx/generic/app/i18n_status.cxx
@@ -290,194 +290,6 @@ void XIMStatusWindow::setText( const OUString& rText )
m_aWindowSize.Width() = m_aStatusText->GetTextWidth( rText )+8;
}
-namespace vcl {
-
-class IIIMPStatusWindow : public StatusWindow
-{
- VclPtr<MenuButton> m_aStatusBtn;
- SalFrame* m_pResetFocus;
- bool m_bShow;
- bool m_bOn;
-
- DECL_LINK( SelectHdl, MenuButton*, void );
-
- void show();
-
-public:
- IIIMPStatusWindow( SalFrame* pParent, bool bOn ); // for initial position
-
- virtual void setText( const OUString & ) override;
- virtual void show( bool bShow, I18NStatus::ShowReason eReason ) override;
- virtual void toggle( bool bOn ) override;
- virtual ~IIIMPStatusWindow() override { disposeOnce(); }
- virtual void dispose() override;
- void layout();
-
- // override Window focus handler
- virtual void GetFocus() override;
- // override WorkWindow::DataChanged
- virtual void DataChanged( const DataChangedEvent& rEvt ) override;
-};
-
-}
-
-IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) :
- StatusWindow( WB_MOVEABLE ),
- m_aStatusBtn(VclPtr<MenuButton>::Create(this, WB_BORDER)),
- m_pResetFocus( pParent ),
- m_bShow( true ),
- m_bOn( bOn )
-{
- SetText( "IME Status" );
-
- layout();
-
- m_aStatusBtn->SetSelectHdl( LINK( this, IIIMPStatusWindow, SelectHdl ) );
- m_aStatusBtn->SetPopupMenu( nullptr );
- m_aStatusBtn->Show();
-
- if( pParent )
- {
- const SystemEnvData* pEnvData = GetSystemData();
-
- const SalFrameGeometry& rGeom( pParent->GetUnmirroredGeometry() );
- int nDistance = rGeom.nTopDecoration;
- if( nDistance < 20 )
- nDistance = 20;
- XMoveWindow( static_cast<Display*>(pEnvData->pDisplay),
- (::Window)pEnvData->aShellWindow,
- rGeom.nX,
- rGeom.nY + rGeom.nHeight + nDistance
- );
- }
-#if OSL_DEBUG_LEVEL > 1
- else
- fprintf( stderr, "Warning: could not reposition status window since no frame\n" );
-#endif
- EnableAlwaysOnTop();
-}
-
-void IIIMPStatusWindow::layout()
-{
- Font aFont( m_aStatusBtn->GetFont() );
- Size aSize( 15*aFont.GetFontHeight(), aFont.GetFontHeight()+14 );
- aSize = m_aStatusBtn->LogicToPixel( aSize );
-
- m_aStatusBtn->SetPosSizePixel( Point( 0, 0 ), aSize );
- SetOutputSizePixel( aSize );
- if( IsVisible() )
- Invalidate();
-}
-
-void IIIMPStatusWindow::DataChanged( const DataChangedEvent& )
-{
- m_aStatusBtn->SetSettings( GetSettings() );
- layout();
-}
-
-void IIIMPStatusWindow::setText( const OUString& rText )
-{
- m_aStatusBtn->SetText( rText );
-}
-
-void IIIMPStatusWindow::show( bool bShow, I18NStatus::ShowReason eReason )
-{
- // hide IIIMPStatusWindow only in presentations
- if( ! bShow
- && eReason != I18NStatus::presentation
- )
- return;
-
- m_bShow = bShow;
- show();
-}
-
-void IIIMPStatusWindow::toggle( bool bOn )
-{
- if (bOn != m_bOn)
- {
- m_bOn = bOn;
- show();
- }
-}
-
-void IIIMPStatusWindow::dispose()
-{
- m_aStatusBtn.disposeAndClear();
- StatusWindow::dispose();
-}
-
-void IIIMPStatusWindow::show()
-{
- if (m_bOn && m_bShow && !IsVisible())
- m_pResetFocus = I18NStatus::get().getParent();
- Show(m_bOn && m_bShow);
-}
-
-void IIIMPStatusWindow::GetFocus()
-{
- /*
- * this is here just to put the focus back to the application
- * window at startup on clickToFocus WMs
- */
- WorkWindow::GetFocus();
- if( m_pResetFocus )
- {
- /*
- * look if reset focus still exists
- * since reset focus really is an internal hack there should
- * not be a method to be called in SalFrame destructor
- */
- const std::list< SalFrame* >& rFrames = vcl_sal::getSalDisplay(GetGenericData())->getFrames();
- std::list< SalFrame* >::const_iterator it;
- for( it = rFrames.begin(); it != rFrames.end() && *it != m_pResetFocus; ++it )
- ;
- if( it != rFrames.end() )
- {
- const SystemEnvData* pParentEnvData = m_pResetFocus->GetSystemData();
- GetGenericData()->ErrorTrapPush();
- XSetInputFocus( static_cast<Display*>(pParentEnvData->pDisplay),
- (::Window)pParentEnvData->aShellWindow,
- RevertToNone,
- CurrentTime
- );
- XSync( static_cast<Display*>(pParentEnvData->pDisplay), False );
- GetGenericData()->ErrorTrapPop();
- }
- m_pResetFocus = nullptr;
- }
-}
-
-IMPL_LINK( IIIMPStatusWindow, SelectHdl, MenuButton*, pBtn, void )
-{
- if( pBtn == m_aStatusBtn )
- {
- const ::std::vector< I18NStatus::ChoiceData >& rChoices( I18NStatus::get().getChoices() );
- unsigned int nIndex = m_aStatusBtn->GetCurItemId()-1;
- if( nIndex < rChoices.size() )
- {
- XSetICValues( static_cast<X11SalFrame*>(I18NStatus::get().getParent())->getInputContext()->GetContext(),
- XNUnicodeCharacterSubset,
- nullptr,
- nullptr);
- // FIXME: get rid of X11SalFrame
- X11SalFrame* pParent = static_cast<X11SalFrame*>(I18NStatus::get().getParent());
- if( pParent && pParent->isMapped() )
- {
- const SystemEnvData* pEnv = pParent->GetSystemData();
- GetGenericData()->ErrorTrapPush();
- XSetInputFocus( static_cast<Display*>(pEnv->pDisplay),
- (::Window)pEnv->aShellWindow,
- RevertToNone,
- CurrentTime
- );
- XSync( static_cast<Display*>(pEnv->pDisplay), False );
- GetGenericData()->ErrorTrapPop();
- }
- }
- }
-}
-
/*
* I18NStatus
*/
@@ -523,12 +335,7 @@ void I18NStatus::setParent( SalFrame* pParent )
m_pParent = pParent;
if( ! m_pStatusWindow )
{
- bool bIIIMPmode = m_aChoices.begin() != m_aChoices.end();
- if( bIIIMPmode )
- m_pStatusWindow = VclPtr<IIIMPStatusWindow>::Create( pParent,
- getStatusWindowMode() );
- else
- m_pStatusWindow = VclPtr<XIMStatusWindow>::Create( getStatusWindowMode() );
+ m_pStatusWindow = VclPtr<XIMStatusWindow>::Create( getStatusWindowMode() );
setStatusText( m_aCurrentIM );
}
m_pStatusWindow->setPosition( m_pParent );