diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-22 16:01:17 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-07-22 20:48:24 +0200 |
commit | 84522fc8798cf0d89835f58f4b335b0045a50bfb (patch) | |
tree | 86ef30cc0104fc8bf6a0ff36f3c8747e4166b65b /framework | |
parent | df8f780cc24410d2fec5c4d4e1ed58d492559241 (diff) |
merge duplicate GetFocus implementations
Change-Id: Ifc2e3fab6dacb3b0bca74c0584c16170b8b97de4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99234
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'framework')
6 files changed, 12 insertions, 36 deletions
diff --git a/framework/source/uielement/FixedImageToolbarController.cxx b/framework/source/uielement/FixedImageToolbarController.cxx index a666261b0f03..49377db5e555 100644 --- a/framework/source/uielement/FixedImageToolbarController.cxx +++ b/framework/source/uielement/FixedImageToolbarController.cxx @@ -43,12 +43,6 @@ public: FixedImageControl(vcl::Window* pParent, const OUString& rCommand); virtual ~FixedImageControl() override; virtual void dispose() override; - virtual void GetFocus() override - { - if (m_xWidget) - m_xWidget->grab_focus(); - InterimItemWindow::GetFocus(); - } DECL_LINK(KeyInputHdl, const ::KeyEvent&, bool); private: @@ -59,6 +53,8 @@ FixedImageControl::FixedImageControl(vcl::Window* pParent, const OUString& rComm : InterimItemWindow(pParent, "svt/ui/fixedimagecontrol.ui", "FixedImageControl") , m_xWidget(m_xBuilder->weld_image("image")) { + InitControlBase(m_xWidget.get()); + m_xWidget->connect_key_press(LINK(this, FixedImageControl, KeyInputHdl)); bool bBigImages(SvtMiscOptions().AreCurrentSymbolsLarge()); diff --git a/framework/source/uielement/FixedTextToolbarController.cxx b/framework/source/uielement/FixedTextToolbarController.cxx index a6bb5d25ad88..32b486379178 100644 --- a/framework/source/uielement/FixedTextToolbarController.cxx +++ b/framework/source/uielement/FixedTextToolbarController.cxx @@ -39,12 +39,6 @@ public: FixedTextControl(vcl::Window* pParent); virtual ~FixedTextControl() override; virtual void dispose() override; - virtual void GetFocus() override - { - if (m_xWidget) - m_xWidget->grab_focus(); - InterimItemWindow::GetFocus(); - } OUString get_label() const { return m_xWidget->get_label(); } void set_label(const OUString& rLabel) { return m_xWidget->set_label(rLabel); } DECL_LINK(KeyInputHdl, const ::KeyEvent&, bool); @@ -57,6 +51,8 @@ FixedTextControl::FixedTextControl(vcl::Window* pParent) : InterimItemWindow(pParent, "svt/ui/fixedtextcontrol.ui", "FixedTextControl") , m_xWidget(m_xBuilder->weld_label("label")) { + InitControlBase(m_xWidget.get()); + m_xWidget->connect_key_press(LINK(this, FixedTextControl, KeyInputHdl)); } diff --git a/framework/source/uielement/comboboxtoolbarcontroller.cxx b/framework/source/uielement/comboboxtoolbarcontroller.cxx index 9f200b2cd838..4fd3fca717bb 100644 --- a/framework/source/uielement/comboboxtoolbarcontroller.cxx +++ b/framework/source/uielement/comboboxtoolbarcontroller.cxx @@ -47,12 +47,6 @@ public: ComboBoxControl(vcl::Window* pParent, ComboboxToolbarController* pComboboxToolbarController); virtual ~ComboBoxControl() override; virtual void dispose() override; - virtual void GetFocus() override - { - if (m_xWidget) - m_xWidget->grab_focus(); - InterimItemWindow::GetFocus(); - } void set_active_or_entry_text(const OUString& rText); OUString get_active_text() const { return m_xWidget->get_active_text(); } @@ -80,6 +74,8 @@ ComboBoxControl::ComboBoxControl(vcl::Window* pParent, ComboboxToolbarController , m_xWidget(m_xBuilder->weld_combo_box("combobox")) , m_pComboboxToolbarController(pComboboxToolbarController) { + InitControlBase(m_xWidget.get()); + m_xWidget->connect_focus_in(LINK(this, ComboBoxControl, FocusInHdl)); m_xWidget->connect_focus_out(LINK(this, ComboBoxControl, FocusOutHdl)); m_xWidget->connect_changed(LINK(this, ComboBoxControl, ModifyHdl)); diff --git a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx index 8c50d7229232..b694bca18ed6 100644 --- a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx +++ b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx @@ -47,12 +47,6 @@ public: ListBoxControl(vcl::Window* pParent, DropdownToolbarController* pListBoxListener); virtual ~ListBoxControl() override; virtual void dispose() override; - virtual void GetFocus() override - { - if (m_xWidget) - m_xWidget->grab_focus(); - InterimItemWindow::GetFocus(); - } void set_active(int nPos) { m_xWidget->set_active(nPos); } void append_text(const OUString& rStr) { m_xWidget->append_text(rStr); } @@ -78,6 +72,8 @@ ListBoxControl::ListBoxControl(vcl::Window* pParent, DropdownToolbarController* , m_xWidget(m_xBuilder->weld_combo_box("listbox")) , m_pListBoxListener( pListBoxListener ) { + InitControlBase(m_xWidget.get()); + m_xWidget->connect_focus_in(LINK(this, ListBoxControl, FocusInHdl)); m_xWidget->connect_focus_out(LINK(this, ListBoxControl, FocusOutHdl)); m_xWidget->connect_changed(LINK(this, ListBoxControl, ModifyHdl)); diff --git a/framework/source/uielement/edittoolbarcontroller.cxx b/framework/source/uielement/edittoolbarcontroller.cxx index 89ff08598fce..152b0336347c 100644 --- a/framework/source/uielement/edittoolbarcontroller.cxx +++ b/framework/source/uielement/edittoolbarcontroller.cxx @@ -46,12 +46,6 @@ public: EditControl(vcl::Window* pParent, EditToolbarController* pEditToolbarController); virtual ~EditControl() override; virtual void dispose() override; - virtual void GetFocus() override - { - if (m_xWidget) - m_xWidget->grab_focus(); - InterimItemWindow::GetFocus(); - } OUString get_text() const { return m_xWidget->get_text(); } void set_text(const OUString& rText) { m_xWidget->set_text(rText); } @@ -72,6 +66,8 @@ EditControl::EditControl(vcl::Window* pParent, EditToolbarController* pEditToolb , m_xWidget(m_xBuilder->weld_entry("entry")) , m_pEditToolbarController(pEditToolbarController) { + InitControlBase(m_xWidget.get()); + m_xWidget->connect_focus_in(LINK(this, EditControl, FocusInHdl)); m_xWidget->connect_focus_out(LINK(this, EditControl, FocusOutHdl)); m_xWidget->connect_changed(LINK(this, EditControl, ModifyHdl)); diff --git a/framework/source/uielement/spinfieldtoolbarcontroller.cxx b/framework/source/uielement/spinfieldtoolbarcontroller.cxx index dfcd5a6c4342..235fb62675f3 100644 --- a/framework/source/uielement/spinfieldtoolbarcontroller.cxx +++ b/framework/source/uielement/spinfieldtoolbarcontroller.cxx @@ -53,12 +53,6 @@ public: SpinfieldControl(vcl::Window* pParent, SpinfieldToolbarController* pSpinfieldToolbarController); virtual ~SpinfieldControl() override; virtual void dispose() override; - virtual void GetFocus() override - { - if (m_xWidget) - m_xWidget->grab_focus(); - InterimItemWindow::GetFocus(); - } Formatter& GetFormatter() { @@ -86,6 +80,8 @@ SpinfieldControl::SpinfieldControl(vcl::Window* pParent, SpinfieldToolbarControl , m_xWidget(m_xBuilder->weld_formatted_spin_button("spinbutton")) , m_pSpinfieldToolbarController(pSpinfieldToolbarController) { + InitControlBase(m_xWidget.get()); + m_xWidget->connect_focus_in(LINK(this, SpinfieldControl, FocusInHdl)); m_xWidget->connect_focus_out(LINK(this, SpinfieldControl, FocusOutHdl)); Formatter& rFormatter = m_xWidget->GetFormatter(); |