Babysteps vol. 3.

This commit is contained in:
Jordan Petridis
2017-10-10 01:07:22 +03:00
parent fda21cdf16
commit 10fd018f1f
3 changed files with 28 additions and 525 deletions
+19 -1
View File
@@ -2,11 +2,22 @@
extern crate gtk;
// extern crate gdk_pixbuf;
// use gtk::prelude::*;
use gtk::prelude::*;
use gtk::Orientation;
use gtk::IconSize;
// use gtk::{CellRendererText, TreeStore, TreeView, TreeViewColumn};
use gtk::prelude::*;
fn create_child(name: &str) -> gtk::Box {
let box_ = gtk::Box::new(Orientation::Vertical, 5);
let img = gtk::Image::new_from_icon_name("gtk-missing-image", IconSize::Menu.into());
let label = gtk::Label::new(name);
box_.pack_start(&img, true, true, 0);
box_.pack_start(&label, false, false, 0);
box_
}
fn main() {
if gtk::init().is_err() {
println!("Failed to initialize GTK.");
@@ -29,6 +40,13 @@ fn main() {
Inhibit(false)
});
let flowbox: gtk::FlowBox = builder.get_object("flowbox1").unwrap();
for _ in 0..10 {
let f = create_child("placeholder");
flowbox.add(&f);
}
window.show_all();
gtk::main();
}