Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
OPTION GUI TRUE
|
||||
PRAGMA GUI gtk3
|
||||
|
||||
DECLARE (*show)() = gtk_widget_show_all TYPE void
|
||||
DECLARE (*hide)() = gtk_widget_hide TYPE void
|
||||
|
||||
gui = GUIDEFINE(" \
|
||||
{ type=WINDOW name=window callback=delete-event title=\"Rosetta Code\" width-request=200 } \
|
||||
{ type=BOX name=box parent=window orientation=GTK_ORIENTATION_VERTICAL } \
|
||||
{ type=SPIN_BUTTON name=spin parent=box numeric=TRUE } \
|
||||
{ type=BUTTON_BOX name=bbox parent=box } \
|
||||
{ type=BUTTON name=increment parent=bbox callback=clicked label=\"Increment\" } \
|
||||
{ type=BUTTON name=random parent=bbox callback=clicked label=\"Random\" } \
|
||||
{ type=MESSAGE_DIALOG name=confirm callback=delete-event callback=response,yesno message-type=GTK_MESSAGE_WARNING buttons=GTK_BUTTONS_YES_NO title=\"Warning\" text=\"Get random number?\" }")
|
||||
|
||||
CALL GUISET(gui, "spin", "adjustment", gtk_adjustment_new(0, 0, MAXNUM(float), 1, 1, 0))
|
||||
|
||||
DECLARE answer TYPE int*
|
||||
DECLARE input TYPE FLOATING
|
||||
|
||||
WHILE TRUE
|
||||
event$ = GUIEVENT$(gui, TRUE)
|
||||
SELECT TOKEN$(event$, 1)
|
||||
CASE "window"
|
||||
BREAK
|
||||
CASE "increment"
|
||||
CALL GUIGET(gui, "spin", "value", &input)
|
||||
CALL GUISET(gui, "spin", "value", input+1)
|
||||
CASE "random"
|
||||
CALL GUIFN(gui, "confirm", show)
|
||||
CASE "yesno"
|
||||
answer = (intptr_t)DEC(TOKEN$(event$, 2))
|
||||
IF *answer = GTK_RESPONSE_YES THEN CALL GUISET(gui, "spin", "value", RANDOM(MAXNUM(float)))
|
||||
CALL GUIFN(gui, "confirm", hide)
|
||||
ENDSELECT
|
||||
WEND
|
||||
Loading…
Add table
Add a link
Reference in a new issue