[gtkmm] Gtk: Update for the latest gtk4 (Add TextView::set_gutter(), etc.)
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Gtk: Update for the latest gtk4 (Add TextView::set_gutter(), etc.)
- Date: Wed, 9 Oct 2019 13:26:38 +0000 (UTC)
commit 248c85a2ddc4f51a7a4b806e2a734c2545737763
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Wed Oct 9 15:23:26 2019 +0200
Gtk: Update for the latest gtk4 (Add TextView::set_gutter(), etc.)
gtk/src/eventcontrollerkey.hg | 2 ++
gtk/src/menutoolbutton.ccg | 11 ++++++++++-
gtk/src/menutoolbutton.hg | 13 +++++++++++++
gtk/src/textview.ccg | 6 +++++-
gtk/src/textview.hg | 26 +++++++++++++++++---------
tools/m4/convert_gtk.m4 | 4 +++-
6 files changed, 50 insertions(+), 12 deletions(-)
---
diff --git a/gtk/src/eventcontrollerkey.hg b/gtk/src/eventcontrollerkey.hg
index 73f3c1b1..f10dcc63 100644
--- a/gtk/src/eventcontrollerkey.hg
+++ b/gtk/src/eventcontrollerkey.hg
@@ -55,6 +55,8 @@ public:
_WRAP_METHOD(const Widget* get_focus_origin() const, gtk_event_controller_key_get_focus_origin,
constversion)
_WRAP_METHOD(Widget* get_focus_target(), gtk_event_controller_key_get_focus_target)
_WRAP_METHOD(const Widget* get_focus_target() const, gtk_event_controller_key_get_focus_target,
constversion)
+ _WRAP_METHOD(bool contains_focus() const, gtk_event_controller_key_contains_focus)
+ _WRAP_METHOD(bool is_focus() const, gtk_event_controller_key_is_focus)
// no_default_handler because GtkEventControllerKeyClass is private.
_WRAP_SIGNAL(bool key_pressed(guint keyval, guint keycode, Gdk::ModifierType state), "key-pressed",
no_default_handler)
diff --git a/gtk/src/menutoolbutton.ccg b/gtk/src/menutoolbutton.ccg
index 11ec8ff8..52a53d3a 100644
--- a/gtk/src/menutoolbutton.ccg
+++ b/gtk/src/menutoolbutton.ccg
@@ -35,5 +35,14 @@ MenuToolButton::MenuToolButton(Widget& icon_widget, const Glib::ustring& label)
{
}
-} // namespace Gtk
+void MenuToolButton::unset_menu()
+{
+ gtk_menu_tool_button_set_menu(gobj(), nullptr);
+}
+void MenuToolButton::unset_popover()
+{
+ gtk_menu_tool_button_set_popover(gobj(), nullptr);
+}
+
+} // namespace Gtk
diff --git a/gtk/src/menutoolbutton.hg b/gtk/src/menutoolbutton.hg
index 6940b24d..7752c697 100644
--- a/gtk/src/menutoolbutton.hg
+++ b/gtk/src/menutoolbutton.hg
@@ -20,6 +20,7 @@ _CONFIGINCLUDE(gtkmmconfig.h)
#include <gtkmm/toolbutton.h>
#include <gtkmm/menu.h>
+#include <gtkmm/popover.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/toolbutton_p.h)
@@ -61,13 +62,25 @@ public:
_WRAP_METHOD(void set_menu(Menu& menu), gtk_menu_tool_button_set_menu)
_WRAP_METHOD(Menu* get_menu(), gtk_menu_tool_button_get_menu)
_WRAP_METHOD(const Menu* get_menu() const, gtk_menu_tool_button_get_menu, constversion)
+ /** Insensitizes the arrow button.
+ */
+ void unset_menu();
+
+ _WRAP_METHOD(void set_popover(Popover& popover), gtk_menu_tool_button_set_popover)
+ _WRAP_METHOD(Popover* get_popover(), gtk_menu_tool_button_get_popover)
+ _WRAP_METHOD(const Popover* get_popover() const, gtk_menu_tool_button_get_popover, constversion)
+ /** Insensitizes the arrow button.
+ */
+ void unset_popover();
_WRAP_METHOD(void set_arrow_tooltip_text(const Glib::ustring& text),
gtk_menu_tool_button_set_arrow_tooltip_text)
_WRAP_METHOD(void set_arrow_tooltip_markup(const Glib::ustring& markup),
gtk_menu_tool_button_set_arrow_tooltip_markup)
// no_default_handler because GtkMenuToolButtonClass is private.
_WRAP_SIGNAL(void show_menu(), show_menu, no_default_handler)
+
_WRAP_PROPERTY("menu", Menu*)
+ _WRAP_PROPERTY("popover", Popover*)
};
} // namespace Gtk
diff --git a/gtk/src/textview.ccg b/gtk/src/textview.ccg
index 4e5307b0..5070b32a 100644
--- a/gtk/src/textview.ccg
+++ b/gtk/src/textview.ccg
@@ -49,5 +49,9 @@ void TextView::scroll_to(const Glib::RefPtr<TextBuffer::Mark>& mark, double with
gtk_text_view_scroll_to_mark(gobj(), Glib::unwrap(mark), within_margin, TRUE /* use_align */, xalign,
yalign);
}
-} // namespace Gtk
+void TextView::unset_gutter(TextWindowType win)
+{
+ gtk_text_view_set_gutter(gobj(), static_cast<GtkTextWindowType>(win), nullptr);
+}
+} // namespace Gtk
diff --git a/gtk/src/textview.hg b/gtk/src/textview.hg
index 821deb3f..03dc2d4e 100644
--- a/gtk/src/textview.hg
+++ b/gtk/src/textview.hg
@@ -135,16 +135,13 @@ public:
_WRAP_METHOD(void get_line_at_y(TextBuffer::iterator& target_iter, int y, int& line_top),
gtk_text_view_get_line_at_y)
_WRAP_METHOD(void get_line_at_y(TextBuffer::const_iterator& target_iter, int y, int& line_top) const,
gtk_text_view_get_line_at_y)
- _WRAP_METHOD(void buffer_to_surface_coords(TextWindowType win,
+ _WRAP_METHOD(void buffer_to_window_coords(TextWindowType win,
int buffer_x, int buffer_y,
- int& window_x, int& window_y) const,
gtk_text_view_buffer_to_surface_coords)
- _WRAP_METHOD(void window_to_buffer_coords(TextWindowType win,
+ int& window_x, int& window_y) const,
gtk_text_view_buffer_to_window_coords)
+ _WRAP_METHOD(void window_to_buffer_coords(TextWindowType win,
int window_x, int window_y,
int& buffer_x, int& buffer_y) const,
gtk_text_view_window_to_buffer_coords)
- _WRAP_METHOD(void set_border_window_size(TextWindowType type, int size),
gtk_text_view_set_border_window_size)
- _WRAP_METHOD(int get_border_window_size(TextWindowType type) const, gtk_text_view_get_border_window_size)
-
_WRAP_METHOD(bool forward_display_line(TextBuffer::iterator& iter), gtk_text_view_forward_display_line)
_WRAP_METHOD(bool backward_display_line(TextBuffer::iterator& iter), gtk_text_view_backward_display_line)
_WRAP_METHOD(bool forward_display_line_end(TextBuffer::iterator& iter),
gtk_text_view_forward_display_line_end)
@@ -155,12 +152,23 @@ public:
_WRAP_METHOD(bool im_context_filter_keypress(const Glib::RefPtr<Gdk::EventKey>& gdk_event),
gtk_text_view_im_context_filter_keypress)
_WRAP_METHOD(void reset_im_context(), gtk_text_view_reset_im_context)
+ _WRAP_METHOD(Widget* get_gutter(TextWindowType win), gtk_text_view_get_gutter)
+ _WRAP_METHOD(const Widget* get_gutter(TextWindowType win) const, gtk_text_view_get_gutter, constversion)
+ _WRAP_METHOD(void set_gutter(TextWindowType win, Widget& widget), gtk_text_view_set_gutter)
+ /** Removes a widget from the gutter specified by @a win.
+ *
+ * @a win must be one of Gtk::TextWindowType::LEFT, Gtk::TextWindowType::RIGHT,
+ * Gtk::TextWindowType::TOP, or Gtk::TextWindowType::BOTTOM.
+ *
+ * @param win A Gtk::TextWindowType.
+ */
+ void unset_gutter(TextWindowType win);
+
_WRAP_METHOD(void add_child_at_anchor(Widget& child, const Glib::RefPtr<TextBuffer::ChildAnchor>& anchor),
gtk_text_view_add_child_at_anchor)
- _WRAP_METHOD(void add_child_in_window(Widget& child, TextWindowType which_window,
- int xpos, int ypos), gtk_text_view_add_child_in_window)
+ _WRAP_METHOD(void add_overlay(Widget& child, int xpos, int ypos), gtk_text_view_add_overlay)
- _WRAP_METHOD(void move_child(Widget& child, int xpos,int ypos), gtk_text_view_move_child)
+ _WRAP_METHOD(void move_overlay(Widget& child, int xpos, int ypos), gtk_text_view_move_overlay)
_WRAP_METHOD(void set_wrap_mode(WrapMode wrap_mode), gtk_text_view_set_wrap_mode)
_WRAP_METHOD(WrapMode get_wrap_mode() const, gtk_text_view_get_wrap_mode)
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index cb15ae2a..c7530a18 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -218,13 +218,13 @@ _CONVERSION(`GtkWidget*',`Button*',`Glib::wrap((GtkButton*)($3))')
_CONVERSION(`GtkWidget*',`Box*',`Glib::wrap((GtkBox*)($3))')
_CONVERSION(`GtkWidget*',`Gtk::CheckButton*',__RP2PD)
_CONVERSION(`GtkWidget*',`Container*',`Glib::wrap((GtkContainer*)($3))')
-_CONVERSION(`GtkWidget*',`const Container*',`Glib::wrap((GtkContainer*)($3))')
_CONVERSION(`GtkWidget*',`Entry*',`Glib::wrap((GtkEntry*)($3))')
_CONVERSION(`GtkWidget*',`HeaderBar*',`Glib::wrap((GtkHeaderBar*)($3))')
_CONVERSION(`GtkWidget*',`Label*',`Glib::wrap((GtkLabel*)($3))')
_CONVERSION(`GtkWidget*',`Menu*',`Glib::wrap((GtkMenu*)($3))')
_CONVERSION(`GtkWidget*',`MenuItem*',`Glib::wrap((GtkMenuItem*)($3))')
_CONVERSION(`GtkWidget*',`OptionMenu*',`Glib::wrap((GtkOptionMenu*)($3))')
+_CONVERSION(`GtkWidget*',`Popover*',`Glib::wrap((GtkPopover*)($3))')
_CONVERSION(`GtkWidget*',`RadioButton*',`Glib::wrap((GtkRadioButton*)($3))')
_CONVERSION(`GtkWidget*',`Gtk::Scrollbar*',__RP2PD)
_CONVERSION(`GtkWidget*',`Gtk::Tree*',__RP2PD)
@@ -239,11 +239,13 @@ _CONVERSION(`GtkWidget*',`FileChooserDialog*',`Glib::wrap((GtkFileChooserDialog*
_CONVERSION(`GtkWidget*',`const Button*',`Glib::wrap((GtkButton*)($3))')
_CONVERSION(`GtkWidget*',`const Box*',`Glib::wrap((GtkBox*)($3))')
_CONVERSION(`GtkWidget*',`const Gtk::CheckButton*',__RP2CPD)
+_CONVERSION(`GtkWidget*',`const Container*',`Glib::wrap((GtkContainer*)($3))')
_CONVERSION(`GtkWidget*',`const Entry*',`Glib::wrap((GtkEntry*)($3))')
_CONVERSION(`GtkWidget*',`const Label*',`Glib::wrap((GtkLabel*)($3))')
_CONVERSION(`GtkWidget*',`const Menu*',`Glib::wrap((GtkMenu*)($3))')
_CONVERSION(`GtkWidget*',`const MenuItem*',`Glib::wrap((GtkMenuItem*)($3))')
_CONVERSION(`GtkWidget*',`const OptionMenu*',`Glib::wrap((GtkOptionMenu*)($3))')
+_CONVERSION(`GtkWidget*',`const Popover*',`Glib::wrap((GtkPopover*)($3))')
_CONVERSION(`GtkWidget*',`const RadioButton*',`Glib::wrap((GtkRadioButton*)($3))')
_CONVERSION(`GtkWidget*',`const Gtk::Scrollbar*',__RP2CPD)
_CONVERSION(`GtkWidget*',`const Gtk::Tree*',__RP2CPD)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]