|
| 1 | +Rebol [ |
| 2 | + Title: "Test View" |
| 3 | + File: %test-view.r3 |
| 4 | + Purpose: "Minimal view (GUI) tests" |
| 5 | +] |
| 6 | + |
| 7 | +unless module? system/modules/window [ |
| 8 | + print as-purple "View is not available on this Rebol version!" |
| 9 | + ;; so far it is only on Windows (in a Bulk product)! |
| 10 | + quit/return 1 |
| 11 | +] |
| 12 | + |
| 13 | +pos: (system/view/screen-gob/size - 600x600) / 2 ;= to center the windows |
| 14 | + |
| 15 | +;- open window at offset 0x0 |
| 16 | +view/as-is make gob! 600x600 |
| 17 | + |
| 18 | +;- open window with offset and title |
| 19 | +view/as-is make gob! [size: 600x600 offset: :pos text: "My title"] |
| 20 | + |
| 21 | +;- open window with a background color |
| 22 | +;BUG: does not work! |
| 23 | +;view/as-is w: make gob! [size: 600x600 color: 0.0.0] |
| 24 | + |
| 25 | +;- using view/options |
| 26 | +view/options make gob! [size: 600x600] [title: "Resizable window" flags: [resize] offset: :pos] |
| 27 | + |
| 28 | +print "Use ALT+F4 to close windows without title bar!" |
| 29 | +view/options make gob! [size: 600x600] [title: "Window" flags: [no-title] offset: :pos] |
| 30 | +view/options make gob! [size: 600x600] [title: "Window" flags: [no-title no-border] offset: :pos] |
| 31 | +view/options/as-is make gob! [size: 600x600 offset: :pos] [title: "Window" flags: [no-title no-border]] |
| 32 | + |
| 33 | +;BUG: fullscreen does not work:/ |
| 34 | +;view/options/as-is make gob! [size: 600x600] [title: "Fullscreen" flags: [fullscreen]] |
| 35 | + |
| 36 | +;- native widgets |
| 37 | +win: make gob! [size: 600x600 offset: :pos text: "Native widgets"] |
| 38 | +fld: make gob! [size: 200x29 offset: 200x200 widget: [field "foooo"] ] |
| 39 | +btn: make gob! [size: 200x29 offset: 200x250 widget: [button "hello" 255.0.0]] ;BUG: no color support! |
| 40 | +pr1: make gob! [size: 200x9 offset: 200x290 widget: [progress 20 ]] |
| 41 | +pr2: make gob! [size: 200x9 offset: 200x300 widget: [progress 50%]] ;BUG: should accept percent! |
| 42 | +txt: make gob! [size: 200x30 offset: 200x320 widget: [text "Some text"]] ;BUG: strange background when over an image |
| 43 | +red-image: make image! [300x300 255.0.0.100] |
| 44 | +img: make gob! [offset: 150x150 image: red-image] |
| 45 | +? img/image ;BUG: shows `none`, but it should be the image! |
| 46 | +sl1: make gob! [size: 300x29 offset: 150x450 widget: [slider 0.8]] |
| 47 | +sl2: make gob! [size: 29x300 offset: 450x150 widget: [slider 0.2]] |
| 48 | +are: make gob! [size: 300x99 offset: 150x30 widget: [area "bla bla bla"]] |
| 49 | +dt: make gob! [size: 200x29 offset: 200x350 widget: [date-time "list box"]] |
| 50 | + |
| 51 | +append win img |
| 52 | +append win fld |
| 53 | +append win btn |
| 54 | +append win [pr1 pr2] |
| 55 | +append win txt |
| 56 | +append win [sl1 sl2] |
| 57 | +append win are |
| 58 | +append win dt |
| 59 | + |
| 60 | +; group-box widget... |
| 61 | +gb: make gob! [size: 300x100 offset: 150x480 widget: [group-box "My group"]] |
| 62 | +;b3: make gob! [size: 200x29 offset: 10x10 widget: [button "Inside group"]] ;Should the offset be relative to the parent? |
| 63 | +;append gb b3 |
| 64 | + |
| 65 | +che: make gob! [size: 200x29 offset: 160x510 widget: [check "Ahoj světe"]] |
| 66 | +ra1: make gob! [size: 100x29 offset: 160x540 widget: [radio "Radio 1"]] |
| 67 | +ra2: make gob! [size: 100x29 offset: 260x540 widget: [radio "Radio 2"]] |
| 68 | +;BUG: there cannot be more than 1 radio buttons group! |
| 69 | + |
| 70 | +append win gb |
| 71 | +append win [che ra1 ra2] |
| 72 | +view/as-is win |
0 commit comments