From 239db6ebc6939bc597df0e4fee9cd5f572c3e5a6 Mon Sep 17 00:00:00 2001 From: Jared Wahlstrand Date: Fri, 24 Nov 2023 19:36:42 -0500 Subject: [PATCH] add a few methods --- src/base.jl | 8 ++++++++ src/events.jl | 2 ++ src/windows.jl | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/src/base.jl b/src/base.jl index 3141ad24..ae7788f8 100644 --- a/src/base.jl +++ b/src/base.jl @@ -112,6 +112,14 @@ Related GTK function: [`gtk_widget_grab_focus`()]($(gtkdoc_method_url("gtk4","Wi """ grab_focus(w::GtkWidget) = G_.grab_focus(w) +""" + isrealized(w::GtkWidget) + +Returns whether `w` is realized (that is, whether it has been associated with +a drawing surface). +""" +isrealized(w::GtkWidget) = G_.get_realized(w) + """ activate(w::GtkWidget) diff --git a/src/events.jl b/src/events.jl index c59e94e1..7dd82f09 100644 --- a/src/events.jl +++ b/src/events.jl @@ -46,6 +46,8 @@ function GtkShortcutController(widget::GtkWidget) g end +push!(sc::GtkShortcutController, s::GtkShortcut) = (G_.add_shortcut(sc,s);sc) + function GtkGestureClick(widget::GtkWidget,button=1) g = G_.GestureClick_new() button != 1 && G_.set_button(g, button) diff --git a/src/windows.jl b/src/windows.jl index d3822051..beaa14e5 100644 --- a/src/windows.jl +++ b/src/windows.jl @@ -39,6 +39,14 @@ Related GTK function: [`gtk_window_default_size`()]($(gtkdoc_method_url("gtk4"," """ default_size(win::GtkWindow, w, h) = G_.set_default_size(win, w, h) +""" + isactive(win::GtkWindow) + +Returns whether `win` is the currently active toplevel. This is the window that +receives keystrokes. +""" +isactive(win::GtkWindow) = G_.is_active(win) + """ destroy(win::GtkWindow)