diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-01-15 14:00:50 +0000 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2021-01-17 21:39:14 +0100 |
commit | 3812a2678c8aeba6ea980e3df5ee63792a217199 (patch) | |
tree | f8bb62922b0e9d1fced3f994c3125854b1632576 | |
parent | elementary: tdf#139056 update RED color to follow upstream brand (diff) | |
download | core-3812a2678c8aeba6ea980e3df5ee63792a217199.tar.gz core-3812a2678c8aeba6ea980e3df5ee63792a217199.zip |
tdf#135641 update DataBrowser has-focus when child widget gains focus
Change-Id: Ic5e618b50c31ebeffa1b2cc59857582804874747
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109349
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r-- | include/svtools/brwbox.hxx | 1 | ||||
-rw-r--r-- | include/svtools/editbrowsebox.hxx | 3 | ||||
-rw-r--r-- | svtools/source/brwbox/brwbox2.cxx | 3 | ||||
-rw-r--r-- | svtools/source/brwbox/ebbcontrols.cxx | 10 | ||||
-rw-r--r-- | svtools/source/brwbox/editbrowsebox.cxx | 8 |
5 files changed, 23 insertions, 2 deletions
diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index a86fce72307f..b865b0957129 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -587,6 +587,7 @@ public: bool ReserveControlArea(sal_uInt16 nWidth = USHRT_MAX); tools::Rectangle GetControlArea() const; virtual bool ProcessKey(const KeyEvent& rEvt); + virtual void ChildFocusIn(); void Dispatch( sal_uInt16 nId ); void SetMode( BrowserMode nMode ); BrowserMode GetMode( ) const { return m_nCurrentMode; } diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx index 4f212bf9de4d..46a35c203e96 100644 --- a/include/svtools/editbrowsebox.hxx +++ b/include/svtools/editbrowsebox.hxx @@ -173,6 +173,7 @@ namespace svt virtual bool ProcessKey(const KeyEvent& rKEvt); protected: DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + DECL_LINK(FocusInHdl, weld::Widget&, void); }; class SVT_DLLPUBLIC EditControlBase : public ControlBase @@ -981,6 +982,8 @@ namespace svt virtual bool ProcessKey(const KeyEvent& rEvt) override; + virtual void ChildFocusIn() override; + css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCheckBoxCell(sal_Int32 _nRow, sal_uInt16 _nColumnPos,const TriState& eState); bool ControlHasFocus() const; protected: diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index d2e9f4e04237..5424edfb0cf2 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -1687,6 +1687,9 @@ bool BrowseBox::ProcessKey( const KeyEvent& rEvt ) return nId != BROWSER_NONE; } +void BrowseBox::ChildFocusIn() +{ +} void BrowseBox::Dispatch( sal_uInt16 nId ) { diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx index 6557552fc7d5..32c29784ce7b 100644 --- a/svtools/source/brwbox/ebbcontrols.cxx +++ b/svtools/source/brwbox/ebbcontrols.cxx @@ -31,6 +31,7 @@ namespace svt m_xWidget->set_entry_width_chars(1); // so a smaller than default width can be used m_xWidget->connect_changed(LINK(this, ComboBoxControl, SelectHdl)); m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl)); + m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl)); } void ComboBoxControl::dispose() @@ -116,6 +117,7 @@ namespace svt m_xWidget->set_size_request(42, -1); // so a later narrow size request can stick m_xWidget->connect_changed(LINK(this, ListBoxControl, SelectHdl)); m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl)); + m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl)); } void ListBoxControl::dispose() @@ -184,6 +186,7 @@ namespace svt m_aModeState.bTriStateEnabled = true; InitControlBase(m_xBox.get()); m_xBox->connect_key_press(LINK(this, ControlBase, KeyInputHdl)); + m_xBox->connect_focus_in(LINK(this, ControlBase, FocusInHdl)); m_xBox->connect_toggled(LINK(this, CheckBoxControl, OnToggle)); } @@ -335,6 +338,7 @@ namespace svt m_pEntry->show(); m_pEntry->set_width_chars(1); // so a smaller than default width can be used m_pEntry->connect_key_press(LINK(this, ControlBase, KeyInputHdl)); + m_pEntry->connect_focus_in(LINK(this, ControlBase, FocusInHdl)); } bool ControlBase::ProcessKey(const KeyEvent& rKEvt) @@ -347,6 +351,11 @@ namespace svt return ProcessKey(rKEvt); } + IMPL_LINK_NOARG(ControlBase, FocusInHdl, weld::Widget&, void) + { + return static_cast<BrowserDataWin*>(GetParent())->GetParent()->ChildFocusIn(); + } + void EditControlBase::dispose() { m_pEntry = nullptr; @@ -609,6 +618,7 @@ namespace svt { InitControlBase(m_xWidget.get()); m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl)); + m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl)); // so any the natural size doesn't have an effect m_xWidget->set_size_request(1, 1); } diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 4c2559ea2742..71126b5a3f4b 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -192,7 +192,7 @@ namespace svt if (IsEditing() && Controller()->GetWindow().IsVisible()) Controller()->GetWindow().GrabFocus(); - DetermineFocus( getRealGetFocusFlags( this ) ); + DetermineFocus(getRealGetFocusFlags(this)); } @@ -413,6 +413,10 @@ namespace svt } } + void EditBrowseBox::ChildFocusIn() + { + DetermineFocus(getRealGetFocusFlags(this)); + } void EditBrowseBox::MouseButtonDown(const BrowserMouseEvent& rEvt) { @@ -645,7 +649,7 @@ namespace svt switch (rEvt.GetType()) { case MouseNotifyEvent::GETFOCUS: - DetermineFocus( getRealGetFocusFlags( this ) ); + DetermineFocus(getRealGetFocusFlags(this)); break; case MouseNotifyEvent::LOSEFOCUS: |