Skip to content

Commit

Permalink
Changed GridCell properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Qwerp-Derp committed Jul 23, 2018
1 parent e1136b1 commit f48a15e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
6 changes: 5 additions & 1 deletion examples/grid_gallery.cr
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ class GridGallery < Hedron::Application
grid = Hedron::Grid.new
grid.padded = true

cell_info = Hedron::GridCell.new({1, 1}, false, Hedron::Align::Fill, false, Hedron::Align::Fill)
cell_info = Hedron::GridCell.new(
size: {1, 1},
expand: {false, false},
align: {Hedron::Align::Fill, Hedron::Align::Fill}
)

grid.push(Hedron::Label.new("Name"), {0, 0}, cell_info)
grid.push(Hedron::Label.new("Surname"), {0, 1}, cell_info)
Expand Down
16 changes: 7 additions & 9 deletions src/hedron/ui/grid.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ require "../widget/*"
module Hedron
struct GridCell
property size : Tuple(Int32, Int32)
property expand_x : Bool
property align_x : Align
property expand_y : Bool
property align_y : Align
property expand : Tuple(Bool, Bool)
property align : Tuple(Align, Align)

def initialize(@size, @expand_x, @align_x, @expand_y, @align_y); end
def initialize(@size, @expand, @align); end
end

class Grid < Widget
Expand All @@ -31,8 +29,8 @@ module Hedron
ui_control(next_to.control.to_unsafe),
side,
cell_info.size[0], cell_info.size[1],
to_int(cell_info.expand_x), cell_info.align_x.value,
to_int(cell_info.expand_y), cell_info.align_y.value
to_int(cell_info.expand[0]), cell_info.align[0].value,
to_int(cell_info.expand[1]), cell_info.align[1].value
)
end

Expand All @@ -50,8 +48,8 @@ module Hedron
ui_control(widget.control.to_unsafe),
coords[0], coords[1],
cell_info.size[0], cell_info.size[1],
to_int(cell_info.expand_x), cell_info.align_x.value,
to_int(cell_info.expand_y), cell_info.align_y.value
to_int(cell_info.expand[0]), cell_info.align[0].value,
to_int(cell_info.expand[1]), cell_info.align[1].value
)
end

Expand Down

0 comments on commit f48a15e

Please sign in to comment.