Skip to content

Commit

Permalink
add some missing Pango auto-generated methods, support GtkFontDialog
Browse files Browse the repository at this point in the history
jwahlstrand committed Jan 15, 2024
1 parent bd9e385 commit 2c7132c
Showing 6 changed files with 407 additions and 7 deletions.
7 changes: 7 additions & 0 deletions examples/font_dialog.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using Gtk4

cb(dlg, resobj) = println("you chose "*Gtk4.font(dlg, resobj))

dlg = GtkFontDialog()
Gtk4.choose_font(cb, dlg)

7 changes: 3 additions & 4 deletions gen/gen_pango.jl
Original file line number Diff line number Diff line change
@@ -22,15 +22,14 @@ GI.write_to_file(path,"pango_consts",toplevel)

toplevel, exprs, exports = GI.output_exprs()

struct_skiplist=Symbol[]

first_list=[:Language,:Color,:AttrClass,:Rectangle,:FontDescription,:Attribute,:Analysis,:Item,:GlyphVisAttr,:GlyphGeometry,:GlyphInfo,:GlyphString,:GlyphItem]
GI.struct_cache_expr!(exprs)
GI.struct_exprs!(exprs,exports,ns,first_list)

struct_skiplist=vcat(first_list,struct_skiplist)
struct_skiplist,c = GI.all_struct_exprs!(exprs,exports,ns;excludelist=first_list)

struct_skiplist,c = GI.all_struct_exprs!(exprs,exports,ns;excludelist=struct_skiplist)
# we want the methods from first_list
struct_skiplist=Symbol[]

## objects

1 change: 1 addition & 0 deletions src/Pango/Pango.jl
Original file line number Diff line number Diff line change
@@ -70,6 +70,7 @@ eltype(::Type{PangoFontFamily}) = PangoFontFace
Base.keys(ff::PangoFontFamily) = 1:length(ff)

PangoFontDescription(s::AbstractString) = G_.font_description_from_string(s)
Base.show(io::IO, pfd::PangoFontDescription) = print(io, "PangoFontDescription(" * G_.to_string(pfd) * ")")

PangoLayout(cr::cairoContext) = G_.create_layout(cr)

6 changes: 3 additions & 3 deletions src/gen/pango_consts
Original file line number Diff line number Diff line change
@@ -11,9 +11,9 @@ $(Expr(:toplevel, quote
const GLYPH_UNKNOWN_FLAG = 0x10000000
const SCALE = 1024
const VERSION_MAJOR = 1
const VERSION_MICRO = 14
const VERSION_MINOR = 50
const VERSION_STRING = "1.50.14"
const VERSION_MICRO = 0
const VERSION_MINOR = 51
const VERSION_STRING = "1.51.0"
begin
@cenum Alignment::Int32 Alignment_LEFT = 0 Alignment_CENTER = 1 Alignment_RIGHT = 2
(GLib.g_type(::Type{T}) where T <: Alignment) = begin
387 changes: 387 additions & 0 deletions src/gen/pango_methods

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/windows.jl
Original file line number Diff line number Diff line change
@@ -693,3 +693,9 @@ end
Get the paths selected by the user in a "select multiple folders" dialog.
"""
select_multiple_folder_paths(dlg, resobj) = _path_multiple_finish(Gtk4.G_.select_multiple_folders_finish, dlg, resobj)

function choose_font(cb, dlg::GtkFontDialog, parent = nothing, cancellable = nothing)
G_.choose_font(dlg, parent, nothing, cancellable, cb)
end

font(dlg, resobj) = G_.choose_font_finish(dlg, GAsyncResult(resobj))

0 comments on commit 2c7132c

Please sign in to comment.