diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2020-07-19 10:23:12 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-20 21:03:48 +0200 |
commit | c90fe7ce9350838792c867c5224e21c9a12851a7 (patch) | |
tree | 6f1f4921a32dc98a421fc8820d25ee921d092329 /Libraries | |
parent | bf59cd7ca5304e353f2d8ae35fec6b1db7b3097a (diff) | |
download | serenity-c90fe7ce9350838792c867c5224e21c9a12851a7.zip |
LibGUI: Use ControlBoxButtons in SpinBox and ComboBox
Converts the buttons of these widgets into ControlBoxButtons.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibGUI/ComboBox.cpp | 5 | ||||
-rw-r--r-- | Libraries/LibGUI/ComboBox.h | 3 | ||||
-rw-r--r-- | Libraries/LibGUI/SpinBox.cpp | 9 | ||||
-rw-r--r-- | Libraries/LibGUI/SpinBox.h | 6 |
4 files changed, 12 insertions, 11 deletions
diff --git a/Libraries/LibGUI/ComboBox.cpp b/Libraries/LibGUI/ComboBox.cpp index ea9b65b4be..aa99594194 100644 --- a/Libraries/LibGUI/ComboBox.cpp +++ b/Libraries/LibGUI/ComboBox.cpp @@ -24,8 +24,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <LibGUI/Button.h> #include <LibGUI/ComboBox.h> +#include <LibGUI/ControlBoxButton.h> #include <LibGUI/Desktop.h> #include <LibGUI/ListView.h> #include <LibGUI/Model.h> @@ -89,9 +89,8 @@ ComboBox::ComboBox() m_open_button->click(); }; - m_open_button = add<Button>(); + m_open_button = add<ControlBoxButton>(ControlBoxButton::DownArrow); m_open_button->set_focusable(false); - m_open_button->set_text("\xE2\xAC\x87"); // DOWNWARDS BLACK ARROW m_open_button->on_click = [this](auto) { if (m_list_window->is_visible()) close(); diff --git a/Libraries/LibGUI/ComboBox.h b/Libraries/LibGUI/ComboBox.h index bb8d51877b..0a82d17ff1 100644 --- a/Libraries/LibGUI/ComboBox.h +++ b/Libraries/LibGUI/ComboBox.h @@ -31,6 +31,7 @@ namespace GUI { class ComboBoxEditor; +class ControlBoxButton; class ComboBox : public Widget { C_OBJECT(ComboBox) @@ -65,7 +66,7 @@ protected: private: RefPtr<ComboBoxEditor> m_editor; - RefPtr<Button> m_open_button; + RefPtr<ControlBoxButton> m_open_button; RefPtr<Window> m_list_window; RefPtr<ListView> m_list_view; bool m_only_allow_values_from_model { false }; diff --git a/Libraries/LibGUI/SpinBox.cpp b/Libraries/LibGUI/SpinBox.cpp index 45d61f28c0..aecc9f73f9 100644 --- a/Libraries/LibGUI/SpinBox.cpp +++ b/Libraries/LibGUI/SpinBox.cpp @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <LibGUI/Button.h> +#include <LibGUI/ControlBoxButton.h> #include <LibGUI/SpinBox.h> #include <LibGUI/TextBox.h> @@ -41,14 +41,13 @@ SpinBox::SpinBox() else m_editor->set_text(String::number(m_value)); }; - m_increment_button = add<Button>(); + + m_increment_button = add<ControlBoxButton>(ControlBoxButton::UpArrow); m_increment_button->set_focusable(false); - m_increment_button->set_text("\xE2\xAC\x86"); // UPWARDS BLACK ARROW m_increment_button->on_click = [this](auto) { set_value(m_value + 1); }; m_increment_button->set_auto_repeat_interval(150); - m_decrement_button = add<Button>(); + m_decrement_button = add<ControlBoxButton>(ControlBoxButton::DownArrow); m_decrement_button->set_focusable(false); - m_decrement_button->set_text("\xE2\xAC\x87"); // DOWNWARDS BLACK ARROW m_decrement_button->on_click = [this](auto) { set_value(m_value - 1); }; m_decrement_button->set_auto_repeat_interval(150); } diff --git a/Libraries/LibGUI/SpinBox.h b/Libraries/LibGUI/SpinBox.h index 6f0fc900b7..3a8dfa4adc 100644 --- a/Libraries/LibGUI/SpinBox.h +++ b/Libraries/LibGUI/SpinBox.h @@ -30,6 +30,8 @@ namespace GUI { +class ControlBoxButton; + class SpinBox : public Widget { C_OBJECT(SpinBox) public: @@ -55,8 +57,8 @@ protected: private: RefPtr<TextEditor> m_editor; - RefPtr<Button> m_increment_button; - RefPtr<Button> m_decrement_button; + RefPtr<ControlBoxButton> m_increment_button; + RefPtr<ControlBoxButton> m_decrement_button; int m_min { 0 }; int m_max { 100 }; |