|
Revision 213, 0.6 kB
(checked in by why, 11 months ago)
|
|
* shoes/ruby.c: adding a span inline, which does just like HTML, for applying adhoc styles.
* samples/: updating some samples with the new methods, still needs lots of work obviously.
|
| Line | |
|---|
| 1 | str, t = "", nil |
|---|
| 2 | Shoes.app :height => 500, :width => 450 do |
|---|
| 3 | background rgb(77, 77, 77) |
|---|
| 4 | stack :margin => 10 do |
|---|
| 5 | para span("TEXT EDITOR", :stroke => red, :fill => white), " * USE ALT-Q TO QUIT", :stroke => white |
|---|
| 6 | end |
|---|
| 7 | stack :margin => 10 do |
|---|
| 8 | t = para "", :font => "Monospace 12px", :stroke => white |
|---|
| 9 | t.cursor = -1 |
|---|
| 10 | end |
|---|
| 11 | keypress do |k| |
|---|
| 12 | case k |
|---|
| 13 | when String |
|---|
| 14 | str += k |
|---|
| 15 | when :backspace |
|---|
| 16 | str.slice!(-1) |
|---|
| 17 | when :tab |
|---|
| 18 | str += " " |
|---|
| 19 | when :alt_q |
|---|
| 20 | quit |
|---|
| 21 | when :alt_c |
|---|
| 22 | self.clipboard = str |
|---|
| 23 | when :alt_v |
|---|
| 24 | str += self.clipboard |
|---|
| 25 | end |
|---|
| 26 | t.replace str |
|---|
| 27 | end |
|---|
| 28 | end |
|---|