@@ -12,7 +12,7 @@ import math
1212// GUI are powerful and granular. See the theme_designer.v program
1313// for more about themes.
1414
15- struct App {
15+ struct ButtonsApp {
1616pub mut :
1717 clicks int
1818 light bool
@@ -21,7 +21,7 @@ pub mut:
2121fn main () {
2222 mut window := gui.window (
2323 title: 'Buttons'
24- state: & App {}
24+ state: & ButtonsApp {}
2525 width: 400
2626 height: 375
2727 on_init: fn (mut w gui.Window) {
@@ -35,7 +35,7 @@ fn main() {
3535
3636fn main_view (mut window gui.Window) gui.View {
3737 w , h := window.window_size ()
38- app := window.state[App ]()
38+ app := window.state[ButtonsApp ]()
3939 button_text := '${app .clicks } Clicks Given'
4040 b_width := f32 (140 )
4141
@@ -129,12 +129,12 @@ fn button_row(label string, button gui.View) gui.View {
129129}
130130
131131fn click_handler (_ & gui.ButtonCfg, mut _ gui.Event, mut w gui.Window) {
132- mut app := w.state[App ]()
132+ mut app := w.state[ButtonsApp ]()
133133 app.clicks + = 1
134134 w.set_id_focus (1 )
135135}
136136
137- fn button_change_theme (app & App ) gui.View {
137+ fn button_change_theme (app & ButtonsApp ) gui.View {
138138 return gui.row (
139139 h_align: .end
140140 sizing: gui.fill_fit
@@ -147,7 +147,7 @@ fn button_change_theme(app &App) gui.View {
147147 padding: gui.theme ().padding_small
148148 select : app.light
149149 on_click: fn (_ & gui.ToggleCfg, mut _ gui.Event, mut w gui.Window) {
150- mut app := w.state[App ]()
150+ mut app := w.state[ButtonsApp ]()
151151 app.light = ! app.light
152152 w.set_theme (if app.light { gui.theme_light } else { gui.theme_dark })
153153 w.set_id_focus (1 )
0 commit comments