green_shoes 0.150.0 → 0.164.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -6
- data/VERSION +1 -1
- data/lib/shoes/app.rb +41 -0
- data/lib/shoes/basic.rb +46 -2
- data/lib/shoes/help.rb +1 -1
- data/lib/shoes/helper_methods.rb +2 -2
- data/lib/shoes/main.rb +4 -1
- data/lib/shoes/ruby.rb +1 -1
- data/lib/shoes/slot.rb +12 -2
- data/samples/sample46.rb +35 -0
- data/samples/sample47.rb +20 -0
- data/samples/sample48.rb +32 -0
- data/snapshots/sample46.png +0 -0
- data/snapshots/sample47.png +0 -0
- data/snapshots/sample48.png +0 -0
- data/static/man-ele-check.png +0 -0
- data/static/man-ele-radio.png +0 -0
- data/static/manual-en.txt +192 -170
- metadata +9 -3
data/README.md
CHANGED
@@ -8,7 +8,7 @@ This is **Green Shoes** written in Ruby. One of the colorful [Shoes](http://shoe
|
|
8
8
|
|
9
9
|
Fantastic logo icon was created by [Zachary Scott](https://github.com/zacharyscott). Thanks!
|
10
10
|
|
11
|
-
Now, there are
|
11
|
+
Now, there are 48 [samples](https://github.com/ashbb/green_shoes/tree/master/samples). Each has a [snapshot](https://github.com/ashbb/green_shoes/tree/master/snapshots).
|
12
12
|
|
13
13
|
|
14
14
|
Tiny Streaming Flash videos
|
@@ -47,8 +47,7 @@ Install and run
|
|
47
47
|
For Windows:
|
48
48
|
|
49
49
|
1. download and install [rubyinstaller-1.9.2-p136.exe](http://rubyinstaller.org/downloads/)
|
50
|
-
2. gem install
|
51
|
-
3. gem install green_shoes --no-ri --no-rdoc
|
50
|
+
2. gem install green_shoes --no-ri --no-rdoc
|
52
51
|
|
53
52
|
That's it!
|
54
53
|
|
@@ -66,7 +65,9 @@ You can see this snapshot:
|
|
66
65
|
|
67
66
|
![snapshot](https://github.com/ashbb/green_shoes/raw/master/snapshots/helloworld.png)
|
68
67
|
|
69
|
-
|
68
|
+
**NOTE: Use Ruby-GNOME2 0.90.7 or later.**
|
69
|
+
|
70
|
+
If you are using Ruby-GNOME2 0.90.6, have to do the following.
|
70
71
|
|
71
72
|
- make this file: %{your path of gtk2 gem}\vendor\local\etc\gtk-2.0\gtkrc
|
72
73
|
- store just one line: gtk-theme-name = "MS-Windows"
|
@@ -74,8 +75,8 @@ You can see this snapshot:
|
|
74
75
|
Then you can look at good-looking button on Green Shoes.
|
75
76
|
(left button of [this snapshot](http://www.rin-shun.com/tmp/ruby-gtk2-buttons.png))
|
76
77
|
|
77
|
-
Ruby-GNOME2 developer Kou (Kouhei Sutou)
|
78
|
-
|
78
|
+
Ruby-GNOME2 developer Kou (Kouhei Sutou) included gtkrc in the [0.90.7](http://ruby-gnome2.sourceforge.jp/?News_20110202_1) distribution.
|
79
|
+
Thanks, Kou. Awesome!
|
79
80
|
|
80
81
|
|
81
82
|
Mini Hackety Hack
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.164.0
|
data/lib/shoes/app.rb
CHANGED
@@ -18,6 +18,7 @@ class Shoes
|
|
18
18
|
@width_pre, @height_pre = @width, @height
|
19
19
|
@link_style, @linkhover_style = LINK_DEFAULT, LINKHOVER_DEFAULT
|
20
20
|
@context_angle = @pixbuf_rotate = 0
|
21
|
+
Shoes.APPS << self
|
21
22
|
end
|
22
23
|
|
23
24
|
attr_accessor :cslot, :cmask, :top_slot, :contents, :canvas, :app, :mccs, :mrcs, :mmcs,
|
@@ -177,6 +178,31 @@ class Shoes
|
|
177
178
|
Button.new args
|
178
179
|
end
|
179
180
|
|
181
|
+
def check args={}, &blk
|
182
|
+
args = basic_attributes args
|
183
|
+
cb = Gtk::CheckButton.new
|
184
|
+
cb.active = true if args[:checked]
|
185
|
+
cb.signal_connect "clicked", &blk if blk
|
186
|
+
@canvas.put cb, args[:left], args[:top]
|
187
|
+
cb.show_now
|
188
|
+
args[:real], args[:app] = cb, self
|
189
|
+
Check.new args
|
190
|
+
end
|
191
|
+
|
192
|
+
def radio *attrs, &blk
|
193
|
+
args = attrs.last.class == Hash ? attrs.pop : {}
|
194
|
+
group = attrs.first unless attrs.empty?
|
195
|
+
group = group ? (@radio_groups[group] ||= Gtk::RadioButton.new) : cslot.radio_group
|
196
|
+
args = basic_attributes args
|
197
|
+
rb = Gtk::RadioButton.new group
|
198
|
+
rb.active = true if args[:checked]
|
199
|
+
rb.signal_connect "clicked", &blk if blk
|
200
|
+
@canvas.put rb, args[:left], args[:top]
|
201
|
+
rb.show_now
|
202
|
+
args[:real], args[:app] = rb, self
|
203
|
+
Radio.new args
|
204
|
+
end
|
205
|
+
|
180
206
|
def edit_line args={}
|
181
207
|
args = basic_attributes args
|
182
208
|
args[:width] = 200 if args[:width].zero?
|
@@ -606,5 +632,20 @@ class Shoes
|
|
606
632
|
def scroll_top=(n)
|
607
633
|
@swin.vscrollbar.value = n
|
608
634
|
end
|
635
|
+
|
636
|
+
def clipboard
|
637
|
+
Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD).wait_for_text
|
638
|
+
end
|
639
|
+
|
640
|
+
def clipboard=(str)
|
641
|
+
Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD).text = str
|
642
|
+
end
|
643
|
+
|
644
|
+
def close
|
645
|
+
win.destroy
|
646
|
+
Gtk.main_quit
|
647
|
+
Shoes.APPS.delete app
|
648
|
+
exit if Shoes.APPS.empty?
|
649
|
+
end
|
609
650
|
end
|
610
651
|
end
|
data/lib/shoes/basic.rb
CHANGED
@@ -2,6 +2,7 @@ class Shoes
|
|
2
2
|
class Basic
|
3
3
|
include Mod
|
4
4
|
def initialize args
|
5
|
+
@initials = args
|
5
6
|
args.each do |k, v|
|
6
7
|
instance_variable_set "@#{k}", v
|
7
8
|
end
|
@@ -27,7 +28,7 @@ class Shoes
|
|
27
28
|
@hided, @shows, @hovered = false, true, false
|
28
29
|
end
|
29
30
|
|
30
|
-
attr_reader :parent, :click_proc, :release_proc, :hover_proc, :leave_proc, :args, :shows
|
31
|
+
attr_reader :parent, :click_proc, :release_proc, :hover_proc, :leave_proc, :args, :shows, :initials
|
31
32
|
attr_accessor :hided, :hovered
|
32
33
|
|
33
34
|
def move x, y
|
@@ -95,6 +96,33 @@ class Shoes
|
|
95
96
|
max
|
96
97
|
end
|
97
98
|
|
99
|
+
def fix_size
|
100
|
+
flag = false
|
101
|
+
set_margin
|
102
|
+
case self
|
103
|
+
when EditBox, Button
|
104
|
+
if 0 < @initials[:width] and @initials[:width] <= 1.0
|
105
|
+
@width = @parent.width * @initials[:width] - @margin_left - @margin_right
|
106
|
+
flag = true
|
107
|
+
end
|
108
|
+
if 0 < @initials[:height] and @initials[:height] <= 1.0
|
109
|
+
@height = @parent.height * @initials[:height] - @margin_top - @margin_bottom
|
110
|
+
flag = true
|
111
|
+
end
|
112
|
+
when EditLine, ListBox
|
113
|
+
if 0 < @initials[:width] and @initials[:width] <= 1.0
|
114
|
+
@width = @parent.width * @initials[:width] - @margin_left - @margin_right
|
115
|
+
@height = 26
|
116
|
+
flag = true
|
117
|
+
end
|
118
|
+
else
|
119
|
+
end
|
120
|
+
if flag
|
121
|
+
@real.set_size_request @width, @height
|
122
|
+
move @left, @top
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
98
126
|
def click &blk
|
99
127
|
@click_proc = blk
|
100
128
|
@app.mccs << self
|
@@ -126,7 +154,22 @@ class Shoes
|
|
126
154
|
end
|
127
155
|
|
128
156
|
class Image < Basic; end
|
129
|
-
class Button < Basic
|
157
|
+
class Button < Basic
|
158
|
+
def click &blk
|
159
|
+
real.signal_connect "clicked", &blk if blk
|
160
|
+
end
|
161
|
+
end
|
162
|
+
class ToggleButton < Button
|
163
|
+
def checked?
|
164
|
+
real.active?
|
165
|
+
end
|
166
|
+
|
167
|
+
def checked=(tof)
|
168
|
+
real.active = tof
|
169
|
+
end
|
170
|
+
end
|
171
|
+
class Check < ToggleButton; end
|
172
|
+
class Radio < ToggleButton; end
|
130
173
|
|
131
174
|
class Pattern < Basic
|
132
175
|
def move2 x, y
|
@@ -166,6 +209,7 @@ class Shoes
|
|
166
209
|
def text= s
|
167
210
|
clear if @real
|
168
211
|
@width = (@left + parent.width <= @app.width) ? parent.width : @app.width - @left
|
212
|
+
@width = initials[:width] unless initials[:width].zero?
|
169
213
|
@height = 20 if @height.zero?
|
170
214
|
m = self.class.to_s.downcase[7..-1]
|
171
215
|
args = [s, @args.merge({left: @left, top: @top, width: @width, height: @height, create_real: true, nocontrol: true})]
|
data/lib/shoes/help.rb
CHANGED
@@ -122,7 +122,7 @@ class Manual < Shoes
|
|
122
122
|
def mk_links txts
|
123
123
|
txts.map{|txt| txt.gsub(IMAGE_RE, '')}.
|
124
124
|
map{|txt| txt =~ /\[\[(\S+?)\]\]/m ? (t = $1.split('.'); link(ins t.last){visit "/manual/#{find_pnum t.first}"}) : txt}.
|
125
|
-
map{|txt| txt =~ /\[\[(\S+?) (.+?)\]\]/m ? (url = $1; link(ins $2){visit url}) : txt}
|
125
|
+
map{|txt| txt =~ /\[\[(\S+?) (.+?)\]\]/m ? (url = $1; link(ins $2){visit url =~ /^http/ ? url : "/manual/#{find_pnum url}"}) : txt}
|
126
126
|
end
|
127
127
|
|
128
128
|
def mk_paras str
|
data/lib/shoes/helper_methods.rb
CHANGED
@@ -15,8 +15,8 @@ class Shoes
|
|
15
15
|
|
16
16
|
module Mod2
|
17
17
|
def init_app_vars
|
18
|
-
@contents, @mccs, @mrcs, @mmcs, @mhcs, @mlcs, @shcs, @mcs, @order, @dics, @animates =
|
19
|
-
[], [], [], [], [], [], [], [], [], [], [],
|
18
|
+
@contents, @mccs, @mrcs, @mmcs, @mhcs, @mlcs, @shcs, @mcs, @order, @dics, @animates, @radio_groups =
|
19
|
+
[], [], [], [], [], [], [], [], [], [], [], {}
|
20
20
|
@cmask = nil
|
21
21
|
@mouse_button, @mouse_pos = 0, [0, 0]
|
22
22
|
@fill, @stroke = black, black
|
data/lib/shoes/main.rb
CHANGED
@@ -2,6 +2,9 @@ class Shoes
|
|
2
2
|
include Types
|
3
3
|
@apps = []
|
4
4
|
$urls = {}
|
5
|
+
APPS = []
|
6
|
+
|
7
|
+
def self.APPS; APPS end
|
5
8
|
|
6
9
|
def self.app args={}, &blk
|
7
10
|
args[:width] ||= 600
|
@@ -38,7 +41,7 @@ class Shoes
|
|
38
41
|
end
|
39
42
|
|
40
43
|
win.signal_connect "destroy" do
|
41
|
-
app.
|
44
|
+
app.close
|
42
45
|
end if @apps.size == 1
|
43
46
|
|
44
47
|
win.signal_connect "button_press_event" do |w, e|
|
data/lib/shoes/ruby.rb
CHANGED
data/lib/shoes/slot.rb
CHANGED
@@ -13,6 +13,7 @@ class Shoes
|
|
13
13
|
|
14
14
|
set_margin
|
15
15
|
|
16
|
+
@radio_group = Gtk::RadioButton.new
|
16
17
|
@masked = false
|
17
18
|
@parent = @app.cslot
|
18
19
|
@app.cslot = self
|
@@ -27,7 +28,7 @@ class Shoes
|
|
27
28
|
end
|
28
29
|
|
29
30
|
attr_accessor :contents, :masked
|
30
|
-
attr_reader :parent, :initials
|
31
|
+
attr_reader :parent, :initials, :radio_group
|
31
32
|
attr_writer :app
|
32
33
|
|
33
34
|
def app &blk
|
@@ -51,9 +52,18 @@ class Shoes
|
|
51
52
|
@height = Shoes.contents_alignment self
|
52
53
|
max = self
|
53
54
|
end
|
54
|
-
|
55
|
+
case @initials[:height]
|
56
|
+
when 0
|
57
|
+
when Float
|
58
|
+
max.height = @height = (parent.height * @initials[:height]).to_i
|
59
|
+
else
|
60
|
+
max.height = @height = @initials[:height]
|
61
|
+
end
|
62
|
+
contents.each &:fix_size
|
55
63
|
max
|
56
64
|
end
|
65
|
+
|
66
|
+
def fix_size; end
|
57
67
|
|
58
68
|
def clear &blk
|
59
69
|
@contents.each &:clear
|
data/samples/sample46.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require '../lib/green_shoes'
|
2
|
+
|
3
|
+
Shoes.app height: 250, width: 198 do
|
4
|
+
def do_calc
|
5
|
+
@number = @previous.send(@op, @number) if @op
|
6
|
+
@op = nil
|
7
|
+
end
|
8
|
+
@previous, @number, @op = 0, 0, nil
|
9
|
+
background rgb(235, 235, 210)
|
10
|
+
flow margin: 5 do
|
11
|
+
flow height: 240, width: 190, margin: [2, 5, 0, 0] do
|
12
|
+
background "#996".."#333", :curve => 5
|
13
|
+
number_field = para fg(strong(@number), white), margin: 8
|
14
|
+
flow width: 218 do
|
15
|
+
%w(7 8 9 / 4 5 6 * 1 2 3 - 0 Clr = +).each do |btn|
|
16
|
+
button btn, width: 46, height: 46 do
|
17
|
+
case btn
|
18
|
+
when /[0-9]/
|
19
|
+
@number = @number.to_i * 10 + btn.to_i
|
20
|
+
when 'Clr'
|
21
|
+
@previous, @number, @op = 0, 0, nil
|
22
|
+
when '='
|
23
|
+
do_calc
|
24
|
+
else
|
25
|
+
do_calc
|
26
|
+
@previous, @number = @number, nil
|
27
|
+
@op = btn
|
28
|
+
end
|
29
|
+
number_field.replace fg(strong(@number), white)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/samples/sample47.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require '../lib/green_shoes'
|
2
|
+
|
3
|
+
Shoes.app do
|
4
|
+
flow width: 0.3, height: 0.5 do
|
5
|
+
background lawngreen
|
6
|
+
edit_line width: 0.5, margin: 10, text: 'edit_line'
|
7
|
+
end
|
8
|
+
flow width: 0.4, height: 0.5 do
|
9
|
+
background goldenrod
|
10
|
+
edit_box width: 1.0, height: 1.0, margin: 20, text: "edit_box\n" * 3
|
11
|
+
end
|
12
|
+
flow width: 0.3, height: 0.5 do
|
13
|
+
background salmon
|
14
|
+
button 'Shoes', width: 1.0, height: 1.0, margin: 50
|
15
|
+
end
|
16
|
+
flow width: 1.0, height: 0.5 do
|
17
|
+
background plum
|
18
|
+
list_box items: %w[edit_box edit_line list_box button], width: 0.5 , margin: 20, choose: 'list_box'
|
19
|
+
end
|
20
|
+
end
|
data/samples/sample48.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Original code was written by Cecil Coupe
|
2
|
+
# He shared that in Shoes ML: http://librelist.com/browser//shoes/2011/2/17/radio-checked-method-broken/#1197b650c7dfdae2bc7c76bd9dad7e0e
|
3
|
+
|
4
|
+
require '../lib/green_shoes'
|
5
|
+
|
6
|
+
Shoes.app width: 300, height: 300 do
|
7
|
+
background gold..deeppink, angle: 45
|
8
|
+
@opt = 'none'
|
9
|
+
r1 = radio :grp do
|
10
|
+
@opt = "First"
|
11
|
+
end
|
12
|
+
para "Radio 1", width: 70
|
13
|
+
r2 = radio :grp do
|
14
|
+
@opt = "Second"
|
15
|
+
end
|
16
|
+
para "Radio 2", width: 70
|
17
|
+
r3 = radio :grp do
|
18
|
+
@opt = "Third"
|
19
|
+
end
|
20
|
+
para "Radio 3", width: 70
|
21
|
+
|
22
|
+
stack do
|
23
|
+
para "Default is #{@opt}"
|
24
|
+
# Set default for Radio Group :grp
|
25
|
+
r3.checked = true
|
26
|
+
button "Do My Bidding" do
|
27
|
+
@p.text += "Aye, Aye. Using #{@opt}\n"
|
28
|
+
end
|
29
|
+
para "Choices follow\n"
|
30
|
+
@p = para
|
31
|
+
end
|
32
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
data/static/man-ele-check.png
CHANGED
Binary file
|
data/static/man-ele-radio.png
CHANGED
Binary file
|
data/static/manual-en.txt
CHANGED
@@ -551,7 +551,7 @@ keep your permanent classes in requires.'''
|
|
551
551
|
|
552
552
|
= Shoes =
|
553
553
|
|
554
|
-
Shoes is all about drawing windows and the stuff inside those windows. Let's
|
554
|
+
Green Shoes is all about drawing windows and the stuff inside those windows. Let's
|
555
555
|
focus on the window itself, for now. The other sections [[Slots]] and
|
556
556
|
[[Elements]] cover everything that goes inside the window.
|
557
557
|
|
@@ -568,15 +568,17 @@ Shoes]], the beginner's leaflet PDF.
|
|
568
568
|
|
569
569
|
This section covers:
|
570
570
|
|
571
|
-
* [[Built-in Built-in methods]] - general methods available anywhere in a Shoes program.
|
572
|
-
* [[App The App window]] - methods found attached to every main Shoes window.
|
573
|
-
* [[Styles The Styles Master List]] - a complete list of every style in Shoes.
|
574
|
-
* [[Classes The Classes list]] - a chart showing what Shoes classes subclass what.
|
571
|
+
* [[Built-in Built-in methods]] - general methods available anywhere in a Green Shoes program.
|
572
|
+
* [[App The App window]] - methods found attached to every main Green Shoes window.
|
573
|
+
* [[Styles The Styles Master List]] - a complete list of every style in Green Shoes.
|
574
|
+
* [[Classes The Classes list]] - a chart showing what Green Shoes classes subclass what.
|
575
575
|
* [[Colors The Colors list]] - a chart of all built-in colors and the [[Built-in.rgb]] numbers for each.
|
576
576
|
|
577
577
|
If you find yourself paging around a lot and not finding something, give the
|
578
578
|
[[Search]] page a try. It's the quickest way to get around.
|
579
579
|
|
580
|
+
'''Note:''' Green Shoes doesn't support Search page so far.
|
581
|
+
|
580
582
|
After this general reference, there are two other more specific sections:
|
581
583
|
|
582
584
|
* [[Slots]] - covering [[Element.stack]] and [[Element.flow]], the two types of slots.
|
@@ -588,7 +590,7 @@ page (which lists methods you'll find on any slot or element.)
|
|
588
590
|
|
589
591
|
== Built-in Methods ==
|
590
592
|
|
591
|
-
These methods can be used anywhere throughout Shoes programs.
|
593
|
+
These methods can be used anywhere throughout Green Shoes programs.
|
592
594
|
|
593
595
|
All of these commands are unusual because you don't attach them with a dot.
|
594
596
|
'''Every other method in this manual must be attached to an object with a dot.'''
|
@@ -616,7 +618,7 @@ available for Arrays and Strings:
|
|
616
618
|
end
|
617
619
|
}}}
|
618
620
|
|
619
|
-
Most Shoes methods for drawing and making buttons and so on are attached to
|
621
|
+
Most Green Shoes methods for drawing and making buttons and so on are attached to
|
620
622
|
slots. See the section on [[Slots]] for more.
|
621
623
|
|
622
624
|
==== Built-in Constants ====
|
@@ -651,7 +653,7 @@ Pops up a window containing a short message.
|
|
651
653
|
|
652
654
|
Please use alerts sparingly, as they are incredibly annoying! If you are using
|
653
655
|
alerts to show messages to help you debug your program, try checking out the
|
654
|
-
|
656
|
+
standard Ruby method `puts` or `p` methods.
|
655
657
|
|
656
658
|
=== ask(message: a string) » a string ===
|
657
659
|
|
@@ -749,29 +751,6 @@ you'll get back a `true`. If not, you'll get back `false`.
|
|
749
751
|
end
|
750
752
|
}}}
|
751
753
|
|
752
|
-
=== debug(message: a string) » nil ===
|
753
|
-
|
754
|
-
Sends a debug message to the Shoes console. You can bring up the Shoes console
|
755
|
-
by pressing `Alt-/` on any Shoes window (or `⌘-/` on OS X.)
|
756
|
-
|
757
|
-
{{{
|
758
|
-
#!ruby
|
759
|
-
# Not yet available
|
760
|
-
debug("Running Shoes on " + RUBY_PLATFORM)
|
761
|
-
}}}
|
762
|
-
|
763
|
-
Also check out the [[Built-in.error]], [[Built-in.warn]] and [[Built-in.info]]
|
764
|
-
methods.
|
765
|
-
|
766
|
-
=== error(message: a string) » nil ===
|
767
|
-
|
768
|
-
Sends an error message to the Shoes console. This method should only be used
|
769
|
-
to log errors. Try the [[Built-in.debug]] method for logging messages to
|
770
|
-
yourself.
|
771
|
-
|
772
|
-
Oh, and, rather than a string, you may also hand exceptions directly to this
|
773
|
-
method and they'll be formatted appropriately.
|
774
|
-
|
775
754
|
=== exit() ===
|
776
755
|
|
777
756
|
Stops your program. Call this anytime you want to suddenly call it quits.
|
@@ -785,6 +764,8 @@ Loads a TrueType (or other type of font) from a file. While TrueType is
|
|
785
764
|
supported by all platforms, your platform may support other types of fonts.
|
786
765
|
Shoes uses each operating system's built-in font system to make this work.
|
787
766
|
|
767
|
+
'''Note:''' Green Shoes doesn't support font method so far.
|
768
|
+
|
788
769
|
Here's a rough idea of what fonts work on which platforms:
|
789
770
|
|
790
771
|
* Bitmap fonts (.bdf, .pcf, .snf) - Linux
|
@@ -805,23 +786,19 @@ available to you on this platform. You can check for a certain font by using
|
|
805
786
|
`include?`.
|
806
787
|
|
807
788
|
{{{
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
789
|
+
Shoes.app do
|
790
|
+
if Shoes::FONTS.include? "Coolvetica"
|
791
|
+
alert "Coolvetica is available on this system."
|
792
|
+
else
|
793
|
+
alert "You do not have the Coolvetica font."
|
794
|
+
end
|
795
|
+
end
|
814
796
|
}}}
|
815
797
|
|
816
798
|
If you have trouble with fonts showing up, make sure your app loads the font
|
817
799
|
before it is used. Especially on OS X, if fonts are used before they are
|
818
800
|
loaded, the font cache will tend to ignore loaded fonts.
|
819
801
|
|
820
|
-
=== gradient(color1, color2) » Shoes::Pattern ===
|
821
|
-
|
822
|
-
Builds a linear gradient from two colors. For each color, you may pass in a
|
823
|
-
Shoes::Color object or a string describing the color.
|
824
|
-
|
825
802
|
=== gray(the numbers: darkness, alpha) » Shoes::Color ===
|
826
803
|
|
827
804
|
Create a grayscale color from a level of darkness and, optionally, an alpha
|
@@ -833,22 +810,8 @@ level.
|
|
833
810
|
white = gray(1.0)
|
834
811
|
}}}
|
835
812
|
|
836
|
-
=== info(message: a string) » nil ===
|
837
|
-
|
838
|
-
Logs an informational message to the user in the Shoes console. So, where
|
839
|
-
debug messages are designed to help the program figure out what's happening,
|
840
|
-
`info` messages tell the user extra information about the program.
|
841
|
-
|
842
|
-
{{{
|
843
|
-
#!ruby
|
844
|
-
# Not yet available
|
845
|
-
info("You just ran the info example on Shoes #{Shoes::RELEASE_NAME}.")
|
846
|
-
}}}
|
847
|
-
|
848
|
-
For example, whenever a Shy file loads, Shoes prints an informational message
|
849
|
-
in the console describing the author of the Shy and its version.
|
850
813
|
|
851
|
-
=== rgb(
|
814
|
+
=== rgb(red, green, blue, alpha) » an array of decimal numbers ===
|
852
815
|
|
853
816
|
Create a color from red, green and blue components. An alpha level (indicating
|
854
817
|
transparency) can also be added, optionally.
|
@@ -857,8 +820,8 @@ When passing in a whole number, use values from 0 to 255.
|
|
857
820
|
|
858
821
|
{{{
|
859
822
|
Shoes.app do
|
860
|
-
blueviolet = rgb(138, 43, 226)
|
861
|
-
darkgreen = rgb(0, 100, 0)
|
823
|
+
blueviolet = rgb(138, 43, 226, 0.5)
|
824
|
+
darkgreen = rgb(0, 100, 0, 0.5)
|
862
825
|
oval 100, 100, 100, fill: [blueviolet, darkgreen].sample(1)
|
863
826
|
end
|
864
827
|
}}}
|
@@ -873,26 +836,14 @@ Or, use a decimal number from 0.0 to 1.0.
|
|
873
836
|
end
|
874
837
|
}}}
|
875
838
|
|
876
|
-
This method may also be called as `Shoes.rgb`.
|
877
|
-
|
878
|
-
=== warn(message: a string) » nil ===
|
879
|
-
|
880
|
-
Logs a warning for the user. A warning is not a catastrophic error (see
|
881
|
-
[[Built-in.error]] for that.) It is just a notice that the program will be
|
882
|
-
changing in the future or that certain parts of the program aren't reliable
|
883
|
-
yet.
|
884
|
-
|
885
|
-
To view warnings and errors, open the Shoes console with `Alt-/` (or `⌘-/` on
|
886
|
-
OS X.)
|
887
|
-
|
888
839
|
== The App Object ==
|
889
840
|
|
890
841
|
An App is a single window running code at a URL. When you switch URLs, a new
|
891
|
-
App object is created and filled up with stacks, flows and other Shoes
|
842
|
+
App object is created and filled up with stacks, flows and other Green Shoes
|
892
843
|
elements.
|
893
844
|
|
894
845
|
The App is the window itself. Which may be closed or cleared and filled with
|
895
|
-
new elements. !{:margin_left => 100}
|
846
|
+
new elements. !{:margin_left => 100}../snapshots/sample46.png!
|
896
847
|
|
897
848
|
The App itself, in slot/box terminology, is a flow. See the ''Slots'' section
|
898
849
|
for more, but this just means that any elements placed directly at the
|
@@ -900,24 +851,22 @@ top-level will flow.
|
|
900
851
|
|
901
852
|
=== Shoes.app(styles) { ... } » Shoes::App ===
|
902
853
|
|
903
|
-
Starts up a Shoes app window. This is the starting place for making a
|
904
|
-
program. Inside the block, you fill the window with various Shoes
|
905
|
-
(buttons, artwork, etc.) and, outside the block, you use the `styles` to
|
906
|
-
describe how big the window is. Perhaps also the name of the app
|
907
|
-
resizable.
|
854
|
+
Starts up a Green Shoes app window. This is the starting place for making a Green
|
855
|
+
Shoes program. Inside the block, you fill the window with various Green Shoes
|
856
|
+
elements (buttons, artwork, etc.) and, outside the block, you use the `styles` to
|
857
|
+
describe how big the window is. Perhaps also the name of the app.
|
908
858
|
|
909
859
|
{{{
|
910
860
|
#!ruby
|
911
|
-
Shoes.app
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
}
|
861
|
+
Shoes.app title: "White Circle", width: 200, height: 200 do
|
862
|
+
background black
|
863
|
+
fill white
|
864
|
+
oval top: 20, left: 20, radius: 160
|
865
|
+
end
|
917
866
|
}}}
|
918
867
|
|
919
|
-
In the case above, a small window is built. 200 pixels by 200 pixels.
|
920
|
-
|
868
|
+
In the case above, a small window is built. 200 pixels by 200 pixels.
|
869
|
+
And, inside the window, two elements: a black background and a
|
921
870
|
white circle.
|
922
871
|
|
923
872
|
Once an app is created, it is added to the [[App.Shoes.APPS]] list. If you
|
@@ -926,9 +875,16 @@ want an app to spawn more windows, see the [[Element.window]] method and the
|
|
926
875
|
|
927
876
|
=== Shoes.APPS() » An array of Shoes::App objects ===
|
928
877
|
|
929
|
-
Builds a complete list of all the Shoes apps that are open right now. Once an
|
878
|
+
Builds a complete list of all the Green Shoes apps that are open right now. Once an
|
930
879
|
app is closed, it is removed from the list. Yes, you can run many apps at once
|
931
|
-
in Shoes. It's completely encouraged.
|
880
|
+
in Green Shoes. It's completely encouraged.
|
881
|
+
|
882
|
+
{{{
|
883
|
+
Shoes.app do
|
884
|
+
button('Open a new app'){Shoes.app{}}
|
885
|
+
button('Print Shoes.APPS'){p Shoes.APPS}
|
886
|
+
end
|
887
|
+
}}}
|
932
888
|
|
933
889
|
=== clipboard() » a string ===
|
934
890
|
|
@@ -945,6 +901,21 @@ Stores `a string` of text in the system clipboard.
|
|
945
901
|
Closes the app window. If multiple windows are open and you want to close the
|
946
902
|
entire application, use the built-in method `exit`.
|
947
903
|
|
904
|
+
{{{
|
905
|
+
Shoes.app do
|
906
|
+
para 'hello'
|
907
|
+
button 'spawn' do
|
908
|
+
Shoes.app do
|
909
|
+
para 'hello'
|
910
|
+
button('close: close this window only'){close}
|
911
|
+
button('exit: quit Green Shoes'){exit}
|
912
|
+
end
|
913
|
+
end
|
914
|
+
button('close: close this window only'){close}
|
915
|
+
button('exit: quit Green Shoes'){exit}
|
916
|
+
end
|
917
|
+
}}}
|
918
|
+
|
948
919
|
=== download(url: a string, styles) ===
|
949
920
|
|
950
921
|
Starts a download thread (much like XMLHttpRequest, if you're familiar with
|
@@ -956,48 +927,40 @@ events. You can send the download to a file or just get back a string (in the
|
|
956
927
|
If you attach a block to a download, it'll get called as the `finish` event.
|
957
928
|
|
958
929
|
{{{
|
959
|
-
#!ruby
|
960
|
-
# Not yet available
|
961
930
|
Shoes.app do
|
962
931
|
stack do
|
963
|
-
title "Searching Google", :
|
932
|
+
title "Searching Google", size: 16
|
964
933
|
@status = para "One moment..."
|
965
934
|
|
966
935
|
# Search Google for 'shoes' and print the HTTP headers
|
967
936
|
download "http://www.google.com/search?q=shoes" do |goog|
|
968
|
-
@status.text = "Headers:
|
937
|
+
@status.text = "Headers: #{goog.meta}"
|
969
938
|
end
|
970
939
|
end
|
971
940
|
end
|
972
941
|
}}}
|
973
942
|
|
974
|
-
|
975
|
-
`goog.response.body`. This example is truly the simplest form of `download`:
|
943
|
+
This example is truly the simplest form of `download`:
|
976
944
|
pulling some web data down into memory and handling it once it's done.
|
977
945
|
|
978
946
|
Another simple use of `download` is to save some web data to a file, using the
|
979
947
|
`:save` style.
|
980
948
|
|
981
949
|
{{{
|
982
|
-
#!ruby
|
983
|
-
# Not yet available
|
984
950
|
Shoes.app do
|
985
951
|
stack do
|
986
|
-
title "Downloading Google image", :
|
952
|
+
title "Downloading Google image", size: 16
|
987
953
|
@status = para "One moment..."
|
988
954
|
|
989
955
|
download "http://www.google.com/logos/nasa50th.gif",
|
990
956
|
:save => "nasa50th.gif" do
|
991
|
-
|
957
|
+
@status.text = "Okay, is downloaded."
|
958
|
+
image "nasa50th.gif", top: 100
|
992
959
|
end
|
993
960
|
end
|
994
961
|
end
|
995
962
|
}}}
|
996
963
|
|
997
|
-
In this case, you can still get the headers for the downloaded file, but
|
998
|
-
`response.body` will be `nil`, since the data wasn't saved to memory. You will
|
999
|
-
need to open the file to get the downloaded goods.
|
1000
|
-
|
1001
964
|
If you need to send certain headers or actions to the web server, you can use
|
1002
965
|
the `:method`, `:headers` and `:body` styles to customize the HTTP request.
|
1003
966
|
(And, if you need to go beyond these, you can always break out Ruby's OpenURI
|
@@ -1008,7 +971,7 @@ class.)
|
|
1008
971
|
# Not yet available
|
1009
972
|
Shoes.app do
|
1010
973
|
stack do
|
1011
|
-
title "GET Google", :
|
974
|
+
title "GET Google", size: 16
|
1012
975
|
@status = para "One moment..."
|
1013
976
|
|
1014
977
|
download "http://www.google.com/search?q=shoes",
|
@@ -1022,10 +985,14 @@ class.)
|
|
1022
985
|
As you can see from the above example, Shoes makes use of the "GET" method to
|
1023
986
|
query google's search engine.
|
1024
987
|
|
988
|
+
'''Note:''' Green Shoes doesn't support the `:method`, `:headers` and `:body` styles.
|
989
|
+
|
1025
990
|
=== location() » a string ===
|
1026
991
|
|
1027
992
|
Gets a string containing the URL of the current app.
|
1028
993
|
|
994
|
+
'''Note:''' Green Shoes doesn't support location method so far.
|
995
|
+
|
1029
996
|
=== mouse() » an array of numbers: button, left, top ===
|
1030
997
|
|
1031
998
|
Identifies the mouse cursor's location, along with which button is being
|
@@ -1048,68 +1015,75 @@ Gets the app which launched this app. In most cases, this will be `nil`. But
|
|
1048
1015
|
if this app was launched using the [[Element.window]] method, the owner will be
|
1049
1016
|
the app which called `window`.
|
1050
1017
|
|
1018
|
+
'''Note:''' Green Shoes doesn't support owner method so far.
|
1019
|
+
|
1051
1020
|
=== started?() » true or false ===
|
1052
1021
|
|
1053
1022
|
Has the window been fully constructed and displayed? This is useful for
|
1054
1023
|
threaded code which may try to use the window before it is completely built.
|
1055
1024
|
(Also see the `start` event which fires once the window is open.)
|
1056
1025
|
|
1026
|
+
'''Note:''' Green Shoes doesn't support started? method so far.
|
1027
|
+
|
1057
1028
|
=== visit(url: a string) ===
|
1058
1029
|
|
1059
1030
|
Changes the location, in order to view a different Shoes URL.
|
1060
1031
|
|
1061
|
-
Absolute URLs (such as http://google.com) are okay, but Shoes will be expecting
|
1062
|
-
a Shoes application to be at that address. (So, google.com won't work, as it's
|
1032
|
+
Absolute URLs (such as http://google.com) are okay, but Green Shoes will be expecting
|
1033
|
+
a Green Shoes application to be at that address. (So, google.com won't work, as it's
|
1063
1034
|
an HTML app.)
|
1064
1035
|
|
1065
1036
|
== The Styles Master List ==
|
1066
1037
|
|
1067
|
-
You want to mess with the look of things? Well, throughout Shoes, styles are
|
1038
|
+
You want to mess with the look of things? Well, throughout Green Shoes, styles are
|
1068
1039
|
used to change the way elements appear. In some cases, you can even style an
|
1069
|
-
entire class of elements. (Like giving all
|
1040
|
+
entire class of elements. (Like giving all links without an underline.)
|
1070
1041
|
|
1071
1042
|
Styles are easy to spot. They usually show up when the element is created.
|
1072
1043
|
|
1073
1044
|
{{{
|
1074
|
-
Shoes.app :
|
1075
|
-
para
|
1045
|
+
Shoes.app title: "A Styling Sample" do
|
1046
|
+
para 'Green Shoes', align: 'center', size: 50
|
1076
1047
|
end
|
1077
1048
|
}}}
|
1078
1049
|
|
1079
1050
|
Here we've got a `:title` style on the app. And on the paragraph inside the
|
1080
|
-
app, a
|
1051
|
+
app, a center `:align` style and 50 font `:size` style.
|
1081
1052
|
|
1082
1053
|
The style hash can also be changed by using the [[Common.style]] method,
|
1083
1054
|
available on every element and slot.
|
1084
1055
|
|
1056
|
+
'''Note:''' Green Shoes can change style hash on Shape element only so far.
|
1057
|
+
|
1085
1058
|
{{{
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1059
|
+
Shoes.app title: "A Styling Sample" do
|
1060
|
+
choose = lambda{[red, blue, green, yellow].sample}
|
1061
|
+
s = star 100, 50, 30, 200, 180, strokewidth: 5
|
1062
|
+
button('change colors'){s.style stroke: choose.call, fill: choose.call}
|
1090
1063
|
end
|
1091
1064
|
}}}
|
1092
1065
|
|
1093
1066
|
Most styles can also be set by calling them as methods. (I'd use the manual
|
1094
1067
|
search to find the method.)
|
1095
1068
|
|
1069
|
+
'''Note:''' Green Shoes doesn't support them as methods.
|
1070
|
+
|
1096
1071
|
{{{
|
1097
1072
|
# Not yet available
|
1098
|
-
Shoes.app :
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1073
|
+
Shoes.app title: "A Styling Sample" do
|
1074
|
+
choose = lambda{[red, blue, green, yellow].sample}
|
1075
|
+
s = star 100, 50, 30, 200, 180, strokewidth: 5
|
1076
|
+
button('change colors'){s.stroke = choose.call; s.fill = choose.call}
|
1102
1077
|
end
|
1103
1078
|
}}}
|
1104
1079
|
|
1105
1080
|
Rather than making you plow through the whole manual to figure out what styles
|
1106
|
-
go where, this helpful page speeds through every style in Shoes and suggests
|
1081
|
+
go where, this helpful page speeds through every style in Green Shoes and suggests
|
1107
1082
|
where that style is used.
|
1108
1083
|
|
1109
1084
|
=== :align » a string ===
|
1110
1085
|
|
1111
|
-
For: ''banner, caption,
|
1112
|
-
strong, sub, sup, subtitle, tagline, title''
|
1086
|
+
For: ''banner, caption, inscription, para, subtitle, tagline, title''
|
1113
1087
|
|
1114
1088
|
The alignment of the text. It is either:
|
1115
1089
|
|
@@ -1119,7 +1093,7 @@ The alignment of the text. It is either:
|
|
1119
1093
|
|
1120
1094
|
=== :angle » a number ===
|
1121
1095
|
|
1122
|
-
For: ''background, border,
|
1096
|
+
For: ''background, border, line, oval, rect, shape, star''.
|
1123
1097
|
|
1124
1098
|
The angle at which to apply a gradient. Normally, gradient colors range from
|
1125
1099
|
top to bottom. If the `:angle` is set to 90, the gradient will rotate 90
|
@@ -1138,6 +1112,8 @@ If a slot is attached to an element that moves, the slot will move with it. If
|
|
1138
1112
|
the attachment is reset to `nil`, the slot will flow in with the other objects
|
1139
1113
|
that surround, as normal.
|
1140
1114
|
|
1115
|
+
'''Note:''' Green Shoes doesn't support `:attach` style.
|
1116
|
+
|
1141
1117
|
=== :autoplay » true or false ===
|
1142
1118
|
|
1143
1119
|
For: ''video''.
|
@@ -1145,6 +1121,8 @@ For: ''video''.
|
|
1145
1121
|
Should this video begin playing after it appears? If set to `true`, the video
|
1146
1122
|
will start without asking the user.
|
1147
1123
|
|
1124
|
+
'''Note:''' Green Shoes doesn't support ''video''.
|
1125
|
+
|
1148
1126
|
=== :bottom » a number ===
|
1149
1127
|
|
1150
1128
|
For: ''all slots and elements''.
|
@@ -1153,6 +1131,8 @@ Sets the pixel coordinate of an element's lower edge. The edge is placed
|
|
1153
1131
|
relative to its container's lower edge. So, `:bottom => 0` will align the
|
1154
1132
|
element so that its bottom edge and the bottom edge of its slot touch.
|
1155
1133
|
|
1134
|
+
'''Note:''' Green Shoes doesn't support `:bottom` style.
|
1135
|
+
|
1156
1136
|
=== :cap » :curve or :rect or :project ===
|
1157
1137
|
|
1158
1138
|
For: ''arc, arrow, border, flow, image, mask, rect, star, shape, stack''.
|
@@ -1160,6 +1140,8 @@ For: ''arc, arrow, border, flow, image, mask, rect, star, shape, stack''.
|
|
1160
1140
|
Sets the shape of the line endpoint, whether curved or square. See the
|
1161
1141
|
[[Art.cap]] method for more explanation.
|
1162
1142
|
|
1143
|
+
'''Note:''' Green Shoes doesn't support `:cap` style.
|
1144
|
+
|
1163
1145
|
=== :center » true or false ===
|
1164
1146
|
|
1165
1147
|
For: ''arc, image, oval, rect, shape''.
|
@@ -1168,6 +1150,8 @@ Indicates whether the `:top` and `:left` coordinates refer to the center of the
|
|
1168
1150
|
shape or not. If set to `true`, this is similar to setting the
|
1169
1151
|
[[Art.transform]] method to `:center`.
|
1170
1152
|
|
1153
|
+
'''Note:''' Green Shoes doesn't support `:center` style.
|
1154
|
+
|
1171
1155
|
=== :change » a proc ===
|
1172
1156
|
|
1173
1157
|
For: ''edit_box, edit_line, list_box''.
|
@@ -1175,6 +1159,8 @@ For: ''edit_box, edit_line, list_box''.
|
|
1175
1159
|
The `change` event handler is stored in this style. See the [[EditBox.change]]
|
1176
1160
|
method for the edit_box, as an example.
|
1177
1161
|
|
1162
|
+
'''Note:''' Green Shoes doesn't support `:change` style.
|
1163
|
+
|
1178
1164
|
=== :checked » true or false ===
|
1179
1165
|
|
1180
1166
|
For: ''check, radio''.
|
@@ -1182,6 +1168,8 @@ For: ''check, radio''.
|
|
1182
1168
|
Is this checkbox or radio button checked? If set to `true`, the box is
|
1183
1169
|
checked. Also see the [[Check.checked=]] method.
|
1184
1170
|
|
1171
|
+
'''Note:''' Green Shoes doesn't support ''check'' and ''radio''.
|
1172
|
+
|
1185
1173
|
=== :choose » a string ===
|
1186
1174
|
|
1187
1175
|
For: ''list_box''.
|
@@ -1198,6 +1186,8 @@ tagline, title''.
|
|
1198
1186
|
The `click` event handler is stored in this style. See the [[Events.click]]
|
1199
1187
|
method for a description.
|
1200
1188
|
|
1189
|
+
'''Note:''' Green Shoes doesn't support `:click` style.
|
1190
|
+
|
1201
1191
|
=== :curve » a number ===
|
1202
1192
|
|
1203
1193
|
For: ''background, border, rect''.
|
@@ -1216,6 +1206,8 @@ negative number displaces to the left. Displacing an object doesn't effect the
|
|
1216
1206
|
actual layout of the page. Before using this style, be sure to read the
|
1217
1207
|
[[Position.displace]] docs, since its behavior can be a bit surprising.
|
1218
1208
|
|
1209
|
+
'''Note:''' Green Shoes doesn't support `:displace_left` style.
|
1210
|
+
|
1219
1211
|
=== :displace_top » a number ===
|
1220
1212
|
|
1221
1213
|
For: ''all slots and elements''.
|
@@ -1226,6 +1218,8 @@ it up. Displacing doesn't effect the actual layout of the page or the object's
|
|
1226
1218
|
true coordinates. Read the [[Position.displace]] docs, since its behavior can
|
1227
1219
|
be a bit surprising.
|
1228
1220
|
|
1221
|
+
'''Note:''' Green Shoes doesn't support `:displace_top` style.
|
1222
|
+
|
1229
1223
|
=== :emphasis » a string ===
|
1230
1224
|
|
1231
1225
|
For: ''banner, caption, code, del, em, ins, inscription, link, para, span,
|
@@ -1239,6 +1233,8 @@ This style recognizes three possible settings:
|
|
1239
1233
|
* "oblique" - the font is slanted, but in a roman style.
|
1240
1234
|
* "italic" - the font is slanted in an italic style.
|
1241
1235
|
|
1236
|
+
'''Note:''' Green Shoes doesn't support `:emphasis` style.
|
1237
|
+
|
1242
1238
|
=== :family » a string ===
|
1243
1239
|
|
1244
1240
|
For: ''banner, caption, code, del, em, ins, inscription, link, para, span,
|
@@ -1247,20 +1243,18 @@ strong, sub, sup, subtitle, tagline, title''.
|
|
1247
1243
|
Styles the text with a given font family. The string should contain the family
|
1248
1244
|
name or a comma-separated list of families.
|
1249
1245
|
|
1250
|
-
|
1246
|
+
'''Note:''' Green Shoes doesn't support `:family` style.
|
1251
1247
|
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1248
|
+
=== :fill » a hex code, a rgb array or a range of either ===
|
1249
|
+
|
1250
|
+
For: ''background, border, line, oval, rect, shape, star''.
|
1255
1251
|
|
1256
1252
|
The color of the background pen. For shapes, this is the fill color, the paint
|
1257
|
-
inside the shape.
|
1258
|
-
if marked with a highlighter pen.)
|
1253
|
+
inside the shape.
|
1259
1254
|
|
1260
1255
|
=== :font » a string ===
|
1261
1256
|
|
1262
|
-
For: ''banner, caption,
|
1263
|
-
strong, sub, sup, subtitle, tagline, title''.
|
1257
|
+
For: ''banner, caption, inscription, para, subtitle, tagline, title''.
|
1264
1258
|
|
1265
1259
|
Styles the text with a font description. The string is pretty flexible, but
|
1266
1260
|
can take the form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is
|
@@ -1284,6 +1278,8 @@ at a time.
|
|
1284
1278
|
By giving this style a string, the radio button will be grouped with other
|
1285
1279
|
radio buttons that have the same group name.
|
1286
1280
|
|
1281
|
+
'''Note:''' Green Shoes doesn't support ''radio''.
|
1282
|
+
|
1287
1283
|
=== :height » a number ===
|
1288
1284
|
|
1289
1285
|
For: ''all slots and elements''.
|
@@ -1299,6 +1295,8 @@ For: ''all slots and elements''.
|
|
1299
1295
|
Hides or shows this object. Any object with `:hidden => true` are not
|
1300
1296
|
displayed on the screen. Neither are its children.
|
1301
1297
|
|
1298
|
+
'''Note:''' Green Shoes doesn't support `:hidden` style.
|
1299
|
+
|
1302
1300
|
=== :inner » a number ===
|
1303
1301
|
|
1304
1302
|
For: ''star''.
|
@@ -1320,6 +1318,8 @@ strong, sub, sup, subtitle, tagline, title''
|
|
1320
1318
|
|
1321
1319
|
Evenly spaces the text horizontally.
|
1322
1320
|
|
1321
|
+
'''Note:''' Green Shoes doesn't support `:justify` style.
|
1322
|
+
|
1323
1323
|
=== :kerning » a number ===
|
1324
1324
|
|
1325
1325
|
For: ''banner, caption, code, del, em, ins, inscription, link, para, span,
|
@@ -1327,18 +1327,22 @@ strong, sub, sup, subtitle, tagline, title''.
|
|
1327
1327
|
|
1328
1328
|
Adds to the natural spacing between letters, in pixels.
|
1329
1329
|
|
1330
|
+
'''Note:''' Green Shoes doesn't support `:kerning` style.
|
1331
|
+
|
1330
1332
|
=== :leading » a number ===
|
1331
1333
|
|
1332
1334
|
For: ''banner, caption, inscription, para, subtitle, tagline, title''.
|
1333
1335
|
|
1334
1336
|
Sets the spacing between lines in a text block. Defaults to 4 pixels.
|
1335
1337
|
|
1338
|
+
'''Note:''' Green Shoes doesn't support `:leading` style.
|
1339
|
+
|
1336
1340
|
=== :left » a number ===
|
1337
1341
|
|
1338
1342
|
For: ''all slots and elements''.
|
1339
1343
|
|
1340
|
-
Sets the left coordinate of this object to a specific pixel. Setting
|
1341
|
-
|
1344
|
+
Sets the left coordinate of this object to a specific pixel. Setting `left: 10`
|
1345
|
+
places the object's left edge ten pixels away from the left edge of the
|
1342
1346
|
slot containing it. If this style is left unset (or set to `nil`,) the object
|
1343
1347
|
will flow in with the other objects surrounding it.
|
1344
1348
|
|
@@ -1349,7 +1353,7 @@ For: ''all slots and elements''.
|
|
1349
1353
|
Margins space an element out from its surroundings. Each element has a left,
|
1350
1354
|
top, right, and bottom margin. If the `:margin` style is set to a single
|
1351
1355
|
number, the spacing around the element uniformly matches that number. In other
|
1352
|
-
words, if
|
1356
|
+
words, if `margin: 8` is set, all the margins around the element are set to
|
1353
1357
|
eight pixels in length.
|
1354
1358
|
|
1355
1359
|
This style can also be given an array of four numbers in the form `[left, top,
|
@@ -1389,12 +1393,12 @@ Sets the outer radius (half of the ''total'' width) of the star, in pixels.
|
|
1389
1393
|
|
1390
1394
|
For: ''star''.
|
1391
1395
|
|
1392
|
-
How many points does this star have? A style of
|
1396
|
+
How many points does this star have? A style of `points: 5` creates a
|
1393
1397
|
five-pointed star.
|
1394
1398
|
|
1395
1399
|
=== :radius » a number ===
|
1396
1400
|
|
1397
|
-
For: ''
|
1401
|
+
For: ''oval''.
|
1398
1402
|
|
1399
1403
|
Sets the radius (half of the diameter or total width) for each of these
|
1400
1404
|
elements. Setting this is equivalent to setting both `:width` and `:height` to
|
@@ -1410,6 +1414,8 @@ element so that its own right edge and the right edge of its slot touch.
|
|
1410
1414
|
Whereas `:right => 20` will position the right edge of the element off to the
|
1411
1415
|
left of its slot's right edge by twenty pixels.
|
1412
1416
|
|
1417
|
+
'''Note:''' Green Shoes doesn't support `:right` style.
|
1418
|
+
|
1413
1419
|
=== :rise » a number ===
|
1414
1420
|
|
1415
1421
|
For: ''banner, caption, code, del, em, ins, inscription, link, para, span,
|
@@ -1419,6 +1425,8 @@ Lifts or plunges the font baseline for some text. For example, a
|
|
1419
1425
|
[[Element.sup]] has a `:rise` of 10 pixels. Conversely, the [[Element.sub]]
|
1420
1426
|
element has a `:rise` of -10 pixels.
|
1421
1427
|
|
1428
|
+
'''Note:''' Green Shoes doesn't support `:rise` style.
|
1429
|
+
|
1422
1430
|
=== :scroll » true or false ===
|
1423
1431
|
|
1424
1432
|
For: ''flow, stack''.
|
@@ -1429,6 +1437,8 @@ scrollbar will appear and disappear as needed. It will also appear inside the
|
|
1429
1437
|
width of the slot, meaning the slot's width will never change, regardless of
|
1430
1438
|
whether there is a scrollbar or not.
|
1431
1439
|
|
1440
|
+
'''Note:''' Green Shoes doesn't support `:scroll` style.
|
1441
|
+
|
1432
1442
|
=== :secret » true or false ===
|
1433
1443
|
|
1434
1444
|
For: ''ask, edit_line''.
|
@@ -1437,12 +1447,13 @@ Used for password fields, this setting keeps any characters typed in from
|
|
1437
1447
|
becoming visible on the screen. Instead, a replacement character (such as an
|
1438
1448
|
asterisk) is show for each letter typed.
|
1439
1449
|
|
1450
|
+
'''Note:''' Green Shoes doesn't support `:secret` style.
|
1451
|
+
|
1440
1452
|
=== :size » a number ===
|
1441
1453
|
|
1442
|
-
For: ''banner, caption,
|
1443
|
-
strong, sub, sup, subtitle, tagline, title''.
|
1454
|
+
For: ''banner, caption, inscription, para, subtitle, tagline, title''.
|
1444
1455
|
|
1445
|
-
Sets the pixel size for the font used inside this text block
|
1456
|
+
Sets the pixel size for the font used inside this text block.
|
1446
1457
|
|
1447
1458
|
Font size may also be augmented, through use of the following strings:
|
1448
1459
|
|
@@ -1454,6 +1465,8 @@ Font size may also be augmented, through use of the following strings:
|
|
1454
1465
|
* "x-large" - 143% of present size.
|
1455
1466
|
* "xx-large" - 173% of present size.
|
1456
1467
|
|
1468
|
+
'''Note:''' Green Shoes doesn't support as the above string style settings.
|
1469
|
+
|
1457
1470
|
=== :state » a string ===
|
1458
1471
|
|
1459
1472
|
For: ''button, check, edit_box, edit_line, list_box, radio''.
|
@@ -1467,6 +1480,8 @@ Here are the possible style settings:
|
|
1467
1480
|
* "readonly" - the control is active but cannot be edited.
|
1468
1481
|
* "disabled" - the control is not active (grayed out) and cannot be edited.
|
1469
1482
|
|
1483
|
+
'''Note:''' Green Shoes doesn't support `:state` style.
|
1484
|
+
|
1470
1485
|
=== :stretch » a string ===
|
1471
1486
|
|
1472
1487
|
For: ''banner, caption, code, del, em, ins, inscription, link, para, span,
|
@@ -1480,6 +1495,8 @@ Possible settings are:
|
|
1480
1495
|
* "normal" - the standard width of letters.
|
1481
1496
|
* "expanded" - a larger width of letters.
|
1482
1497
|
|
1498
|
+
'''Note:''' Green Shoes doesn't support `:stretch` style.
|
1499
|
+
|
1483
1500
|
=== :strikecolor » a Shoes::Color ===
|
1484
1501
|
|
1485
1502
|
For: ''banner, caption, code, del, em, ins, inscription, link, para, span,
|
@@ -1487,6 +1504,8 @@ strong, sub, sup, subtitle, tagline, title''.
|
|
1487
1504
|
|
1488
1505
|
The color used to paint any lines stricken through this text.
|
1489
1506
|
|
1507
|
+
'''Note:''' Green Shoes doesn't support `:strikecolor` style.
|
1508
|
+
|
1490
1509
|
=== :strikethrough » a string ===
|
1491
1510
|
|
1492
1511
|
For: ''banner, caption, code, del, em, ins, inscription, link, para, span,
|
@@ -1497,39 +1516,37 @@ Is this text stricken through? Two options here:
|
|
1497
1516
|
* "none" - no strikethrough
|
1498
1517
|
* "single" - a single-line strikethrough.
|
1499
1518
|
|
1500
|
-
|
1519
|
+
'''Note:''' Green Shoes doesn't support `:strikethrough` style.
|
1501
1520
|
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1521
|
+
=== :stroke » a hex code, a rgb array or a range of either ===
|
1522
|
+
|
1523
|
+
For: ''background, border, line, oval, rect, shape, star''.
|
1505
1524
|
|
1506
1525
|
The color of the foreground pen. In the case of shapes, this is the color the
|
1507
|
-
lines are drawn with.
|
1508
|
-
in this color.
|
1526
|
+
lines are drawn with.
|
1509
1527
|
|
1510
1528
|
=== :strokewidth » a number ===
|
1511
1529
|
|
1512
|
-
For: ''
|
1530
|
+
For: ''background, border, line, oval, rect, shape, star''.
|
1513
1531
|
|
1514
1532
|
The thickness of the stroke, in pixels, of the line defining each of these
|
1515
1533
|
shapes. For example, the number two would set the strokewidth to 2 pixels.
|
1516
1534
|
|
1517
1535
|
=== :text » a string ===
|
1518
1536
|
|
1519
|
-
For: ''
|
1537
|
+
For: ''edit_box, edit_line''.
|
1520
1538
|
|
1521
|
-
Sets the message displayed on
|
1522
|
-
or edit_line.
|
1539
|
+
Sets the message displayed on the contents of edit_box or edit_line.
|
1523
1540
|
|
1524
1541
|
=== :top » a number ===
|
1525
1542
|
|
1526
1543
|
For: ''all slots and elements''.
|
1527
1544
|
|
1528
|
-
Sets the top coordinate for an object, relative to
|
1529
|
-
object is set with
|
1530
|
-
placed 40 pixels beneath the top edge of the slot
|
1545
|
+
Sets the top coordinate for an object, relative to the top slot (window). If an
|
1546
|
+
object is set with `top: 40`, this means the object's top edge will be
|
1547
|
+
placed 40 pixels beneath the top edge of the top slot (window). If no
|
1531
1548
|
`:top` style is given, the object is automatically placed in the natural flow
|
1532
|
-
of
|
1549
|
+
of the slot it contains.
|
1533
1550
|
|
1534
1551
|
=== :undercolor » a Shoes::Color ===
|
1535
1552
|
|
@@ -1538,6 +1555,8 @@ strong, sub, sup, subtitle, tagline, title''.
|
|
1538
1555
|
|
1539
1556
|
The color used to underline text.
|
1540
1557
|
|
1558
|
+
'''Note:''' Green Shoes doesn't support `:undercolor` style.
|
1559
|
+
|
1541
1560
|
=== :underline » a string ===
|
1542
1561
|
|
1543
1562
|
For: ''banner, caption, code, del, em, ins, inscription, link, para, span,
|
@@ -1553,6 +1572,8 @@ The choices for this setting are:
|
|
1553
1572
|
* "low" - a lower underline, beneath the font baseline. (This is generally recommended only for single characters, particularly when showing keyboard accelerators.)
|
1554
1573
|
* "error" - a wavy underline, usually found indicating a misspelling.
|
1555
1574
|
|
1575
|
+
'''Note:''' Green Shoes doesn't support `:underline` style.
|
1576
|
+
|
1556
1577
|
=== :variant » a string ===
|
1557
1578
|
|
1558
1579
|
For: ''banner, caption, code, del, em, ins, inscription, link, para, span,
|
@@ -1563,6 +1584,8 @@ Vary the font for a group of text. Two choices:
|
|
1563
1584
|
* "normal" - standard font.
|
1564
1585
|
* "smallcaps" - font with the lower case characters replaced by smaller variants of the capital characters.
|
1565
1586
|
|
1587
|
+
'''Note:''' Green Shoes doesn't support `:variant` style.
|
1588
|
+
|
1566
1589
|
=== :weight » a string ===
|
1567
1590
|
|
1568
1591
|
For: ''banner, caption, code, del, em, ins, inscription, link, para, span,
|
@@ -1581,6 +1604,8 @@ following strings:
|
|
1581
1604
|
|
1582
1605
|
However, you may also pass in the numerical weight directly.
|
1583
1606
|
|
1607
|
+
'''Note:''' Green Shoes doesn't support `:weight` style.
|
1608
|
+
|
1584
1609
|
=== :width » a number ===
|
1585
1610
|
|
1586
1611
|
For: ''all slots and elements''.
|
@@ -1600,6 +1625,8 @@ How should the text wrap when it fills its width? Possible options are:
|
|
1600
1625
|
* "char" - Break lines between characters, thus breaking some words.
|
1601
1626
|
* "trim" - Cut the line off with an ellipsis if it goes too long.
|
1602
1627
|
|
1628
|
+
'''Note:''' Green Shoes doesn't support `:wrap` style.
|
1629
|
+
|
1603
1630
|
== Classes List ==
|
1604
1631
|
|
1605
1632
|
Here is a complete list of all the classes introduced by Shoes. This chart is
|
@@ -2995,12 +3022,11 @@ Here's a sample checklist.
|
|
2995
3022
|
|
2996
3023
|
{{{
|
2997
3024
|
#!ruby
|
2998
|
-
# Not yet available
|
2999
3025
|
Shoes.app do
|
3000
3026
|
stack do
|
3001
|
-
flow { check; para "Frances Johnson" }
|
3002
|
-
flow { check; para "Ignatius J. Reilly" }
|
3003
|
-
flow { check; para "Winston Niles Rumfoord" }
|
3027
|
+
flow { check; para "Frances Johnson", width: 200 }
|
3028
|
+
flow { check; para "Ignatius J. Reilly", width: 200 }
|
3029
|
+
flow { check; para "Winston Niles Rumfoord", width: 200 }
|
3004
3030
|
end
|
3005
3031
|
end
|
3006
3032
|
}}}
|
@@ -3013,14 +3039,13 @@ Okay, let's add to the above example.
|
|
3013
3039
|
|
3014
3040
|
{{{
|
3015
3041
|
#!ruby
|
3016
|
-
# Not yet available
|
3017
3042
|
Shoes.app do
|
3018
3043
|
@list = ['Frances Johnson', 'Ignatius J. Reilly',
|
3019
3044
|
'Winston Niles Rumfoord']
|
3020
3045
|
|
3021
3046
|
stack do
|
3022
3047
|
@list.map! do |name|
|
3023
|
-
flow { @c = check; para name }
|
3048
|
+
flow { @c = check; para name, width: 200 }
|
3024
3049
|
[@c, name]
|
3025
3050
|
end
|
3026
3051
|
|
@@ -3343,12 +3368,11 @@ marked.
|
|
3343
3368
|
|
3344
3369
|
{{{
|
3345
3370
|
#!ruby
|
3346
|
-
# Not yet available
|
3347
3371
|
Shoes.app do
|
3348
3372
|
para "Among these films, which do you prefer?\n"
|
3349
|
-
radio; para strong("The Taste of Tea"), " by Katsuhito Ishii\n"
|
3350
|
-
radio; para strong("Kin-Dza-Dza"), " by Georgi Danelia\n"
|
3351
|
-
radio; para strong("Children of Heaven"), " by Majid Majidi\n"
|
3373
|
+
radio; para strong("The Taste of Tea"), " by Katsuhito Ishii\n", width: 570
|
3374
|
+
radio; para strong("Kin-Dza-Dza"), " by Georgi Danelia\n", width: 570
|
3375
|
+
radio; para strong("Children of Heaven"), " by Majid Majidi\n", width: 570
|
3352
3376
|
end
|
3353
3377
|
}}}
|
3354
3378
|
|
@@ -3359,13 +3383,12 @@ If we move them each into their own slot, the example breaks.
|
|
3359
3383
|
|
3360
3384
|
{{{
|
3361
3385
|
#!ruby
|
3362
|
-
# Not yet available
|
3363
3386
|
Shoes.app do
|
3364
3387
|
stack do
|
3365
3388
|
para "Among these films, which do you prefer?"
|
3366
|
-
flow { radio; para "The Taste of Tea by Katsuhito Ishii" }
|
3367
|
-
flow { radio; para "Kin-Dza-Dza by Georgi Danelia" }
|
3368
|
-
flow { radio; para "Children of Heaven by Majid Majidi" }
|
3389
|
+
flow { radio; para "The Taste of Tea by Katsuhito Ishii", width: 300 }
|
3390
|
+
flow { radio; para "Kin-Dza-Dza by Georgi Danelia", width: 300 }
|
3391
|
+
flow { radio; para "Children of Heaven by Majid Majidi", width: 300 }
|
3369
3392
|
end
|
3370
3393
|
end
|
3371
3394
|
}}}
|
@@ -3377,21 +3400,20 @@ Here, let's group all these radios in the `:films` group.
|
|
3377
3400
|
|
3378
3401
|
{{{
|
3379
3402
|
#!ruby
|
3380
|
-
# Not yet available
|
3381
3403
|
Shoes.app do
|
3382
3404
|
stack do
|
3383
3405
|
para "Among these films, which do you prefer?"
|
3384
3406
|
flow do
|
3385
3407
|
radio :films
|
3386
|
-
para "The Taste of Tea by Katsuhito Ishii"
|
3408
|
+
para "The Taste of Tea by Katsuhito Ishii", width: 300
|
3387
3409
|
end
|
3388
3410
|
flow do
|
3389
3411
|
radio :films
|
3390
|
-
para "Kin-Dza-Dza by Georgi Danelia"
|
3412
|
+
para "Kin-Dza-Dza by Georgi Danelia", width: 300
|
3391
3413
|
end
|
3392
3414
|
flow do
|
3393
3415
|
radio :films
|
3394
|
-
para "Children of Heaven by Majid Majidi"
|
3416
|
+
para "Children of Heaven by Majid Majidi", width: 300
|
3395
3417
|
end
|
3396
3418
|
end
|
3397
3419
|
end
|