From eccf234f27203492480c58faee6a40d3ca6f750c Mon Sep 17 00:00:00 2001 From: Ben Arthur Date: Mon, 18 Jan 2016 10:42:45 -0500 Subject: [PATCH] added gtk_grid_remove_row/column convenience function --- src/layout.jl | 10 ++++++++++ test/gui.jl | 13 ++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/layout.jl b/src/layout.jl index 7ac44435..85119f62 100644 --- a/src/layout.jl +++ b/src/layout.jl @@ -57,6 +57,16 @@ if gtk_version == 3 end end + function deleteat!(grid::GtkGrid, i::Integer, side::Symbol) + if side == :row + ccall((:gtk_grid_remove_row,libgtk), Void, (Ptr{GObject}, Cint), grid, i) + elseif side == :col + ccall((:gtk_grid_remove_column,libgtk), Void, (Ptr{GObject}, Cint), grid, i) + else + error(string("invalid GtkPositionType ",s)) + end + end + function insert!(grid::GtkGrid, sibling, side::Symbol) ccall((:gtk_grid_insert_next_to,libgtk), Void, (Ptr{GObject}, Ptr{GObject}, Cint), grid, sibling, GtkPositionType.(side)) end diff --git a/test/gui.jl b/test/gui.jl index b18fdc39..06a21523 100644 --- a/test/gui.jl +++ b/test/gui.jl @@ -133,7 +133,7 @@ push!(w, ex) showall(w) destroy(w) -## Grid +## Table grid = @Table(3,3) w = @Window(grid, "Grid", 400, 400) grid[2,2] = @Button("2,2") @@ -142,6 +142,17 @@ grid[1,1] = "grid" showall(w) destroy(w) +## Grid +grid = @Grid() +w = @Window(grid, "Grid", 400, 400) +grid[2,2] = @Button("2,2") +grid[2,3] = @Button("2,3") +grid[1,1] = "grid" +insert!(grid,1,:top) +deleteat!(grid,1,:row) +showall(w) +destroy(w) + ## Widgets