opine 0.0.5 → 0.0.6
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 +4 -4
- data/Gemfile +2 -3
- data/VERSION +1 -1
- data/lib/opine.rb +3 -0
- data/lib/opine/widgets/alert.rb +6 -5
- data/lib/opine/widgets/alert_osx.rb +11 -0
- data/lib/opine/widgets/alert_win.rb +12 -0
- data/lib/opine/widgets/application_win.rb +13 -0
- data/lib/opine/widgets/{window_dark.rb → window_dark_osx.rb} +0 -0
- data/lib/opine/widgets/window_win.rb +67 -0
- data/opine.gemspec +15 -7
- data/tasks/gemspec.rake +8 -0
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edf6056231dc3068f757d5ac3707b23cf57afdaa
|
4
|
+
data.tar.gz: 70b8103b8731f982b53cb0ca40eeacea08da07bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8171ac5d46348383e8aac5a1958be8f9bbec9205bfccacc36dad02a6e6b96d59c63dcda65ab1e645742b4dcf54f49579094661a35378fb19f62b5b00e15101c
|
7
|
+
data.tar.gz: ed430ccac3b83a0f9cfb37fcca8290936591150d8a76fad415b0f73e6b7ef74c43a418627d5289d24c5b66bb68d1198f55c5779bd312effec5e13f71c31af95c
|
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/lib/opine.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
|
2
2
|
require 'active_support/core_ext/module/delegation'
|
3
|
+
require 'active_support/inflector'
|
3
4
|
|
4
5
|
module Opine
|
5
6
|
def self.platform
|
@@ -17,6 +18,8 @@ end
|
|
17
18
|
case Opine.platform
|
18
19
|
when :osx
|
19
20
|
require 'cocoa'
|
21
|
+
when :win
|
22
|
+
require 'stench'
|
20
23
|
end
|
21
24
|
require 'cairo'
|
22
25
|
|
data/lib/opine/widgets/alert.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
class Opine::Alert < Opine::Widget
|
2
|
+
attr_accessor :application, :text
|
3
|
+
end
|
4
|
+
|
1
5
|
class Opine::Application
|
2
|
-
def alert
|
3
|
-
application
|
4
|
-
alert = Cocoa::NSAlert.alloc.init.autorelease
|
5
|
-
alert.setMessageText text
|
6
|
-
alert.runModal
|
6
|
+
def alert(text, options={}, &block)
|
7
|
+
"Opine::#{theme.to_s.camelize}::Alert".constantize.new(options.merge(:application => application, :text => text),&block)
|
7
8
|
end
|
8
9
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Opine::Native::Application < Opine::Application
|
2
|
+
def initialize(options,&block)
|
3
|
+
super
|
4
|
+
|
5
|
+
instance_eval(&block) if block
|
6
|
+
|
7
|
+
msg = Stench::WinBase::MSG.new
|
8
|
+
while Stench::WinBase::GetMessage(msg, Stench::WinBase::NULL, 0, 0) > 0
|
9
|
+
Stench::WinBase::TranslateMessage(msg)
|
10
|
+
Stench::WinBase::DispatchMessage(msg)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
File without changes
|
@@ -0,0 +1,67 @@
|
|
1
|
+
class Opine::Native::Window < Opine::Window
|
2
|
+
|
3
|
+
class Window
|
4
|
+
attr_accessor :widget
|
5
|
+
|
6
|
+
include Stench::WinBase
|
7
|
+
|
8
|
+
CLASS_NAME = "OpineWindow"
|
9
|
+
WINDOWS = []
|
10
|
+
|
11
|
+
def P(a); ::FFI::Pointer.new(a); end
|
12
|
+
|
13
|
+
def initialize(widget) #(title)
|
14
|
+
@widget = widget
|
15
|
+
|
16
|
+
@white = GetStockObject(WHITE_BRUSH)
|
17
|
+
|
18
|
+
@wc = WNDCLASSEX.new
|
19
|
+
@wc[:lpfnWndProc] = method(:window_proc)
|
20
|
+
@wc[:hInstance] = Stench::HINST
|
21
|
+
@wc[:hIcon] = LoadImage(NULL, P(IDI_APPLICATION), IMAGE_ICON, 0, 0, LR_SHARED)
|
22
|
+
@wc[:hCursor] = LoadImage(NULL, P(IDC_ARROW), IMAGE_CURSOR, 0, 0, LR_SHARED)
|
23
|
+
@wc[:hbrBackground] = @white
|
24
|
+
@wc[:lpszClassName] = FFI::MemoryPointer.from_string("#{CLASS_NAME}:#{__id__}")
|
25
|
+
@wc[:hIconSm] = LoadImage(NULL, P(IDI_APPLICATION), IMAGE_ICON, 0, 0, LR_SHARED);
|
26
|
+
|
27
|
+
@hwnd = CreateWindowEx(
|
28
|
+
WS_EX_LEFT, P(@wc.atom), title, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
29
|
+
CW_USEDEFAULT, CW_USEDEFAULT, width, height, NULL, NULL, Stench::HINST, nil)
|
30
|
+
|
31
|
+
raise "CreateWindowEx Error" if @hwnd == 0
|
32
|
+
WINDOWS << self
|
33
|
+
end
|
34
|
+
|
35
|
+
def window_proc(hwnd, umsg, wparam, lparam)
|
36
|
+
case umsg
|
37
|
+
when WM_DESTROY
|
38
|
+
@hwnd = nil
|
39
|
+
WINDOWS.delete(self)
|
40
|
+
PostQuitMessage(0) if WINDOWS.empty?
|
41
|
+
return 0
|
42
|
+
else
|
43
|
+
return DefWindowProc(hwnd, umsg, wparam, lparam)
|
44
|
+
end
|
45
|
+
0
|
46
|
+
end
|
47
|
+
|
48
|
+
def hwnd
|
49
|
+
@hwnd ? (IsWindow(@hwnd).nonzero? ? @hwnd : (@hwnd = nil)) : nil
|
50
|
+
end
|
51
|
+
|
52
|
+
def close
|
53
|
+
DestroyWindow(@hwnd) if hwnd
|
54
|
+
end
|
55
|
+
|
56
|
+
def method_missing method,*args
|
57
|
+
widget.send(method,*args)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def initialize(options,&block)
|
62
|
+
super
|
63
|
+
|
64
|
+
@window = Window.new(self)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
data/opine.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: opine 0.0.
|
5
|
+
# stub: opine 0.0.6 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "opine"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.6"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Patrick Hanevold"]
|
14
|
-
s.date = "2014-04-
|
14
|
+
s.date = "2014-04-14"
|
15
15
|
s.description = "A ruby widget toolkit for everyone and every computer"
|
16
16
|
s.email = "patrick.hanevold@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -32,14 +32,18 @@ Gem::Specification.new do |s|
|
|
32
32
|
"lib/opine/rect.rb",
|
33
33
|
"lib/opine/widget.rb",
|
34
34
|
"lib/opine/widgets/alert.rb",
|
35
|
+
"lib/opine/widgets/alert_osx.rb",
|
36
|
+
"lib/opine/widgets/alert_win.rb",
|
35
37
|
"lib/opine/widgets/application.rb",
|
36
38
|
"lib/opine/widgets/application_osx.rb",
|
39
|
+
"lib/opine/widgets/application_win.rb",
|
37
40
|
"lib/opine/widgets/table.rb",
|
38
41
|
"lib/opine/widgets/table_osx.rb",
|
39
42
|
"lib/opine/widgets/view_osx.rb",
|
40
43
|
"lib/opine/widgets/window.rb",
|
41
|
-
"lib/opine/widgets/
|
44
|
+
"lib/opine/widgets/window_dark_osx.rb",
|
42
45
|
"lib/opine/widgets/window_osx.rb",
|
46
|
+
"lib/opine/widgets/window_win.rb",
|
43
47
|
"opine.gemspec",
|
44
48
|
"spec/opine/opine_spec.rb",
|
45
49
|
"spec/opine/widgets/application_spec.rb",
|
@@ -47,6 +51,7 @@ Gem::Specification.new do |s|
|
|
47
51
|
"spec/opine/widgets/window_spec.rb",
|
48
52
|
"spec/spec_helper.rb",
|
49
53
|
"tasks/bacon.rake",
|
54
|
+
"tasks/gemspec.rake",
|
50
55
|
"tasks/setup.rake"
|
51
56
|
]
|
52
57
|
s.homepage = "http://github.com/patrickhno/opine"
|
@@ -58,7 +63,8 @@ Gem::Specification.new do |s|
|
|
58
63
|
s.specification_version = 4
|
59
64
|
|
60
65
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
61
|
-
s.add_runtime_dependency(%q<cocoa>, [">= 0.1.6"])
|
66
|
+
s.add_runtime_dependency(%q<cocoa>, [">= 0.1.6"]) if RUBY_PLATFORM =~ /darwin/
|
67
|
+
s.add_runtime_dependency(%q<stench>, [">= 0.0.1"]) if RUBY_PLATFORM =~ /cygwin|mingw|mswin|windows/
|
62
68
|
s.add_runtime_dependency(%q<cairo>, [">= 0"])
|
63
69
|
s.add_runtime_dependency(%q<activesupport>, ["~> 4.0"])
|
64
70
|
s.add_development_dependency(%q<opine>, [">= 0"])
|
@@ -72,7 +78,8 @@ Gem::Specification.new do |s|
|
|
72
78
|
s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
|
73
79
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
74
80
|
else
|
75
|
-
s.add_dependency(%q<cocoa>, [">= 0.1.6"])
|
81
|
+
s.add_dependency(%q<cocoa>, [">= 0.1.6"]) if RUBY_PLATFORM =~ /darwin/
|
82
|
+
s.add_dependency(%q<stench>, [">= 0.0.1"]) if RUBY_PLATFORM =~ /cygwin|mingw|mswin|windows/
|
76
83
|
s.add_dependency(%q<cairo>, [">= 0"])
|
77
84
|
s.add_dependency(%q<activesupport>, ["~> 4.0"])
|
78
85
|
s.add_dependency(%q<opine>, [">= 0"])
|
@@ -87,7 +94,8 @@ Gem::Specification.new do |s|
|
|
87
94
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
88
95
|
end
|
89
96
|
else
|
90
|
-
s.add_dependency(%q<cocoa>, [">= 0.1.6"])
|
97
|
+
s.add_dependency(%q<cocoa>, [">= 0.1.6"]) if RUBY_PLATFORM =~ /darwin/
|
98
|
+
s.add_dependency(%q<stench>, [">= 0.0.1"]) if RUBY_PLATFORM =~ /cygwin|mingw|mswin|windows/
|
91
99
|
s.add_dependency(%q<cairo>, [">= 0"])
|
92
100
|
s.add_dependency(%q<activesupport>, ["~> 4.0"])
|
93
101
|
s.add_dependency(%q<opine>, [">= 0"])
|
data/tasks/gemspec.rake
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
|
2
|
+
Rake::Task["gemspec"].enhance do
|
3
|
+
spec = "opine.gemspec"
|
4
|
+
text = File.read(spec)
|
5
|
+
text.gsub!(/^(.*<cocoa>.*)$/, '\1 if RUBY_PLATFORM =~ /darwin/')
|
6
|
+
text.gsub!(/^(.*<stench>.*)$/, '\1 if RUBY_PLATFORM =~ /cygwin|mingw|mswin|windows/')
|
7
|
+
File.open(spec, 'w') { |file| file.write(text) }
|
8
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Hanevold
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoa
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.1.6
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: stench
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.0.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.0.1
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: cairo
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -213,14 +227,18 @@ files:
|
|
213
227
|
- lib/opine/rect.rb
|
214
228
|
- lib/opine/widget.rb
|
215
229
|
- lib/opine/widgets/alert.rb
|
230
|
+
- lib/opine/widgets/alert_osx.rb
|
231
|
+
- lib/opine/widgets/alert_win.rb
|
216
232
|
- lib/opine/widgets/application.rb
|
217
233
|
- lib/opine/widgets/application_osx.rb
|
234
|
+
- lib/opine/widgets/application_win.rb
|
218
235
|
- lib/opine/widgets/table.rb
|
219
236
|
- lib/opine/widgets/table_osx.rb
|
220
237
|
- lib/opine/widgets/view_osx.rb
|
221
238
|
- lib/opine/widgets/window.rb
|
222
|
-
- lib/opine/widgets/
|
239
|
+
- lib/opine/widgets/window_dark_osx.rb
|
223
240
|
- lib/opine/widgets/window_osx.rb
|
241
|
+
- lib/opine/widgets/window_win.rb
|
224
242
|
- opine.gemspec
|
225
243
|
- spec/opine/opine_spec.rb
|
226
244
|
- spec/opine/widgets/application_spec.rb
|
@@ -228,6 +246,7 @@ files:
|
|
228
246
|
- spec/opine/widgets/window_spec.rb
|
229
247
|
- spec/spec_helper.rb
|
230
248
|
- tasks/bacon.rake
|
249
|
+
- tasks/gemspec.rake
|
231
250
|
- tasks/setup.rake
|
232
251
|
homepage: http://github.com/patrickhno/opine
|
233
252
|
licenses:
|