Skip to content

Commit 35c0f28

Browse files
committed
Take the label into account for child properties
1 parent 7a5ece1 commit 35c0f28

18 files changed

Lines changed: 189 additions & 34 deletions

File tree

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "MIT"
77
name = "relm"
88
readme = "README.adoc"
99
repository = "https://github.com/antoyo/relm"
10-
version = "0.11.0"
10+
version = "0.12.0"
1111
[badges.appveyor]
1212
branch = "master"
1313
repository = "antoyo/relm"
@@ -27,11 +27,11 @@ libc = "^0.2.22"
2727

2828
[dependencies.relm-core]
2929
path = "relm-core"
30-
version = "^0.11.0"
30+
version = "^0.12.0"
3131

3232
[dependencies.relm-state]
3333
path = "relm-state"
34-
version = "^0.11.0"
34+
version = "^0.12.0"
3535

3636
[dev-dependencies]
3737
chrono = "^0.3.0"
@@ -42,15 +42,15 @@ version = "^0.3.0"
4242

4343
[dev-dependencies.relm-attributes]
4444
path = "relm-attributes"
45-
version = "^0.11.0"
45+
version = "^0.12.0"
4646

4747
[dev-dependencies.relm-derive]
4848
path = "relm-derive"
49-
version = "^0.11.0"
49+
version = "^0.12.0"
5050

5151
[dev-dependencies.relm-test]
5252
path = "relm-test"
53-
version = "^0.11.0"
53+
version = "^0.12.0"
5454

5555
[features]
5656
nightly = []

examples/buttons-child-attribute.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl Widget for Win {
8383
label: "-",
8484
},
8585
gtk::Button {
86-
packing: {
86+
child: {
8787
expand: false,
8888
fill: true,
8989
pack_type: PackType::Start,

examples/child-prop-attribute.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl Widget for Button {
5757

5858
view! {
5959
gtk::Button {
60-
packing: {
60+
child: {
6161
expand: false,
6262
fill: true,
6363
pack_type: PackType::Start,

examples/container-attribute.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl Widget for Win {
112112
gtk::Window {
113113
VBox {
114114
gtk::Button {
115-
packing: {
115+
child: {
116116
padding: 20,
117117
},
118118
clicked => Increment,

examples/grid-attributes.rs

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
/*
2+
* Copyright (c) 2017 Boucher, Antoni <bouanto@zoho.com>
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
5+
* this software and associated documentation files (the "Software"), to deal in
6+
* the Software without restriction, including without limitation the rights to
7+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8+
* the Software, and to permit persons to whom the Software is furnished to do so,
9+
* subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
*/
21+
22+
#![feature(proc_macro)]
23+
24+
extern crate gtk;
25+
#[macro_use]
26+
extern crate relm;
27+
extern crate relm_attributes;
28+
#[macro_use]
29+
extern crate relm_derive;
30+
31+
use gtk::{
32+
ButtonExt,
33+
GridExt,
34+
Inhibit,
35+
LabelExt,
36+
WidgetExt,
37+
};
38+
use relm::Widget;
39+
use relm_attributes::widget;
40+
41+
use self::Msg::*;
42+
43+
#[derive(Msg)]
44+
pub enum Msg {
45+
Quit,
46+
}
47+
48+
#[widget]
49+
impl Widget for Win {
50+
fn model() -> () {
51+
}
52+
53+
fn update(&mut self, event: Msg) {
54+
match event {
55+
Quit => gtk::main_quit(),
56+
}
57+
}
58+
59+
view! {
60+
gtk::Window {
61+
gtk::Grid {
62+
gtk::Button {
63+
label: "7",
64+
cell: {
65+
left_attach: 0,
66+
top_attach: 0,
67+
},
68+
},
69+
gtk::Button {
70+
label: "8",
71+
cell: {
72+
left_attach: 1,
73+
top_attach: 0,
74+
},
75+
},
76+
gtk::Button {
77+
label: "9",
78+
cell: {
79+
left_attach: 2,
80+
top_attach: 0,
81+
},
82+
},
83+
gtk::Button {
84+
label: "4",
85+
cell: {
86+
left_attach: 0,
87+
top_attach: 1,
88+
},
89+
},
90+
gtk::Button {
91+
label: "5",
92+
cell: {
93+
left_attach: 1,
94+
top_attach: 1,
95+
},
96+
},
97+
gtk::Button {
98+
label: "6",
99+
cell: {
100+
left_attach: 2,
101+
top_attach: 1,
102+
},
103+
},
104+
gtk::Button {
105+
label: "1",
106+
cell: {
107+
left_attach: 0,
108+
top_attach: 2,
109+
},
110+
},
111+
gtk::Button {
112+
label: "2",
113+
cell: {
114+
left_attach: 1,
115+
top_attach: 2,
116+
},
117+
},
118+
gtk::Button {
119+
label: "3",
120+
cell: {
121+
left_attach: 2,
122+
top_attach: 2,
123+
},
124+
},
125+
gtk::Button {
126+
label: "+/-",
127+
cell: {
128+
left_attach: 0,
129+
top_attach: 3,
130+
},
131+
},
132+
gtk::Button {
133+
label: "0",
134+
cell: {
135+
left_attach: 1,
136+
top_attach: 3,
137+
},
138+
},
139+
gtk::Button {
140+
label: ".",
141+
cell: {
142+
left_attach: 2,
143+
top_attach: 3,
144+
},
145+
}
146+
},
147+
delete_event(_, _) => (Quit, Inhibit(false))
148+
}
149+
}
150+
}
151+
152+
fn main() {
153+
Win::run(()).unwrap();
154+
}

examples/multi-container-attribute.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl Widget for SplitBox {
113113
},
114114
#[container="right"]
115115
MyFrame {
116-
packing: {
116+
child: {
117117
padding: 10,
118118
},
119119
}

examples/tabs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl Widget for Win {
6161
gtk::Window {
6262
gtk::Notebook {
6363
gtk::Button {
64-
tab: {
64+
child: {
6565
tab_label: Some("First Button"),
6666
},
6767
label: "+",

relm-attributes/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ documentation = "https://docs.rs/relm-attributes/"
55
license = "MIT"
66
name = "relm-attributes"
77
repository = "https://github.com/antoyo/relm"
8-
version = "0.11.0"
8+
version = "0.12.0"
99

1010
[dependencies]
1111
env_logger = "^0.4.2"
@@ -15,7 +15,7 @@ syn = "^0.11.9"
1515

1616
[dependencies.relm-gen-widget]
1717
path = "../relm-gen-widget"
18-
version = "^0.11.0"
18+
version = "^0.12.0"
1919

2020
[lib]
2121
proc-macro = true

relm-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ documentation = "https://docs.rs/relm-core/"
66
license = "MIT"
77
name = "relm-core"
88
repository = "https://github.com/antoyo/relm"
9-
version = "0.11.0"
9+
version = "0.12.0"
1010

1111
[dependencies]
1212
futures = "^0.1.14"

relm-derive-common/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ description = "Common derive implementation internally used by relm crates"
44
license = "MIT"
55
name = "relm-derive-common"
66
repository = "https://github.com/antoyo/relm"
7-
version = "0.11.0"
7+
version = "0.12.0"
88

99
[dependencies]
1010
quote = "^0.3.15"
1111
syn = "^0.11.11"
1212

1313
[dependencies.relm-gen-widget]
1414
path = "../relm-gen-widget"
15-
version = "^0.11.0"
15+
version = "^0.12.0"

0 commit comments

Comments
 (0)