| 1 | // SPDX-FileCopyrightText: 2009 Ingo Ruhnke <[email protected]> |
| 2 | // SPDX-FileCopyrightText: 2025 Raphael Rosch <[email protected]> |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #ifndef HEADER_JSTEST_GTK_BUTTON_WIDGET_HPP |
| 6 | #define HEADER_JSTEST_GTK_BUTTON_WIDGET_HPP |
| 7 | |
| 8 | #include <gtkmm/togglebutton.h> |
| 9 | #include <gdk/gdk.h> |
| 10 | |
| 11 | class ButtonWidget : public Gtk::ToggleButton { |
| 12 | public: |
| 13 | ButtonWidget() |
| 14 | { |
| 15 | add_events(Gdk::BUTTON_PRESS_MASK); |
| 16 | } |
| 17 | |
| 18 | protected: |
| 19 | bool on_button_press_event(GdkEventButton* event) override |
| 20 | { |
| 21 | return true; // Prevent toggle from mouse clicks; state set programmatically |
| 22 | } |
| 23 | }; |
| 24 | |
| 25 | #endif |
| 26 | |
| 27 | /* EOF */ |