glimmer-cp-messageboxpanel 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +20 -0
- data/README.md +186 -0
- data/VERSION +1 -0
- data/glimmer-cp-messageboxpanel.gemspec +56 -0
- data/lib/glimmer/view/message_box_panel.rb +116 -0
- data/lib/glimmer-cp-messageboxpanel.rb +25 -0
- data/samples/message_box_panel/hello_message_box_panel.rb +81 -0
- metadata +137 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9009ec58b03da5c7e2b40cf79e4c4f3e70ff123580bb9beb13f28e75bda7c23e
|
4
|
+
data.tar.gz: 266e16eb9dbf75a3bd3cb48c8267b9d2c176d7995a1135fc1ca99b4d76d0a29b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9937b8b4374dd11761cd2d9365c985f4fb77a52996246135a5b3e0efcbc75420ef44a5adb29c9dd3831611f7dc4ad9a933e958aafaaad7163d0644ce9f3b7097
|
7
|
+
data.tar.gz: 20406b7e7096935c5d2dc6501e8c4b80b2ebb55a373eace66c16b2926b421b58c729f9137dc7aef855bbaa3ef38a11d6c5ad25137a286443e4f5d523f67f6122
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2022 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.
|
data/README.md
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
# Message Box Panel 0.1.0
|
2
|
+
## [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 /> Glimmer Custom Shape](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_COMMAND.md#custom-shape-gem)
|
3
|
+
[](http://badge.fury.io/rb/glimmer-cp-messageboxpanel)
|
4
|
+
|
5
|
+
[Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) Message Box Panel Custom Shape.
|
6
|
+
|
7
|
+
`message_box_panel` is the [Glimmer GUI DSL](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#glimmer-gui-dsl-syntax) keyword provided by this [gem](https://rubygems.org/gems/glimmer-cp-messageboxpanel).
|
8
|
+
|
9
|
+
It is a graphical alternative to the native [`message_box`](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#message_box) widget, which is fully customizable.
|
10
|
+
|
11
|
+
### Screenshot
|
12
|
+
|
13
|
+

|
14
|
+
|
15
|
+

|
16
|
+
|
17
|
+
### Actual Use
|
18
|
+
|
19
|
+
It is used in [Glimmer Quarto](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_SAMPLES.md#quarto).
|
20
|
+
|
21
|
+

|
22
|
+
|
23
|
+
## Setup
|
24
|
+
|
25
|
+
### Bundler
|
26
|
+
|
27
|
+
Add the follwing to `Gemfile`:
|
28
|
+
```ruby
|
29
|
+
gem 'glimmer-cp-messageboxpanel', '~> 0.1.0'
|
30
|
+
```
|
31
|
+
|
32
|
+
Run `bundle install` or `bundle`:
|
33
|
+
```
|
34
|
+
bundle
|
35
|
+
```
|
36
|
+
|
37
|
+
### Direct
|
38
|
+
|
39
|
+
Run:
|
40
|
+
```
|
41
|
+
gem install glimmer-cp-messageboxpanel
|
42
|
+
```
|
43
|
+
|
44
|
+
## API
|
45
|
+
|
46
|
+
First, add this to your [Ruby](https://www.ruby-lang.org/en/) file:
|
47
|
+
```ruby
|
48
|
+
require 'glimmer-cp-messageboxpanel'
|
49
|
+
```
|
50
|
+
|
51
|
+
Then, use this keyword:
|
52
|
+
```ruby
|
53
|
+
message_box_panel(options) { properties_and_listeners }
|
54
|
+
```
|
55
|
+
|
56
|
+
Options (keyword args) are:
|
57
|
+
- `:message`
|
58
|
+
- `:location_x` (default: `:default`): `:default` value means centered horizontally within parent
|
59
|
+
- `:location_y` (default: `:default`): `:default` value means centered vertically within parent
|
60
|
+
- `:size_width` (default: `[:default, @font_height*4.0]`): default value is text width plus extra width equal to text font height multiplied by 4
|
61
|
+
- `:size_height` (default: `[:default, @font_height*4.0]`): default value is text height plus extra height equal to text font height multiplied by 4
|
62
|
+
- `:background_color` (default: `:white`): background color for text and round rectangle
|
63
|
+
- `:foreground_color` (default: `:black`): foreground color used in border
|
64
|
+
- `:border_line_width` (default: `1`): border line width
|
65
|
+
- `:text_font` (default: `{height: 12}`): text font, which has height 12 by default
|
66
|
+
- `:text_color` (default: `:black`): text color, which is black by default
|
67
|
+
|
68
|
+
## Sample
|
69
|
+
|
70
|
+
The [glimmer-cp-messageboxpanel Ruby gem](https://rubygems.org/gems/glimmer-cp-messageboxpanel) adds to glimmer samples, showing up when you run:
|
71
|
+
```
|
72
|
+
glimmer samples
|
73
|
+
```
|
74
|
+
|
75
|
+
### Hello, Message Box Panel!
|
76
|
+
|
77
|
+
[Glimmer GUI DSL](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#glimmer-gui-dsl-syntax) code (from [samples/message_box_panel/hello_message_box_panel.rb](/samples/message_box_panel/hello_message_box_panel.rb)):
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
require_relative '../../lib/glimmer-cp-messageboxpanel' # Use `require 'glimmer-cp-messageboxpanel'` if gem is installed
|
81
|
+
|
82
|
+
class HelloMessageBoxPanel
|
83
|
+
include Glimmer::UI::CustomShell
|
84
|
+
|
85
|
+
body {
|
86
|
+
shell {
|
87
|
+
text 'Hello, Message Box Panel!'
|
88
|
+
minimum_size 425, 200
|
89
|
+
|
90
|
+
@canvas = canvas {
|
91
|
+
background :white
|
92
|
+
|
93
|
+
first_message_box_panel
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
def first_message_box_panel
|
99
|
+
message_box_panel(message: 'Hello, Message Box Panel!', background_color: rgb(255, 255, 128), text_font: {height: 16}) {
|
100
|
+
on_closed do
|
101
|
+
@canvas.content { # re-open canvas content and add a message box panel
|
102
|
+
second_message_box_panel
|
103
|
+
}
|
104
|
+
end
|
105
|
+
}
|
106
|
+
end
|
107
|
+
|
108
|
+
def second_message_box_panel
|
109
|
+
message_box_panel(message: "Message Box Panel is a graphical\nversion of the native Message Box", background_color: :cyan, text_font: {height: 16}, border_line_width: 3) {
|
110
|
+
on_closed do
|
111
|
+
@canvas.content { # re-open canvas content and add a message box panel
|
112
|
+
third_message_box_panel
|
113
|
+
}
|
114
|
+
end
|
115
|
+
}
|
116
|
+
end
|
117
|
+
|
118
|
+
def third_message_box_panel
|
119
|
+
message_box_panel(message: "It is a customizable alternative that can\n be used in Canvas-based applications", background_color: :yellow, foreground_color: :red, text_color: :dark_green, text_font: {height: 16, style: [:bold, :italic]}, border_line_width: 3) {
|
120
|
+
on_closed do
|
121
|
+
@canvas.content { # re-open canvas content and add a message box panel
|
122
|
+
fourth_message_box_panel
|
123
|
+
}
|
124
|
+
end
|
125
|
+
}
|
126
|
+
end
|
127
|
+
|
128
|
+
def fourth_message_box_panel
|
129
|
+
message_box_panel(message: 'Good bye, Message Box Panel!', background_color: :black, text_color: :white, text_font: {height: 16}) {
|
130
|
+
on_closed do
|
131
|
+
@canvas.content { # re-open canvas content and add a message box panel
|
132
|
+
first_message_box_panel
|
133
|
+
}
|
134
|
+
end
|
135
|
+
}
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
HelloMessageBoxPanel.launch
|
140
|
+
```
|
141
|
+
|
142
|
+
Hello, Message Box Panel!
|
143
|
+
|
144
|
+

|
145
|
+
|
146
|
+

|
147
|
+
|
148
|
+

|
149
|
+
|
150
|
+

|
151
|
+
|
152
|
+
## Contributing
|
153
|
+
|
154
|
+
- Check out the latest master to make sure the feature hasn't been
|
155
|
+
implemented or the bug hasn't been fixed yet.
|
156
|
+
- Check out the issue tracker to make sure someone already hasn't
|
157
|
+
requested it and/or contributed it.
|
158
|
+
- Fork the project.
|
159
|
+
- Start a feature/bugfix branch.
|
160
|
+
- Commit and push until you are happy with your contribution.
|
161
|
+
- Make sure to add tests for it. This is important so I don't break it
|
162
|
+
in a future version unintentionally.
|
163
|
+
- Please try not to mess with the Rakefile, version, or history. If
|
164
|
+
you want to have your own version, or is otherwise necessary, that
|
165
|
+
is fine, but please isolate to its own commit so I can cherry-pick
|
166
|
+
around it.
|
167
|
+
|
168
|
+
## TODO
|
169
|
+
|
170
|
+
If you need new features or spot things that need to be fixed or improved, please [report in an Issue](https://github.com/AndyObtiva/glimmer-cp-messageboxpanel/issues/new) or [submit a Pull Request](https://github.com/AndyObtiva/glimmer-cp-messageboxpanel/compare).
|
171
|
+
|
172
|
+
[TODO.md](/TODO.md)
|
173
|
+
|
174
|
+
## Change Log
|
175
|
+
|
176
|
+
[CHANGELOG.md](/CHANGELOG.md)
|
177
|
+
|
178
|
+
## License
|
179
|
+
|
180
|
+
[MIT](LICENSE.txt)
|
181
|
+
|
182
|
+
Copyright (c) 2022 - Andy Maleh.
|
183
|
+
|
184
|
+
--
|
185
|
+
|
186
|
+
[<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built for [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) (JRuby Desktop Development GUI Framework).
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Generated by juwelier
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: glimmer-cp-messageboxpanel 0.1.0 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "glimmer-cp-messageboxpanel".freeze
|
9
|
+
s.version = "0.1.0"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib".freeze]
|
13
|
+
s.authors = ["Andy Maleh".freeze]
|
14
|
+
s.date = "2022-01-08"
|
15
|
+
s.description = "Message Box Panel - Glimmer DSL for SWT Custom Shape - message_box_panel is a graphical alternative to the native SWT message_box".freeze
|
16
|
+
s.email = "andy.am@gmail.com".freeze
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.md"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
"CHANGELOG.md",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.md",
|
25
|
+
"VERSION",
|
26
|
+
"glimmer-cp-messageboxpanel.gemspec",
|
27
|
+
"lib/glimmer-cp-messageboxpanel.rb",
|
28
|
+
"lib/glimmer/view/message_box_panel.rb",
|
29
|
+
"samples/message_box_panel/hello_message_box_panel.rb"
|
30
|
+
]
|
31
|
+
s.homepage = "http://github.com/AndyObtiva/glimmer-cp-messageboxpanel".freeze
|
32
|
+
s.licenses = ["MIT".freeze]
|
33
|
+
s.rubygems_version = "3.2.29".freeze
|
34
|
+
s.summary = "Message Box Panel - Glimmer Custom Shape".freeze
|
35
|
+
|
36
|
+
if s.respond_to? :specification_version then
|
37
|
+
s.specification_version = 4
|
38
|
+
end
|
39
|
+
|
40
|
+
if s.respond_to? :add_runtime_dependency then
|
41
|
+
s.add_runtime_dependency(%q<glimmer-dsl-swt>.freeze, ["~> 4.22"])
|
42
|
+
s.add_runtime_dependency(%q<psych>.freeze, ["= 3.3.2"])
|
43
|
+
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
44
|
+
s.add_development_dependency(%q<juwelier>.freeze, ["= 2.4.9"])
|
45
|
+
s.add_development_dependency(%q<warbler>.freeze, ["= 2.0.5"])
|
46
|
+
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
47
|
+
else
|
48
|
+
s.add_dependency(%q<glimmer-dsl-swt>.freeze, ["~> 4.22"])
|
49
|
+
s.add_dependency(%q<psych>.freeze, ["= 3.3.2"])
|
50
|
+
s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
51
|
+
s.add_dependency(%q<juwelier>.freeze, ["= 2.4.9"])
|
52
|
+
s.add_dependency(%q<warbler>.freeze, ["= 2.0.5"])
|
53
|
+
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# Copyright (c) 2022 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
|
+
module Glimmer
|
23
|
+
module View
|
24
|
+
class MessageBoxPanel
|
25
|
+
include Glimmer::UI::CustomShape
|
26
|
+
|
27
|
+
FONT_HEIGHT_DEFAULT = 12
|
28
|
+
BUTTON_TEXT_DEFAULT = 'OK'
|
29
|
+
|
30
|
+
option :message
|
31
|
+
option :location_x, default: :default
|
32
|
+
option :location_y, default: :default
|
33
|
+
option :size_width
|
34
|
+
option :size_height
|
35
|
+
option :background_color, default: :white
|
36
|
+
option :foreground_color, default: :black
|
37
|
+
option :border_line_width, default: 1
|
38
|
+
option :text_font, default: {height: FONT_HEIGHT_DEFAULT}
|
39
|
+
option :text_color, default: :black
|
40
|
+
|
41
|
+
attr_reader :closed
|
42
|
+
alias closed? closed
|
43
|
+
|
44
|
+
def can_handle_observation_request?(observation_request)
|
45
|
+
observation_request == 'on_closed' || super
|
46
|
+
end
|
47
|
+
|
48
|
+
def handle_observation_request(observation_request, &block)
|
49
|
+
if observation_request == 'on_closed'
|
50
|
+
@on_closed_handlers ||= []
|
51
|
+
@on_closed_handlers << block
|
52
|
+
else
|
53
|
+
super
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
before_body do
|
58
|
+
@font_height = text_font[:height] || FONT_HEIGHT_DEFAULT
|
59
|
+
self.size_width ||= [:default, @font_height*4.0]
|
60
|
+
self.size_height ||= [:default, @font_height*4.0]
|
61
|
+
@text_offset = -1.2*@font_height
|
62
|
+
|
63
|
+
display {
|
64
|
+
on_swt_keyup do |key_event|
|
65
|
+
close if key_event.keyCode == swt(:cr)
|
66
|
+
end
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
body {
|
71
|
+
rectangle(location_x, location_y, size_width, size_height, round: true) {
|
72
|
+
background background_color
|
73
|
+
|
74
|
+
text(message, :default, [:default, @text_offset]) {
|
75
|
+
foreground text_color
|
76
|
+
font text_font
|
77
|
+
}
|
78
|
+
|
79
|
+
rectangle(0, 0, :max, :max, round: true) { # border drawn around max dimensions of parent
|
80
|
+
foreground foreground_color
|
81
|
+
line_width border_line_width
|
82
|
+
}
|
83
|
+
|
84
|
+
rectangle(:default, [:default, @font_height + (@font_height/2.0)], @font_height*5.5, @font_height*2.0, @font_height, @font_height, round: true) {
|
85
|
+
background background_color
|
86
|
+
|
87
|
+
text(BUTTON_TEXT_DEFAULT) {
|
88
|
+
foreground text_color
|
89
|
+
font text_font
|
90
|
+
}
|
91
|
+
|
92
|
+
on_mouse_up do
|
93
|
+
close
|
94
|
+
end
|
95
|
+
}
|
96
|
+
|
97
|
+
rectangle(:default, [:default, @font_height + (@font_height/2.0)], @font_height*5.5, @font_height*2.0, @font_height, @font_height, round: true) { # border
|
98
|
+
foreground foreground_color
|
99
|
+
line_width border_line_width
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
def close
|
105
|
+
async_exec do
|
106
|
+
unless @closed
|
107
|
+
@closed = true
|
108
|
+
@on_closed_handlers&.each {|handler| handler.call}
|
109
|
+
@on_closed_handlers&.clear
|
110
|
+
body_root.dispose
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Copyright (c) 2022 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
|
+
$LOAD_PATH.unshift(File.expand_path('..', __FILE__))
|
23
|
+
|
24
|
+
require 'glimmer-dsl-swt'
|
25
|
+
require 'glimmer/view/message_box_panel'
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# Copyright (c) 2022 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_relative '../../lib/glimmer-cp-messageboxpanel' # Use `require 'glimmer-cp-messageboxpanel'` if gem is installed
|
23
|
+
|
24
|
+
class HelloMessageBoxPanel
|
25
|
+
include Glimmer::UI::CustomShell
|
26
|
+
|
27
|
+
body {
|
28
|
+
shell {
|
29
|
+
text 'Hello, Message Box Panel!'
|
30
|
+
minimum_size 425, 200
|
31
|
+
|
32
|
+
@canvas = canvas {
|
33
|
+
background :white
|
34
|
+
|
35
|
+
first_message_box_panel
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
def first_message_box_panel
|
41
|
+
message_box_panel(message: 'Hello, Message Box Panel!', background_color: rgb(255, 255, 128), text_font: {height: 16}) {
|
42
|
+
on_closed do
|
43
|
+
@canvas.content { # re-open canvas content and add a message box panel
|
44
|
+
second_message_box_panel
|
45
|
+
}
|
46
|
+
end
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def second_message_box_panel
|
51
|
+
message_box_panel(message: "Message Box Panel is a graphical\nversion of the native Message Box", background_color: :cyan, text_font: {height: 16}, border_line_width: 3) {
|
52
|
+
on_closed do
|
53
|
+
@canvas.content { # re-open canvas content and add a message box panel
|
54
|
+
third_message_box_panel
|
55
|
+
}
|
56
|
+
end
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
def third_message_box_panel
|
61
|
+
message_box_panel(message: "It is a customizable alternative that can\n be used in Canvas-based applications", background_color: :yellow, foreground_color: :red, text_color: :dark_green, text_font: {height: 16, style: [:bold, :italic]}, border_line_width: 3) {
|
62
|
+
on_closed do
|
63
|
+
@canvas.content { # re-open canvas content and add a message box panel
|
64
|
+
fourth_message_box_panel
|
65
|
+
}
|
66
|
+
end
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
def fourth_message_box_panel
|
71
|
+
message_box_panel(message: 'Good bye, Message Box Panel!', background_color: :black, text_color: :white, text_font: {height: 16}) {
|
72
|
+
on_closed do
|
73
|
+
@canvas.content { # re-open canvas content and add a message box panel
|
74
|
+
first_message_box_panel
|
75
|
+
}
|
76
|
+
end
|
77
|
+
}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
HelloMessageBoxPanel.launch
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: glimmer-cp-messageboxpanel
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andy Maleh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-01-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '4.22'
|
19
|
+
name: glimmer-dsl-swt
|
20
|
+
prerelease: false
|
21
|
+
type: :runtime
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.22'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - '='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.3.2
|
33
|
+
name: psych
|
34
|
+
prerelease: false
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.3.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 3.5.0
|
47
|
+
name: rspec
|
48
|
+
prerelease: false
|
49
|
+
type: :development
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.5.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.4.9
|
61
|
+
name: juwelier
|
62
|
+
prerelease: false
|
63
|
+
type: :development
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.4.9
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - '='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 2.0.5
|
75
|
+
name: warbler
|
76
|
+
prerelease: false
|
77
|
+
type: :development
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.0.5
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
name: simplecov
|
90
|
+
prerelease: false
|
91
|
+
type: :development
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Message Box Panel - Glimmer DSL for SWT Custom Shape - message_box_panel
|
98
|
+
is a graphical alternative to the native SWT message_box
|
99
|
+
email: andy.am@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files:
|
103
|
+
- LICENSE.txt
|
104
|
+
- README.md
|
105
|
+
files:
|
106
|
+
- CHANGELOG.md
|
107
|
+
- LICENSE.txt
|
108
|
+
- README.md
|
109
|
+
- VERSION
|
110
|
+
- glimmer-cp-messageboxpanel.gemspec
|
111
|
+
- lib/glimmer-cp-messageboxpanel.rb
|
112
|
+
- lib/glimmer/view/message_box_panel.rb
|
113
|
+
- samples/message_box_panel/hello_message_box_panel.rb
|
114
|
+
homepage: http://github.com/AndyObtiva/glimmer-cp-messageboxpanel
|
115
|
+
licenses:
|
116
|
+
- MIT
|
117
|
+
metadata: {}
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubygems_version: 3.2.29
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: Message Box Panel - Glimmer Custom Shape
|
137
|
+
test_files: []
|