glimmer-dsl-swt 4.20.13.13 → 4.20.13.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,36 @@
1
+ # Copyright (c) 2007-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ class Connect4
23
+ module Model
24
+ class Slot
25
+ attr_reader :grid
26
+
27
+ # value 0 means empty, 1 means player 1 coin, and 2 means player 2 coin
28
+ attr_accessor :value
29
+
30
+ def initialize(grid)
31
+ @value = 0
32
+ @grid = grid
33
+ end
34
+ end
35
+ end
36
+ end
@@ -43,7 +43,6 @@ class KlondikeSolitaire
43
43
  end
44
44
  drop_event.dragged_shape.dispose
45
45
  rescue => e
46
- # pd e
47
46
  drop_event.doit = false
48
47
  end
49
48
  end
@@ -36,7 +36,6 @@ class KlondikeSolitaire
36
36
 
37
37
  on_drop do |drop_event|
38
38
  begin
39
- # TODO make sure one cannot drag a column pile of cards here
40
39
  card_shape = drop_event.dragged_shape.get_data('custom_shape')
41
40
  card = card_shape.model
42
41
  card_parent_pile = card_shape.parent_pile
@@ -46,7 +45,6 @@ class KlondikeSolitaire
46
45
  card_source_model.remove!(card)
47
46
  drop_event.dragged_shape.dispose
48
47
  rescue => e
49
- # pd e
50
48
  drop_event.doit = false
51
49
  end
52
50
  end
@@ -88,6 +88,8 @@ class EmailShell
88
88
  end
89
89
 
90
90
  class HelloCustomShell
91
+ include Glimmer
92
+
91
93
  Email = Struct.new(:date, :subject, :from, :message, keyword_init: true)
92
94
  EmailSystem = Struct.new(:emails, keyword_init: true)
93
95
 
@@ -0,0 +1,58 @@
1
+ # Copyright (c) 2007-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'glimmer-dsl-swt'
23
+
24
+ class HelloScale
25
+ include Glimmer::UI::CustomShell
26
+
27
+ attr_accessor :value
28
+
29
+ before_body do
30
+ @value = 50
31
+ end
32
+
33
+ body {
34
+ shell {
35
+ row_layout(:vertical) {
36
+ fill true
37
+ center true
38
+ }
39
+
40
+ text 'Hello, Slider!'
41
+
42
+ label(:center) {
43
+ text <= [self, :value]
44
+ }
45
+
46
+ slider { # optionally takes :vertical or :horizontal (default) SWT style
47
+ minimum 0
48
+ maximum 110 # leave room for 10 extra (slider stops at 100)
49
+ page_increment 10 # page increment occurs when clicking area between slider and beginning or end
50
+ selection <=> [self, :value]
51
+ }
52
+
53
+ }
54
+
55
+ }
56
+ end
57
+
58
+ HelloScale.launch
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.20.13.13
4
+ version: 4.20.13.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-02 00:00:00.000000000 Z
11
+ date: 2021-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -528,6 +528,17 @@ files:
528
528
  - lib/glimmer/ui/custom_shell.rb
529
529
  - lib/glimmer/ui/custom_widget.rb
530
530
  - lib/glimmer/util/proc_tracker.rb
531
+ - samples/elaborate/battleship.rb
532
+ - samples/elaborate/battleship/model/cell.rb
533
+ - samples/elaborate/battleship/model/game.rb
534
+ - samples/elaborate/battleship/model/grid.rb
535
+ - samples/elaborate/battleship/model/ship.rb
536
+ - samples/elaborate/battleship/model/ship_collection.rb
537
+ - samples/elaborate/battleship/view/action_panel.rb
538
+ - samples/elaborate/battleship/view/cell.rb
539
+ - samples/elaborate/battleship/view/grid.rb
540
+ - samples/elaborate/battleship/view/ship.rb
541
+ - samples/elaborate/battleship/view/ship_collection.rb
531
542
  - samples/elaborate/calculator.rb
532
543
  - samples/elaborate/calculator/model/command.rb
533
544
  - samples/elaborate/calculator/model/command/all_clear.rb
@@ -541,6 +552,9 @@ files:
541
552
  - samples/elaborate/calculator/model/command/operation/subtract.rb
542
553
  - samples/elaborate/calculator/model/command/point.rb
543
554
  - samples/elaborate/calculator/model/presenter.rb
555
+ - samples/elaborate/connect4.rb
556
+ - samples/elaborate/connect4/model/grid.rb
557
+ - samples/elaborate/connect4/model/slot.rb
544
558
  - samples/elaborate/contact_manager.rb
545
559
  - samples/elaborate/contact_manager/contact.rb
546
560
  - samples/elaborate/contact_manager/contact_manager_presenter.rb
@@ -638,6 +652,7 @@ files:
638
652
  - samples/hello/hello_scale.rb
639
653
  - samples/hello/hello_shape.rb
640
654
  - samples/hello/hello_shell.rb
655
+ - samples/hello/hello_slider.rb
641
656
  - samples/hello/hello_spinner.rb
642
657
  - samples/hello/hello_styled_text.rb
643
658
  - samples/hello/hello_tab.rb