Skip to content

Commit ede6eb4

Browse files
authored
Merge pull request #19 from spytheman/vdoc_workaround
enable `v doc -m -f html -v ~/.vmodules/gui`
2 parents bddd99f + 03e385f commit ede6eb4

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ bin/
3737

3838
# gui
3939
doc/html/
40+
41+
## docs folder, generated by `v doc`
42+
_docs/

examples/buttons.v

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {
1616
pub mut:
1717
clicks int
1818
light bool
@@ -21,7 +21,7 @@ pub mut:
2121
fn 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

3636
fn 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

131131
fn 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

Comments
 (0)