@@ -176,7 +176,13 @@ defmodule Scenic.Components do
176
176
177
177
178
178
"""
179
- def button ( graph , data , options \\ [ ] )
179
+ @ spec button (
180
+ source :: Graph . t ( ) | Primitive . t ( ) ,
181
+ title :: String . t ( ) ,
182
+ options :: list
183
+ ) :: Graph . t ( ) | Primitive . t ( )
184
+
185
+ def button ( graph , title , options \\ [ ] )
180
186
181
187
def button ( % Graph { } = g , data , options ) do
182
188
add_to_graph ( g , Component.Button , data , options )
@@ -236,6 +242,12 @@ defmodule Scenic.Components do
236
242
|> checkbox( {"Example", true}, id: :checkbox_id, translate: {20, 20} )
237
243
238
244
"""
245
+ @ spec checkbox (
246
+ source :: Graph . t ( ) | Primitive . t ( ) ,
247
+ data :: { String . t ( ) , boolean } ,
248
+ options :: list
249
+ ) :: Graph . t ( ) | Primitive . t ( )
250
+
239
251
def checkbox ( graph , data , options \\ [ ] )
240
252
241
253
def checkbox ( % Graph { } = g , data , options ) do
@@ -320,6 +332,12 @@ defmodule Scenic.Components do
320
332
], :controls}, id: :dropdown_id, translate: {20, 20} )
321
333
322
334
"""
335
+ @ spec dropdown (
336
+ source :: Graph . t ( ) | Primitive . t ( ) ,
337
+ data :: { list ( { String . t ( ) , any } ) , any } ,
338
+ options :: list
339
+ ) :: Graph . t ( ) | Primitive . t ( )
340
+
323
341
def dropdown ( graph , data , options \\ [ ] )
324
342
325
343
def dropdown ( % Graph { } = g , data , options ) do
@@ -399,6 +417,11 @@ defmodule Scenic.Components do
399
417
], id: :radio_group_id, translate: {20, 20} )
400
418
401
419
"""
420
+ @ spec radio_group (
421
+ source :: Graph . t ( ) | Primitive . t ( ) ,
422
+ data :: list ( { String . t ( ) , any } | { String . t ( ) , any , boolean } ) ,
423
+ options :: list
424
+ ) :: Graph . t ( ) | Primitive . t ( )
402
425
def radio_group ( graph , data , options \\ [ ] )
403
426
404
427
def radio_group ( % Graph { } = g , data , options ) do
@@ -456,10 +479,10 @@ defmodule Scenic.Components do
456
479
457
480
### Examples
458
481
459
- The following example creates a numeric sliderand positions it on the screen.
482
+ The following example creates a numeric slider and positions it on the screen.
460
483
461
484
graph
462
- |> Component.Input.Slider.add_to_graph ( {{0,100}, 0, : num_slider} , translate: {20,20} )
485
+ |> slider ( {{0,100}, 0}, id: : num_slider, translate: {20,20} )
463
486
464
487
The following example creates a list slider and positions it on the screen.
465
488
@@ -472,6 +495,12 @@ defmodule Scenic.Components do
472
495
], :cornflower_blue}, id: :slider_id, translate: {20,20} )
473
496
474
497
"""
498
+ @ spec slider (
499
+ source :: Graph . t ( ) | Primitive . t ( ) ,
500
+ data :: { { number , number } , number } | list ,
501
+ options :: list
502
+ ) :: Graph . t ( ) | Primitive . t ( )
503
+
475
504
def slider ( graph , data , options \\ [ ] )
476
505
477
506
def slider ( % Graph { } = g , data , options ) do
@@ -546,6 +575,12 @@ defmodule Scenic.Components do
546
575
"", id: :pass_id, type: :password, hint: "Enter password", translate: {20,20}
547
576
)
548
577
"""
578
+ @ spec text_field (
579
+ source :: Graph . t ( ) | Primitive . t ( ) ,
580
+ data :: String . t ( ) ,
581
+ options :: list
582
+ ) :: Graph . t ( ) | Primitive . t ( )
583
+
549
584
def text_field ( graph , data , options \\ [ ] )
550
585
551
586
def text_field ( % Graph { } = g , data , options ) do
0 commit comments