-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path00032.php
138 lines (117 loc) · 4.42 KB
/
00032.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
/**
* PHP-GTK Cookbook
*
* https://andor.com.br/php-gtk/cook/how-to-use-gtkbox-to-display-values-like-a-table-styling-columns
*/
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($label = new GtkLabel("Column A"), TRUE, TRUE, 0);
$label->set_name("heading");
$hbox->pack_start($label = new GtkLabel("Column B"), TRUE, TRUE, 0);
$label->set_name("heading");
$hbox->pack_start($label = new GtkLabel("Column C"), TRUE, TRUE, 0);
$label->set_name("heading");
$vbox->pack_start($hbox, FALSE, TRUE, 5);
// create a line
$hbox = new \GtkBox(GtkOrientation::HORIZONTAL);
$hbox->set_homogeneous(TRUE);
$hbox->pack_start($label = new GtkLabel("Line 1"), TRUE, TRUE, 0);
$label->set_name("heading");
$hbox->pack_start($label = new GtkLabel("Value A:1"), TRUE, TRUE, 0);
$label->set_name("values");
$hbox->pack_start($label = new GtkLabel("Value B:1"), TRUE, TRUE, 0);
$label->set_name("values");
$hbox->pack_start($label = new GtkLabel("Value C:1"), TRUE, TRUE, 0);
$label->set_name("values");
$vbox->pack_start($hbox, FALSE, TRUE, 5);
// create a line
$hbox = new \GtkBox(GtkOrientation::HORIZONTAL);
$hbox->set_homogeneous(TRUE);
$hbox->pack_start($label = new GtkLabel("Line 2"), TRUE, TRUE, 0);
$label->set_name("heading");
$hbox->pack_start($label = new GtkLabel("Value A:2"), TRUE, TRUE, 0);
$label->set_name("values");
$hbox->pack_start($label = new GtkLabel("Value B:2"), TRUE, TRUE, 0);
$label->set_name("values");
$hbox->pack_start($label = new GtkLabel("Value C:2"), TRUE, TRUE, 0);
$label->set_name("values");
$vbox->pack_start($hbox, FALSE, TRUE, 5);
// create a line
$hbox = new \GtkBox(GtkOrientation::HORIZONTAL);
$hbox->set_homogeneous(TRUE);
$hbox->pack_start($label = new GtkLabel("Line 3"), TRUE, TRUE, 0);
$label->set_name("heading");
$hbox->pack_start($label = new GtkLabel("Value A:3"), TRUE, TRUE, 0);
$label->set_name("values");
$hbox->pack_start($label = new GtkLabel("Value B:3"), TRUE, TRUE, 0);
$label->set_name("values");
$hbox->pack_start($label = new GtkLabel("Value C:3"), TRUE, TRUE, 0);
$label->set_name("values");
$vbox->pack_start($hbox, FALSE, TRUE, 5);
// create a line
$hbox = new \GtkBox(GtkOrientation::HORIZONTAL);
$hbox->set_homogeneous(TRUE);
$hbox->pack_start($label = new GtkLabel("Line 4"), TRUE, TRUE, 0);
$label->set_name("heading");
$hbox->pack_start($label = new GtkLabel("Value A:4"), TRUE, TRUE, 0);
$label->set_name("values");
$hbox->pack_start($label = new GtkLabel("Value B:4"), TRUE, TRUE, 0);
$label->set_name("values");
$hbox->pack_start($label = new GtkLabel("Value C:4"), TRUE, TRUE, 0);
$label->set_name("values");
$vbox->pack_start($hbox, FALSE, TRUE, 5);
// create a line
$hbox = new \GtkBox(GtkOrientation::HORIZONTAL);
$hbox->set_homogeneous(TRUE);
$hbox->pack_start($label = new GtkLabel("Line 5"), TRUE, TRUE, 0);
$label->set_name("heading");
$hbox->pack_start($label = new GtkLabel("Value A:5"), TRUE, TRUE, 0);
$label->set_name("values");
$hbox->pack_start($label = new GtkLabel("Value B:5"), TRUE, TRUE, 0);
$label->set_name("values");
$hbox->pack_start($label = new GtkLabel("Value C:5"), TRUE, TRUE, 0);
$label->set_name("values");
$vbox->pack_start($hbox, FALSE, TRUE, 5);
// create a line
$hbox = new \GtkBox(GtkOrientation::HORIZONTAL);
$hbox->set_homogeneous(TRUE);
$hbox->pack_start($label = new GtkLabel("Line 6"), TRUE, TRUE, 0);
$label->set_name("heading");
$hbox->pack_start($label = new GtkLabel("Value A:6"), TRUE, TRUE, 0);
$label->set_name("values");
$hbox->pack_start($label = new GtkLabel("Value B:6"), TRUE, TRUE, 0);
$label->set_name("values");
$hbox->pack_start($label = new GtkLabel("Value C:6"), TRUE, TRUE, 0);
$label->set_name("values");
$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);
//
$css_provider = new GtkCssProvider();
$css_provider->load_from_data("
#heading {
background: #8c9da3;
color: #000;
border-right: 1px #000 solid;
}
#values {
border-bottom: 1px #8c9da3 solid;
}
");
$style_context = new GtkStyleContext();
$style_context->add_provider_for_screen($css_provider, 600);
// show all and start
$window->show_all();
Gtk::main();