green_shoes 0.171.0 → 0.176.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.171.0
1
+ 0.176.0
data/lib/shoes/basic.rb CHANGED
@@ -28,8 +28,8 @@ class Shoes
28
28
  @hided, @shows, @hovered = false, true, false
29
29
  end
30
30
 
31
- attr_reader :parent, :args, :shows, :initials
32
- attr_accessor :hided
31
+ attr_reader :args, :shows, :initials
32
+ attr_accessor :parent, :hided
33
33
 
34
34
  def move x, y
35
35
  @app.cslot.contents -= [self]
data/lib/shoes/ruby.rb CHANGED
@@ -34,7 +34,7 @@ class Object
34
34
  end
35
35
 
36
36
  def exit
37
- (Shoes.APPS.length + 1).times{|i| timer(0.01*i){Gtk.main_quit}}
37
+ Shoes.APPS.length.times {|i| timer(0.01*i){Gtk.main_quit}}
38
38
  File.delete Shoes::TMP_PNG_FILE if File.exist? Shoes::TMP_PNG_FILE
39
39
  end
40
40
 
data/lib/shoes/slot.rb CHANGED
@@ -73,6 +73,7 @@ class Shoes
73
73
  args[:nocontrol] = true
74
74
  tmp = self.is_a?(Stack) ? Stack.new(@app.slot_attributes(args), &blk) : Flow.new(@app.slot_attributes(args), &blk)
75
75
  self.contents = tmp.contents
76
+ contents.each{|e| e.parent = self if e.is_a? Basic}
76
77
  Shoes.call_back_procs @app
77
78
  Shoes.set_cursor_type @app
78
79
  end
data/lib/shoes/style.rb CHANGED
@@ -20,9 +20,20 @@ class Shoes
20
20
  class ShapeBase
21
21
  def style args
22
22
  real.clear
23
+ @args[:nocontrol] = @args[:noorder] = true
23
24
  m = self.class.to_s.downcase[7..-1]
24
25
  args = @args.merge args
25
- obj = @app.send m, args, &args[:block]
26
+ @real = @app.send(m, args, &args[:block]).real
27
+ end
28
+ end
29
+
30
+ class Pattern
31
+ def style args
32
+ real.clear if real
33
+ args[:pattern] ||= @pattern
34
+ m = self.class.to_s.downcase[7..-1]
35
+ args = @args.merge args
36
+ obj = @app.send m, args[:pattern], args, &args[:block]
26
37
  obj.instance_variables.each{|iv| eval "#{iv} = obj.instance_variable_get('#{iv}')"}
27
38
  end
28
39
  end
@@ -53,4 +64,23 @@ class Shoes
53
64
  {width: @width, height: @height}
54
65
  end
55
66
  end
67
+
68
+ class Basic
69
+ def style args = nil
70
+ return {width: @width, height: @height} unless args
71
+ args[:width] ||= @width
72
+ args[:height] ||= @height
73
+ case self
74
+ when Button, EditBox, ListBox
75
+ real.set_size_request args[:width], args[:height]
76
+ @height = args[:height]
77
+ when EditLine
78
+ real.width_chars = args[:width] / 6
79
+ when Progress
80
+ real.text = ' ' * (args[:width] / 4 - 2)
81
+ else
82
+ end
83
+ @width = args[:width]
84
+ end
85
+ end
56
86
  end
data/static/manual-en.txt CHANGED
@@ -2658,18 +2658,17 @@ Gets the object for this element's container.
2658
2658
 
2659
2659
  = Elements =
2660
2660
 
2661
- Ah, here's the stuff of Shoes. An element can be as simple as an oval shape. Or
2662
- as complex as a video stream. You've encountered all of these elements before
2663
- in the Slots section of th manual.
2661
+ Ah, here's the stuff of Green Shoes. An element can be as simple as an oval shape. Or
2662
+ as complex as a para text string. You've encountered all of these elements before
2663
+ in the Slots section of the manual.
2664
2664
 
2665
- Shoes has seven native controls: the Button, the EditLine, the EditBox, the
2665
+ Green Shoes has seven native controls: the Button, the EditLine, the EditBox, the
2666
2666
  ListBox, the Progress meter, the Check box and the Radio. By "native"
2667
- controls, we mean that each of these seven elements is drawn by the operating
2668
- system. So, a Progress bar will look one way on Windows and another way on OS
2669
- X.
2667
+ controls, we mean that each of these seven elements is drawn by Ruby/GTK2 apis
2668
+ directly. So, a Progress bar will never convert to the PNG image data.
2670
2669
 
2671
- Shoes also has seven basic other types of elements: Background, Border, Image,
2672
- Shape, TextBlock, Timer and Video. These all should look and act the same on
2670
+ Greem Shoes also has seven basic other types of elements: Background, Border, Image,
2671
+ Shape, TextBlock, Animate and Video. These all should look and act the same on
2673
2672
  every operating system.
2674
2673
 
2675
2674
  Once an element is created, you will often still want to change it. To move it
@@ -2677,13 +2676,13 @@ or hide it or get rid of it. You'll use the commands in this section to do that
2677
2676
  sort of stuff. (Especially check out the [[Common Common Methods]] section for
2678
2677
  commands you can use on any element.)
2679
2678
 
2680
- So, for example, use the `image` method of a Slot to place a PNG on the screen.
2679
+ So, for example, use the `image` method to place a PNG on the screen.
2681
2680
  The `image` method gives you back an Image object. Use the methods of the Image
2682
2681
  object to change things up.
2683
2682
 
2684
2683
  == Common Methods ==
2685
2684
 
2686
- A few methods are shared by every little element in Shoes. Moving, showing,
2685
+ A few methods are shared by every little element in Green Shoes. Moving, showing,
2687
2686
  hiding. Removing an element. Basic and very general things. This list
2688
2687
  encompasses those common commands.
2689
2688
 
@@ -2692,7 +2691,6 @@ covered as the [[Position.style]] method for slots.)
2692
2691
 
2693
2692
  {{{
2694
2693
  #!ruby
2695
- # Not yet available
2696
2694
  Shoes.app do
2697
2695
  stack do
2698
2696
  # Background, text and a button: both are elements!
@@ -2701,9 +2699,9 @@ covered as the [[Position.style]] method for slots.)
2701
2699
  @press = button "Stop your messin about!"
2702
2700
 
2703
2701
  # And so, both can be styled.
2704
- @text.style :size => 12, :stroke => red, :margin => 10
2705
- @press.style :width => 400
2706
- @back.style :height => 10
2702
+ @text.style size: 12, markup: fg(@text.text, red), margin: 10
2703
+ @press.style width: 400
2704
+ @back.style height: 10
2707
2705
  end
2708
2706
  end
2709
2707
  }}}
@@ -2712,6 +2710,8 @@ For specific commands, see the other links to the left in the Elements section.
2712
2710
  Like if you want to pause or play a video file, check the [[Video]] section,
2713
2711
  since pausing and playing is peculiar to videos. No sense pausing a button.
2714
2712
 
2713
+ '''Note:''' Green Shoes doesn't support `video` method.
2714
+
2715
2715
  === displace(left: a number, top: a number) » self ===
2716
2716
 
2717
2717
  Displacing an element moves it. But without changing the layout around it.
@@ -2752,6 +2752,8 @@ coordinates of a displaced element, you'll just get back the normal
2752
2752
  coordinates. As if there was no displacement. Displacing is just intended for
2753
2753
  quick animations!
2754
2754
 
2755
+ '''Note:''' Green Shoes doesn't support `displace` method.
2756
+
2755
2757
  === height() » a number ===
2756
2758
 
2757
2759
  The vertical screen size of the element in pixels. In the case of images, this
@@ -2774,31 +2776,29 @@ Gets you the pixel position of the left edge of the element.
2774
2776
 
2775
2777
  === move(left: a number, top: a number) » self ===
2776
2778
 
2777
- Moves the element to a specific pixel position within its slot. The element is
2778
- still inside the slot. But it will no longer be stacked or flowed in with the
2779
+ Moves the element to a specific pixel position. The element is no longer
2780
+ inside the slot. So, it will not be stacked or flowed in with the
2779
2781
  other stuff in the slot. The element will float freely, now absolutely
2780
2782
  positioned instead.
2781
2783
 
2782
2784
  {{{
2783
2785
  #!ruby
2784
2786
  Shoes.app do
2785
- flow :margin => 12 do
2786
- # Set up three buttons
2787
- button "One"
2788
- @two = button "Two"
2789
- button "Three"
2787
+ # Set up three buttons
2788
+ b = button "One"
2789
+ @two = button "Two"
2790
+ button "Three"
2790
2791
 
2791
- # Bounce the second button
2792
- animate do |i|
2793
- @two.move(40, 40 + (Math.sin(i) * 6).to_i)
2794
- end
2792
+ # Bounce the second button
2793
+ animate do |i|
2794
+ @two.move(33, 33 + (Math.sin(i) * 6).to_i)
2795
2795
  end
2796
2796
  end
2797
2797
  }}}
2798
2798
 
2799
2799
  The second button is moved to a specific place, allowing the third button to
2800
- slide over into its place. If you want to move an element without shifting
2801
- other pieces, see the [[Common.displace]] method.
2800
+ slide over into its place. But it will not happen until you resize the window.
2801
+ If you want to slide the third button without resizing the window, add `flush` method.
2802
2802
 
2803
2803
  === parent() » a Shoes::Stack or Shoes::Flow ===
2804
2804
 
@@ -2824,10 +2824,9 @@ original setting (things like "100%" for width or "10px" for top.)
2824
2824
 
2825
2825
  {{{
2826
2826
  #!ruby
2827
- # Not yet available
2828
2827
  Shoes.app do
2829
2828
  # A button which take up the whole page
2830
- @b = button "All of it", :width => 1.0, :height => 1.0
2829
+ @b = button "All of it", width: width, height: height
2831
2830
 
2832
2831
  # When clicked, show the styles
2833
2832
  @b.click { alert(@b.style.inspect) }
@@ -2855,16 +2854,15 @@ returns an exact pixel size. In the case of images, this is not the full width
2855
2854
  of the image, just the size it is shown at. See the [[Common.height]] method
2856
2855
  for more.
2857
2856
 
2858
- Also, if you create an element with a width of 100% and that element is inside
2859
- a stack which is 120 pixels wide, you'll get back `120`. However, if you call
2860
- `style[:width]`, you'll get `"100%"`.
2857
+ Also, if you create an element with a width of 1.0 and that element is inside
2858
+ a stack which is 120 pixels wide, you'll get back `120`. And, if you call
2859
+ `style[:width]`, you'll get `120`.
2861
2860
 
2862
2861
  {{{
2863
2862
  #!ruby
2864
- # Not yet available
2865
2863
  Shoes.app do
2866
- stack :width => 120 do
2867
- @b = button "Click me", :width => "100%" do
2864
+ stack width: 120 do
2865
+ @b = button "Click me", width: 1.0 do
2868
2866
  alert "button.width = #{@b.width}\n" +
2869
2867
  "button.style[:width] = #{@b.style[:width]}"
2870
2868
  end
@@ -2873,11 +2871,7 @@ a stack which is 120 pixels wide, you'll get back `120`. However, if you call
2873
2871
  }}}
2874
2872
 
2875
2873
  In order to set the width, you'll have to go through the [[Common.style]]
2876
- method again. So, to set the button to 150 pixels wide: `@b.style(:width =>
2877
- 150)`.
2878
-
2879
- To let Shoes pick the element's width, go with `@b.style(:width => nil)` to
2880
- empty out the setting.
2874
+ method again. So, to set the button to 150 pixels wide: `@b.style(width: 150)`.
2881
2875
 
2882
2876
  == Background ==
2883
2877
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 171
7
+ - 176
8
8
  - 0
9
- version: 0.171.0
9
+ version: 0.176.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - ashbb
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-02-26 00:00:00 +09:00
17
+ date: 2011-03-03 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency