Skip to content

Commit

Permalink
generate methods for ShortcutTrigger, add another method for add_action
Browse files Browse the repository at this point in the history
  • Loading branch information
jwahlstrand committed Sep 24, 2023
1 parent d8c7868 commit b450b3d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gen/gen_gtk4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ GI.all_struct_methods!(exprs,ns,struct_skiplist=vcat(struct_skiplist,[:Bitset,:B

skiplist=[:create_closure,:activate_cell,:event,:start_editing,:filter_keypress,:append_node,:im_context_filter_keypress,:get_backlog,:get,:get_default,:get_for_display,:get_current_event_state,:get_axes]

object_skiplist=vcat(object_skiplist,[:CellRenderer,:MnemonicAction,:NeverTrigger,:NothingAction,:PrintJob,:PrintSettings,:RecentManager,:ShortcutTrigger])
object_skiplist=vcat(object_skiplist,[:CellRenderer,:MnemonicAction,:NeverTrigger,:NothingAction,:PrintJob,:PrintSettings,:RecentManager])

# skips are to avoid method name collisions
GI.all_object_methods!(exprs,ns;skiplist=skiplist,object_skiplist=object_skiplist,exclude_deprecated=false)
Expand Down
8 changes: 8 additions & 0 deletions src/GLib/actions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ function add_action(m::GActionMap, name::AbstractString, handler::Function)
action
end

function add_action(m::GActionMap, name::AbstractString, cb, user_data)
action = GSimpleAction(name)
push!(m,GAction(action))
signal_connect(cb, action, :activate, Nothing,
(Ptr{GVariant},), false, user_data)
action
end

function add_stateful_action(m::GActionMap, name::AbstractString, initial_state, handler::Function)
action = GSimpleAction(name, nothing, GVariant(initial_state))
push!(m,GAction(action))
Expand Down
5 changes: 5 additions & 0 deletions src/events.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ function GtkEventControllerKey(widget::GtkWidget)
push!(widget, g)
g
end
function GtkShortcutController(widget::GtkWidget)
g = G_.ShortcutController_new()
push!(widget, g)
g
end

function GtkGestureClick(widget::GtkWidget,button=1)
g = G_.GestureClick_new()
Expand Down
42 changes: 42 additions & 0 deletions src/gen/gtk4_methods
Original file line number Diff line number Diff line change
Expand Up @@ -9627,6 +9627,48 @@ $(Expr(:toplevel, quote
ret = ccall(("gtk_shortcut_label_set_disabled_text", libgtk4), Nothing, (Ptr{GObject}, Cstring), instance, _disabled_text)
nothing
end
function ShortcutTrigger_parse_string(_string::Union{AbstractString, Symbol})
ret = ccall(("gtk_shortcut_trigger_parse_string", libgtk4), Ptr{GObject}, (Cstring,), _string)
ret2 = convert_if_not_null(GtkShortcutTrigger, ret, true)
ret2
end
function compare(instance::GtkShortcutTrigger, _trigger2::GtkShortcutTrigger)
ret = ccall(("gtk_shortcut_trigger_compare", libgtk4), Int32, (Ptr{GObject}, Ptr{GObject}), instance, _trigger2)
ret
end
function equal(instance::GtkShortcutTrigger, _trigger2::GtkShortcutTrigger)
ret = ccall(("gtk_shortcut_trigger_equal", libgtk4), Cint, (Ptr{GObject}, Ptr{GObject}), instance, _trigger2)
ret2 = convert(Bool, ret)
ret2
end
function hash(instance::GtkShortcutTrigger)
ret = ccall(("gtk_shortcut_trigger_hash", libgtk4), UInt32, (Ptr{GObject},), instance)
ret
end
function print(instance::GtkShortcutTrigger, _string::Union{GString, Ref{_GString}})
ret = ccall(("gtk_shortcut_trigger_print", libgtk4), Nothing, (Ptr{GObject}, Ptr{_GString}), instance, _string)
nothing
end
function print_label(instance::GtkShortcutTrigger, _display::GdkDisplay, _string::Union{GString, Ref{_GString}})
ret = ccall(("gtk_shortcut_trigger_print_label", libgtk4), Cint, (Ptr{GObject}, Ptr{GObject}, Ptr{_GString}), instance, _display, _string)
ret2 = convert(Bool, ret)
ret2
end
function to_label(instance::GtkShortcutTrigger, _display::GdkDisplay)
ret = ccall(("gtk_shortcut_trigger_to_label", libgtk4), Cstring, (Ptr{GObject}, Ptr{GObject}), instance, _display)
ret2 = string_or_nothing(ret, true)
ret2
end
function to_string(instance::GtkShortcutTrigger)
ret = ccall(("gtk_shortcut_trigger_to_string", libgtk4), Cstring, (Ptr{GObject},), instance)
ret2 = string_or_nothing(ret, true)
ret2
end
function trigger(instance::GtkShortcutTrigger, _event::GdkEvent, _enable_mnemonics::Bool)
ret = ccall(("gtk_shortcut_trigger_trigger", libgtk4), UInt32, (Ptr{GObject}, Ptr{GdkEvent}, Cint), instance, _event, _enable_mnemonics)
ret2 = KeyMatch(ret)
ret2
end
function SignalAction_new(_signal_name::Union{AbstractString, Symbol})
ret = ccall(("gtk_signal_action_new", libgtk4), Ptr{GObject}, (Cstring,), _signal_name)
ret2 = GtkSignalActionLeaf(ret, true)
Expand Down

0 comments on commit b450b3d

Please sign in to comment.