Panes
Creating multi-pane app layouts

executable(
meson.project_name(),
'src' / 'Application.vala',
dependencies: [
dependency('granite-7'),
dependency('gtk4')
],
install: true
)Last updated
Was this helpful?
Creating multi-pane app layouts

executable(
meson.project_name(),
'src' / 'Application.vala',
dependencies: [
dependency('granite-7'),
dependency('gtk4')
],
install: true
)Last updated
Was this helpful?
Was this helpful?
var main_window = new Gtk.ApplicationWindow (this) {
titlebar = new Gtk.Grid () { visible = false }
};var paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL) {
resize_start_child = false,
shrink_end_child = false,
shrink_start_child = false
};
var main_window = new Gtk.ApplicationWindow (this) {
child = paned,
titlebar = new Gtk.Grid () { visible = false }
};var start_header = new Gtk.HeaderBar () {
show_title_buttons = false
};
start_header.add_css_class (Granite.STYLE_CLASS_FLAT);
start_header.pack_start (new Gtk.WindowControls (Gtk.PackType.START));
var start_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
start_box.append (start_header);
var paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL) {
start_child = start_box,
resize_start_child = false,
shrink_end_child = false,
shrink_start_child = false
};
var main_window = new Gtk.ApplicationWindow (this) {
child = paned,
titlebar = new Gtk.Grid () { visible = false }
};var start_header = new Gtk.HeaderBar () {
show_title_buttons = false
};
start_header.add_css_class (Granite.STYLE_CLASS_FLAT);
start_header.pack_start (new Gtk.WindowControls (Gtk.PackType.START));
var start_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
start_box.append (start_header);
var end_header = new Gtk.HeaderBar () {
show_title_buttons = false
};
end_header.add_css_class (Granite.STYLE_CLASS_FLAT);
end_header.pack_end (new Gtk.WindowControls (Gtk.PackType.END));
var end_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
end_box.append (end_header);
var paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL) {
start_child = start_box,
end_child = end_box,
resize_start_child = false,
shrink_end_child = false,
shrink_start_child = false
};
var main_window = new Gtk.ApplicationWindow (this) {
child = paned,
titlebar = new Gtk.Grid () { visible = false }
};public class MyApp : Gtk.Application {
public MyApp () {
Object (
application_id: "io.github.myteam.myapp",
flags: ApplicationFlags.DEFAULT_FLAGS
);
}
protected override void activate () {
var start_header = new Gtk.HeaderBar () {
show_title_buttons = false,
title_widget = new Gtk.Label ("")
};
start_header.add_css_class (Granite.STYLE_CLASS_FLAT);
start_header.pack_start (new Gtk.WindowControls (Gtk.PackType.START));
var start_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
start_box.append (start_header);
var end_header = new Gtk.HeaderBar () {
show_title_buttons = false
};
end_header.add_css_class (Granite.STYLE_CLASS_FLAT);
end_header.pack_end (new Gtk.WindowControls (Gtk.PackType.END));
var end_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
end_box.add_css_class (Granite.STYLE_CLASS_VIEW);
end_box.append (end_header);
var paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL) {
start_child = start_box,
end_child = end_box,
resize_start_child = false,
shrink_end_child = false,
shrink_start_child = false
};
var main_window = new Gtk.ApplicationWindow (this) {
child = paned,
default_height = 300,
default_width = 300,
titlebar = new Gtk.Grid () { visible = false },
title = "Hello World"
};
main_window.present ();
}
public static int main (string[] args) {
return new MyApp ().run (args);
}
}