rgw 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -8
- data/lib/rgw/pile.rb +108 -0
- data/lib/rgw/radio-revealer.rb +1 -1
- data/lib/rgw/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d13a2418680d672dfdd84912edc17e1de7e56f5
|
4
|
+
data.tar.gz: 08b5f0593508f29b92daa8452fba7ba7399d79a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17c080845299133852fc34f4ae2eb3519635a99d14161cabcc461e73a62b095884e7620dd345c4e00de256f14a291b04e9d4eb6c85d57f509d434e385822aadb
|
7
|
+
data.tar.gz: eef854e034eb971a5a8e6101f38ed929293fa7ee1693af3c7ea3fd2ded9248952ec4defdd674123afa94bf0322d42da1a7b838c75abd3356d66865b50ba470f3
|
data/README.md
CHANGED
@@ -3,16 +3,17 @@
|
|
3
3
|
Rgw is a collection of [Gtk+](http://www.gtk.org/) widgets implemented in and for the
|
4
4
|
[ruby](https://www.ruby-lang.org) programming language.
|
5
5
|
|
6
|
-
**requirements**
|
7
|
-
ruby >= 2.0.0
|
8
|
-
ruby-gtk >= 2.2.0
|
9
|
-
gtk >= 3.10
|
10
6
|
|
11
7
|
**how to install**
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
Rgw comes as a RubyGem from [http://rubygems.org/](http://rubygems.org/). Just install it with
|
9
|
+
|
10
|
+
<pre><code>~$sudo gem install rgw</code></pre>
|
11
|
+
|
12
|
+
If you want to install a cloned copy from github.com you first have to create the gem package with
|
13
|
+
|
14
|
+
<pre><code>~$gem build rgw.gemspec
|
15
|
+
~$sudo gem install rgw-"version".gem</code></pre>
|
16
|
+
|
16
17
|
|
17
18
|
At this point, the widgets are working, but special functionality may be missing. A TODO list is at
|
18
19
|
the head of every library file. Feel free to implement :-)
|
data/lib/rgw/pile.rb
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
#encoding: UTF-8
|
2
|
+
|
3
|
+
=begin
|
4
|
+
Pile is free software; you can redistribute it and/or
|
5
|
+
modify it under the terms of the GNU Lesser General Public
|
6
|
+
License as published by the Free Software Foundation; either
|
7
|
+
version 2.1 of the License, or (at your option) any later version.
|
8
|
+
|
9
|
+
Pile is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
Lesser General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU Lesser General Public
|
15
|
+
License along with Pile; if not, write to the Free Software Foundation,
|
16
|
+
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
|
18
|
+
Copyright 2014 Detlef Reichl detlef!reichl()gmx!org
|
19
|
+
=end
|
20
|
+
|
21
|
+
# Rgw::Pile is a container, that allows to stack a widget (the pile child)
|
22
|
+
# over an other one (the child). The pile child can be placed freely over the
|
23
|
+
# child. The pile child doesn't cover the complete child, so it will receive
|
24
|
+
# all events for the none covered areas.
|
25
|
+
#
|
26
|
+
# IMPORTANT
|
27
|
+
# =========
|
28
|
+
# Rgw::Pile is not a real Gtk::Container implementation, because
|
29
|
+
# afaik building real subclasses of Gtk::Container is for now not possible with
|
30
|
+
# Ruby-Gtk. So this is a little bit of a hack and depending of the usage it can
|
31
|
+
# produce unexpected results. So don't see this as an ready-to-use widget but
|
32
|
+
# more as a base for your own implementations.
|
33
|
+
|
34
|
+
module Rgw
|
35
|
+
class Pile < Gtk::Box
|
36
|
+
# Initialize a new Rgw::Pile object
|
37
|
+
def initialize
|
38
|
+
super(:vertical)
|
39
|
+
@child1 = nil
|
40
|
+
@child2 = nil
|
41
|
+
@x = 0
|
42
|
+
@y = 0
|
43
|
+
end
|
44
|
+
|
45
|
+
# Adds the bottom child to the widget.
|
46
|
+
#
|
47
|
+
# @param child [Gtk::Widget] The widget to add.
|
48
|
+
def set_child child
|
49
|
+
raise RuntimeError, 'Rgw::Pile can only contain one child' unless @child1.nil?
|
50
|
+
@child1 = child
|
51
|
+
self.pack_start @child1, :expand => true, :fill => true
|
52
|
+
@child1.signal_connect_after(:size_allocate) {|widget, allo| on_allocate1 widget, allo}
|
53
|
+
end
|
54
|
+
|
55
|
+
# Adds the stacked child to the widget.
|
56
|
+
#
|
57
|
+
# @param child [Gtk::Widget] The widget to add. It has to be added _after_ the child.
|
58
|
+
|
59
|
+
def set_pile_child child, x=0, y=0
|
60
|
+
raise RuntimeError, 'child has to be set before pile_child' if @child1.nil?
|
61
|
+
raise RuntimeError, 'Rgw::Pile can only contain one pile_child' unless @child2.nil?
|
62
|
+
raise ArgumentError, "unsuported class %s, expect Gtk::Widget for child" % child.class.to_s unless child.is_a? Gtk::Widget
|
63
|
+
raise ArgumentError, "unsuported class %s, expect Integer for x" % x.class.to_s unless x.is_a? Integer
|
64
|
+
raise ArgumentError, "unsuported class %s, expect Integer for y" % y.class.to_s unless y.is_a? Integer
|
65
|
+
|
66
|
+
@pileBox = Gtk::Box.new :horizontal
|
67
|
+
self.pack_start @pileBox, :expand => false, :fill => false
|
68
|
+
|
69
|
+
|
70
|
+
@child2 = child
|
71
|
+
@x = x
|
72
|
+
@y = y
|
73
|
+
|
74
|
+
@child2.has_window = false
|
75
|
+
@pileBox.pack_start @child2, :expand => false, :fill => false
|
76
|
+
@child2.set_parent_window self.window
|
77
|
+
@pileBox.signal_connect_after(:size_allocate) {|widget, allo| on_allocate2 widget, allo}
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
private
|
82
|
+
# Expands the child, so that it also consumes the place the pile child used.
|
83
|
+
def on_allocate1 widget, allocation
|
84
|
+
allocation.height = self.allocation.height
|
85
|
+
widget.size_allocate allocation
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
# Moves the pile child to it's destination.
|
90
|
+
def on_allocate2 widget, allocation
|
91
|
+
sAllocation = self.allocation
|
92
|
+
|
93
|
+
if @x >= 0
|
94
|
+
allocation.x = @x
|
95
|
+
elsif @x < 0
|
96
|
+
allocation.x = sAllocation.width - @child2.allocation.width - -@x
|
97
|
+
end
|
98
|
+
|
99
|
+
if @y >= 0
|
100
|
+
allocation.y = @y
|
101
|
+
elsif @y < 0
|
102
|
+
allocation.y = sAllocation.height - @child2.allocation.height - -@y
|
103
|
+
end
|
104
|
+
|
105
|
+
widget.size_allocate allocation
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
data/lib/rgw/radio-revealer.rb
CHANGED
data/lib/rgw/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Detlef Reichl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n-toolbox
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- lib/data/pixmaps/lock16.png
|
51
51
|
- lib/data/pixmaps/unlock16.png
|
52
52
|
- lib/rgw/big-list.rb
|
53
|
+
- lib/rgw/pile.rb
|
53
54
|
- lib/rgw/property-editor.rb
|
54
55
|
- lib/rgw/radio-revealer.rb
|
55
56
|
- lib/rgw/restricted-entry.rb
|