Skip to content

Commit

Permalink
update for GTK 4.14, wrap "scroll_to" for list widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
jwahlstrand committed Aug 24, 2024
1 parent e12a572 commit 0f65bbc
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/Gtk4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ eval(include("gen/gsk4_structs"))
eval(include("gen/gtk4_consts"))
eval(include("gen/gtk4_structs"))

const ModifierType_NONE = ModifierType_NO_MODIFIER_MASK

module G_

using GTK4_jll, Glib_jll
Expand Down
8 changes: 4 additions & 4 deletions src/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ end
Flag `w` to be displayed and return `w`.
Related GTK function: [`gtk_widget_show`()]($(gtkdoc_method_url("gtk4","Widget","show")))
Related GTK function: [`gtk_widget_set_visible`()]($(gtkdoc_method_url("gtk4","Widget","set_visible")))
"""
function show(w::GtkWidget)
G_.show(w)
G_.set_visible(w, true)
w
end

Expand All @@ -95,10 +95,10 @@ end
Flag `w` to be hidden and return `w`. This is the opposite of `show`.
Related GTK function: [`gtk_widget_hide`()]($(gtkdoc_method_url("gtk4","Widget","hide")))
Related GTK function: [`gtk_widget_set_visible`()]($(gtkdoc_method_url("gtk4","Widget","set_visible")))
"""
function hide(w::GtkWidget)
G_.hide(w)
G_.set_visible(w, false)
w
end

Expand Down
13 changes: 13 additions & 0 deletions src/lists.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,20 @@ GObject properties.
"""
GtkGridView(model=nothing; kwargs...) = GtkGridView(model, nothing; kwargs...)

function scroll_to(lv::Union{GtkListView,GtkGridView}, pos, flags = ListScrollFlags_NONE)
G_.scroll_to(lv, pos - 1, flags, nothing)
end

GtkColumnView(; kwargs...) = GtkColumnView(nothing; kwargs...)

function scroll_to(cv::GtkColumnView, pos, flags::ListScrollFlags = ListScrollFlags_NONE)
G_.scroll_to(lv, pos - 1, nothing, flags, nothing)
end

function scroll_to(cv::GtkColumnView, pos, column::GtkColumnViewColumn, flags::ListScrollFlags = ListScrollFlags_NONE)
G_.scroll_to(lv, pos - 1, column, flags, nothing)
end

GtkColumnViewColumn(title=""; kwargs...) = GtkColumnViewColumn(title, nothing; kwargs...)
push!(cv::GtkColumnView, cvc::GtkColumnViewColumn) = (G_.append_column(cv,cvc); cv)

Expand Down
13 changes: 10 additions & 3 deletions src/windows.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ Related GTK function: [`gtk_window_is_fullscreen`()]($(gtkdoc_method_url("gtk4",
"""
isfullscreen(win::GtkWindow) = G_.is_fullscreen(win)

"""
issuspended(win::GtkWindow)
Get whether `win` is in a state where it's invisible to the user.
Related GTK function: [`gtk_window_is_suspended`()]($(gtkdoc_method_url("gtk4","Window","is_suspended")))
"""
issuspended(win::GtkWindow) = G_.is_suspended(win)

"""
maximize(win::GtkWindow)
Expand All @@ -139,9 +148,7 @@ unmaximize(win::GtkWindow) = G_.unmaximize(win)
present(win::GtkWindow)
present(win::GtkWindow, timestamp)
Presents a window to the user. Usually means move it to the front. According to
the GTK docs, this function "should not be used" without including a timestamp
for the user's request.
Presents a window to the user. Usually means move it to the front.
Related GTK function: [`gtk_window_present`()]($(gtkdoc_method_url("gtk4","Window","present")))
Related GTK function: [`gtk_window_present_with_time`()]($(gtkdoc_method_url("gtk4","Window","present_with_time")))
Expand Down

0 comments on commit 0f65bbc

Please sign in to comment.