Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

added gtk_grid_remove_row/column convenience function #214

Merged
merged 1 commit into from
May 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/layout.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 13 additions & 2 deletions test/gui.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Tests
using Gtk.ShortNames, Gtk.GConstants, Gtk.Graphics
import Gtk.deleteat!
import Gtk.deleteat!, Gtk.libgtk_version

## Window
w = @Window("Window", 400, 300) |> showall
Expand Down Expand Up @@ -132,7 +132,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")
Expand All @@ -141,6 +141,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)
libgtk_version >= v"3.10.0" && deleteat!(grid,1,:row)
showall(w)
destroy(w)


## Widgets

Expand Down