diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-02-04 11:34:29 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-02-06 12:26:37 +0100 |
commit | 8950cb8ae6a1621729ec43a6dd1c29cf04260797 (patch) | |
tree | 2f0a50e6778ab425813ad626e634cd8b233514ca /include | |
parent | 415c1b05242b80ca883596952caa0e179a07b409 (diff) |
weld SvxFontSizeBox_Impl
which enables making a native gtk widget a member of a toolbar
This widget wants to distinguish between a value getting selected
by the menu or not, which is fairly tricky
Change-Id: I9014785530bd0d82ffa66842f940feb2d3237e68
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87971
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/svtools/ctrlbox.hxx | 11 | ||||
-rw-r--r-- | include/vcl/combobox.hxx | 3 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 14 |
3 files changed, 28 insertions, 0 deletions
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index 8036d513ad05..30551c592dc2 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -428,6 +428,7 @@ class SVT_DLLPUBLIC SvtFontSizeBox bPtRelative:1, bStdSize:1; Link<weld::ComboBox&, void> m_aChangeHdl; + Link<weld::Widget&, void> m_aFocusOutHdl; std::unique_ptr<weld::ComboBox> m_xComboBox; sal_uInt16 GetDecimalDigits() const { return nDecimalDigits; } @@ -461,14 +462,24 @@ public: bool IsPtRelative() const { return bPtRelative; } void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_aChangeHdl = rLink; } + void connect_focus_out(const Link<weld::Widget&, void>& rLink) { m_aFocusOutHdl = rLink; } + void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_xComboBox->connect_key_press(rLink); } OUString get_active_text() const { return m_xComboBox->get_active_text(); } void set_active_text(const OUString& rText) { m_xComboBox->set_active_text(rText); } void set_sensitive(bool bSensitive) { m_xComboBox->set_sensitive(bSensitive); } + int get_active() const { return m_xComboBox->get_active(); } int get_value() const; void set_value(int nValue); void save_value() { nSavedValue = get_value(); } int get_saved_value() const { return nSavedValue; } bool get_value_changed_from_saved() const { return get_value() != get_saved_value(); } + int get_count() const { return m_xComboBox->get_count(); } + OUString get_text(int i) const { return m_xComboBox->get_text(i); } + void grab_focus() { m_xComboBox->grab_focus(); } + bool has_focus() const { return m_xComboBox->has_focus(); } + void connect_entry_activate(const Link<weld::ComboBox&, bool>& rLink) { m_xComboBox->connect_entry_activate(rLink); } + void disable_entry_completion() { m_xComboBox->set_entry_completion(false, false); } + boost::property_tree::ptree get_property_tree() const; private: SvtFontSizeBox(const SvtFontSizeBox&) = delete; diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx index ff34c96411b4..f2f96dca1b37 100644 --- a/include/vcl/combobox.hxx +++ b/include/vcl/combobox.hxx @@ -152,6 +152,9 @@ public: void SetNoSelection(); tools::Rectangle GetBoundingRectangle( sal_Int32 nItem ) const; + // determine if Select was called due to something selected from the menu + bool IsModifyByMenu() const; + /** checks whether a certain point lies within the bounds of a list item and returns the item as well as the character position the point is at. diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 742290822c32..464047bdf843 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -27,6 +27,8 @@ #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> +#include <boost/property_tree/ptree_fwd.hpp> + #include <assert.h> #include <memory> #include <vector> @@ -263,6 +265,8 @@ public: virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() = 0; + virtual boost::property_tree::ptree get_property_tree() const = 0; + virtual ~Widget() {} }; @@ -643,7 +647,17 @@ public: virtual int find_id(const OUString& rId) const = 0; void remove_id(const OUString& rId) { remove(find_id(rId)); } + /* m_aChangeHdl is called when the active item is changed. The can be due + to the user selecting a different item from the list or while typing + into the entry of a combo box with an entry. + + Use changed_by_menu() to discover whether an item was actually selected + from the menu. + */ void connect_changed(const Link<ComboBox&, void>& rLink) { m_aChangeHdl = rLink; } + + virtual bool changed_by_menu() const = 0; + virtual void connect_popup_toggled(const Link<ComboBox&, void>& rLink) { m_aPopupToggledHdl = rLink; |