Skip to content

Commit

Permalink
add baseline row
Browse files Browse the repository at this point in the history
  • Loading branch information
finanalyst committed Feb 25, 2023
1 parent 3f179b0 commit aeeb9d9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
11 changes: 9 additions & 2 deletions examples/03-grid.raku
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ $app.set-content(
[1, 2, 1, 1] => my $brb = GTK::Simple::ToggleButton.new(label => "bottom right"),

=comment
And for no good reason we put a label to the right that spans the
And for no good reason we put a label (Lx10) to the right that spans the
whole height of our grid.

[2, 0, 1, 3] => my $sdl = GTK::Simple::Label.new(text => ".\n" x 10),
[2, 0, 1, 3] => my $sdl = GTK::Simple::Label.new(text => "L\n" x 10),
)
);

Expand All @@ -58,4 +58,11 @@ $app.border-width = 20;

$grid.attach( [3, 0, 1, 1] => GTK::Simple::Label.new(text => "I got added later"), );

=comment
Then we put another Label into the grid, but we want the text in that text
to be length for that column

$grid.attach( [1, 3, 1, 1] => GTK::Simple::Entry.new(text => "try expanding"), );
$grid.baseline-row: 4;

$app.run;
6 changes: 6 additions & 0 deletions lib/GTK/Simple/Grid.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ method column-spacing()
returns int32
is gtk-property(&gtk_grid_get_column_spacing, &gtk_grid_set_column_spacing)
{*}
#| select the row that is the base-line for the whole grid
method baseline-row()
returns int32
is gtk-property(&gtk_grid_get_baseline_row, &gtk_grid_set_baseline_row)
{*}


# or is it better to just `does GTK::Simple::Container` ?
method border-width
Expand Down
12 changes: 11 additions & 1 deletion lib/GTK/Simple/Raw.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ sub gtk_grid_set_row_spacing(GtkWidget $grid, int32 $spacing)
is export(:grid)
{*}


sub gtk_grid_get_column_spacing(GtkWidget $grid)
is native(&gtk-lib)
is export(:grid)
Expand All @@ -416,6 +415,17 @@ sub gtk_grid_set_column_spacing(GtkWidget $grid, int32 $spacing)
is export(:grid)
{*}

sub gtk_grid_get_baseline_row(GtkWidget $grid)
is native(&gtk-lib)
is export(:grid)
returns int32
{*}

sub gtk_grid_set_baseline_row(GtkWidget $grid, int32 $spacing)
is native(&gtk-lib)
is export(:grid)
{*}

#
# Scale
#
Expand Down

0 comments on commit aeeb9d9

Please sign in to comment.