-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path00014.php
92 lines (76 loc) · 3.11 KB
/
00014.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* PHP-GTK Cookbook
*
* https://andor.com.br/php-gtk/cook/how-to-use-gtkbox-to-display-values-like-a-table
*/
Gtk::init();
$window = new \GtkWindow();
$window->set_size_request(500, 500);
$window->set_title("PHP-GTK");
// create a box
$vbox = new \GtkBox(GtkOrientation::VERTICAL);
$vbox->set_border_width(10);
// create a line
$hbox = new \GtkBox(GtkOrientation::HORIZONTAL);
$hbox->set_homogeneous(TRUE);
$hbox->pack_start(new GtkLabel(" - "), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value A:1"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value B:1"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value C:1"), TRUE, TRUE, 0);
$vbox->pack_start($hbox, FALSE, TRUE, 5);
// create a line
$hbox = new \GtkBox(GtkOrientation::HORIZONTAL);
$hbox->set_homogeneous(TRUE);
$hbox->pack_start(new GtkLabel("Line 1"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value A:1"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value B:1"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value C:1"), TRUE, TRUE, 0);
$vbox->pack_start($hbox, FALSE, TRUE, 5);
// create a line
$hbox = new \GtkBox(GtkOrientation::HORIZONTAL);
$hbox->set_homogeneous(TRUE);
$hbox->pack_start(new GtkLabel("Line 2"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value A:2"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value B:2"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value C:2"), TRUE, TRUE, 0);
$vbox->pack_start($hbox, FALSE, TRUE, 5);
// create a line
$hbox = new \GtkBox(GtkOrientation::HORIZONTAL);
$hbox->set_homogeneous(TRUE);
$hbox->pack_start(new GtkLabel("Line 3"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value A:3"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value B:3"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value C:3"), TRUE, TRUE, 0);
$vbox->pack_start($hbox, FALSE, TRUE, 5);
// create a line
$hbox = new \GtkBox(GtkOrientation::HORIZONTAL);
$hbox->set_homogeneous(TRUE);
$hbox->pack_start(new GtkLabel("Line 4"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value A:4"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value B:4"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value C:4"), TRUE, TRUE, 0);
$vbox->pack_start($hbox, FALSE, TRUE, 5);
// create a line
$hbox = new \GtkBox(GtkOrientation::HORIZONTAL);
$hbox->set_homogeneous(TRUE);
$hbox->pack_start(new GtkLabel("Line 5"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value A:5"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value B:5"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value C:5"), TRUE, TRUE, 0);
$vbox->pack_start($hbox, FALSE, TRUE, 5);
// create a line
$hbox = new \GtkBox(GtkOrientation::HORIZONTAL);
$hbox->set_homogeneous(TRUE);
$hbox->pack_start(new GtkLabel("Line 6"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value A:6"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value B:6"), TRUE, TRUE, 0);
$hbox->pack_start(new GtkLabel("Value C:6"), TRUE, TRUE, 0);
$vbox->pack_start($hbox, FALSE, TRUE, 5);
// add a label only to complete the window area
$vbox->pack_start(new GtkLabel(""), TRUE, TRUE, 0);
// add to window
$window->add($vbox);
// show all and start
$window->show_all();
Gtk::main();