diff options
author | Stephan Bergmann <sb@openoffice.org> | 2002-11-26 14:37:09 +0000 |
---|---|---|
committer | Stephan Bergmann <sb@openoffice.org> | 2002-11-26 14:37:09 +0000 |
commit | cb9e815d45114d42fdc6d01a3abc42d6599b41df (patch) | |
tree | 59dbd1aadff0ed4827752242c550e67e4e936342 /vcl/unx | |
parent | 28ba682ff685b7228f0fb7b153754b8e3963e267 (diff) |
#92031# Added IME status window control stuff.
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/inc/i18n_status.hxx | 19 | ||||
-rw-r--r-- | vcl/unx/source/app/i18n_status.cxx | 70 |
2 files changed, 76 insertions, 13 deletions
diff --git a/vcl/unx/inc/i18n_status.hxx b/vcl/unx/inc/i18n_status.hxx index d5d5ed4a2110..7e16d87fb5a1 100644 --- a/vcl/unx/inc/i18n_status.hxx +++ b/vcl/unx/inc/i18n_status.hxx @@ -2,9 +2,9 @@ * * $RCSfile: i18n_status.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: pl $ $Date: 2001-11-08 19:21:24 $ + * last change: $Author: sb $ $Date: 2002-11-26 15:35:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -116,6 +116,8 @@ private: static I18NStatus* pInstance; + static bool getStatusWindowMode(); + public: static I18NStatus& get(); static void free(); @@ -139,6 +141,19 @@ public: // for SwitchIMCallback void changeIM( const String& ); + + // External Control: + + /** Return true if the status window can be toggled on and off externally. + */ + bool canToggleStatusWindow() const; + + /** Toggle the status window on or off. + + This only works if canToggleStatusWindow returns true (otherwise, any + calls of this method are ignored). + */ + void toggleStatusWindow(); }; } // namespace diff --git a/vcl/unx/source/app/i18n_status.cxx b/vcl/unx/source/app/i18n_status.cxx index 8462cb393eaf..1dde8f5dc029 100644 --- a/vcl/unx/source/app/i18n_status.cxx +++ b/vcl/unx/source/app/i18n_status.cxx @@ -2,9 +2,9 @@ * * $RCSfile: i18n_status.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: sb $ $Date: 2002-11-18 11:58:02 $ + * last change: $Author: sb $ $Date: 2002-11-26 15:37:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,7 +102,8 @@ public: virtual void setPosition( SalFrame* ); virtual void setText( const String & ) = 0; virtual const String& getText() const = 0; - virtual void show( bool bShow, I18NStatus::ShowReason eReason ); + virtual void show( bool bShow, I18NStatus::ShowReason eReason ) = 0; + virtual void toggle( bool bOn ); }; } @@ -118,9 +119,8 @@ void StatusWindow::setPosition( SalFrame* pFrame ) { } -void StatusWindow::show( bool bShow, I18NStatus::ShowReason eReason ) +void StatusWindow::toggle( bool bOn ) { - Show( bShow ); } // -------------------------------------------------------------------------- @@ -351,15 +351,21 @@ class IIIMPStatusWindow : public StatusWindow MenuButton m_aStatusBtn; PopupMenu m_aMenu; SalFrame* m_pResetFocus; + bool m_bShow; + bool m_bOn; DECL_LINK( SelectHdl, MenuButton* ); + + void show(); + public: - IIIMPStatusWindow( SalFrame* pParent ); // for initial position + IIIMPStatusWindow( SalFrame* pParent, bool bOn ); // for initial position virtual ~IIIMPStatusWindow(); virtual void setText( const String & ); virtual const String& getText() const; virtual void show( bool bShow, I18NStatus::ShowReason eReason ); + virtual void toggle( bool bOn ); void layout(); // overload Window focus handler @@ -370,10 +376,12 @@ public: } -IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent ) : +IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) : StatusWindow( WB_MOVEABLE ), m_aStatusBtn( this, WB_BORDER ), - m_pResetFocus( pParent ) + m_pResetFocus( pParent ), + m_bShow( true ), + m_bOn( bOn ) { SetText( String( RTL_CONSTASCII_USTRINGPARAM( "IME Status" ) ) ); @@ -450,9 +458,24 @@ void IIIMPStatusWindow::show( bool bShow, I18NStatus::ShowReason eReason ) ) return; - if( bShow && ! IsVisible() ) + m_bShow = bShow; + show(); +} + +void IIIMPStatusWindow::toggle( bool bOn ) +{ + if (bOn != m_bOn) + { + m_bOn = bOn; + show(); + } +} + +void IIIMPStatusWindow::show() +{ + if (m_bOn && m_bShow && !IsVisible()) m_pResetFocus = I18NStatus::get().getParent(); - Show( bShow ); + Show(m_bOn && m_bShow); } void IIIMPStatusWindow::GetFocus() @@ -593,7 +616,8 @@ void I18NStatus::setParent( SalFrame* pParent ) { bool bIIIMPmode = m_aChoices.begin() != m_aChoices.end(); if( bIIIMPmode ) - m_pStatusWindow = new IIIMPStatusWindow( pParent ); + m_pStatusWindow = new IIIMPStatusWindow( pParent, + getStatusWindowMode() ); else m_pStatusWindow = new XIMStatusWindow(); setStatusText( m_aCurrentIM ); @@ -694,3 +718,27 @@ SalFrame* I18NStatus::getStatusFrame() const } return pRet; } + +bool I18NStatus::canToggleStatusWindow() const +{ + return m_aChoices.begin() != m_aChoices.end(); // implies IIIMP +} + +void I18NStatus::toggleStatusWindow() +{ + if (m_pStatusWindow != 0) + m_pStatusWindow->toggle(getStatusWindowMode()); +} + +bool I18NStatus::getStatusWindowMode() +{ + switch (ImplGetSVData()->maAppData.meShowImeStatusWindow) + { + default: // ImplSVAppData::ImeStatusWindowMode_UNKNOWN + return Application::GetShowImeStatusWindowDefault(); + case ImplSVAppData::ImeStatusWindowMode_HIDE: + return false; + case ImplSVAppData::ImeStatusWindowMode_SHOW: + return true; + } +} |