fzeet 0.6.7 → 0.7.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.
Files changed (59) hide show
  1. checksums.yaml +5 -13
  2. data/LICENSE +1 -1
  3. data/README.md +33 -1
  4. data/RELNOTES.md +4 -0
  5. data/examples/Control/Button.rbw +1 -1
  6. data/examples/Control/WebBrowser/jQueryUI.html +3 -17
  7. data/examples/Menu/ContextMenu.rbw +1 -1
  8. data/examples/Raw/Command.rbw +19 -0
  9. data/examples/Raw/Hello.rbw +19 -0
  10. data/examples/Raw/LifeCycle.rbw +19 -0
  11. data/examples/Raw/Minimal.rbw +19 -0
  12. data/lib/fzeet.rb +19 -6
  13. data/lib/fzeet/windows.rb +19 -0
  14. data/lib/fzeet/windows/com/Common.rb +4 -3
  15. data/lib/fzeet/windows/comctl.rb +19 -0
  16. data/lib/fzeet/windows/comctl/Button.rb +19 -0
  17. data/lib/fzeet/windows/comctl/ComboBox.rb +19 -0
  18. data/lib/fzeet/windows/comctl/ComboBoxEx.rb +19 -0
  19. data/lib/fzeet/windows/comctl/Common.rb +19 -0
  20. data/lib/fzeet/windows/comctl/DateTimePicker.rb +19 -0
  21. data/lib/fzeet/windows/comctl/Edit.rb +19 -0
  22. data/lib/fzeet/windows/comctl/Header.rb +21 -2
  23. data/lib/fzeet/windows/comctl/ListView.rb +23 -4
  24. data/lib/fzeet/windows/comctl/MonthCalendar.rb +19 -0
  25. data/lib/fzeet/windows/comctl/ProgressBar.rb +19 -0
  26. data/lib/fzeet/windows/comctl/PropertySheet.rb +21 -2
  27. data/lib/fzeet/windows/comctl/SysLink.rb +19 -0
  28. data/lib/fzeet/windows/comctl/Tab.rb +19 -0
  29. data/lib/fzeet/windows/comctl/TreeView.rb +21 -2
  30. data/lib/fzeet/windows/comctl/UpDown.rb +19 -0
  31. data/lib/fzeet/windows/comdlg.rb +19 -0
  32. data/lib/fzeet/windows/comdlg/ColorDialog.rb +19 -0
  33. data/lib/fzeet/windows/comdlg/Common.rb +19 -0
  34. data/lib/fzeet/windows/comdlg/FileDialog.rb +20 -1
  35. data/lib/fzeet/windows/comdlg/FindReplaceDialog.rb +19 -0
  36. data/lib/fzeet/windows/comdlg/FontDialog.rb +19 -0
  37. data/lib/fzeet/windows/comdlg/PrintDialog.rb +19 -0
  38. data/lib/fzeet/windows/comdlg/ShellFileDialog.rb +19 -0
  39. data/lib/fzeet/windows/core/Common.rb +1 -1
  40. data/lib/fzeet/windows/scintilla.rb +19 -0
  41. data/lib/fzeet/windows/shell.rb +19 -0
  42. data/lib/fzeet/windows/shell/BrowseForFolder.rb +19 -0
  43. data/lib/fzeet/windows/shell/Common.rb +19 -0
  44. data/lib/fzeet/windows/shell/FileDialog.rb +19 -0
  45. data/lib/fzeet/windows/uiribbon.rb +19 -0
  46. data/lib/fzeet/windows/user.rb +19 -0
  47. data/lib/fzeet/windows/user/Control.rb +19 -0
  48. data/lib/fzeet/windows/user/Control/ComboBox.rb +19 -0
  49. data/lib/fzeet/windows/user/Control/ListBox.rb +21 -2
  50. data/lib/fzeet/windows/user/SystemParametersInfo.rb +2 -2
  51. data/lib/fzeet/windows/user/Window.rb +19 -0
  52. data/lib/fzeet/windows/user/Window/Common.rb +19 -0
  53. data/lib/fzeet/windows/user/Window/Container.rb +19 -0
  54. data/lib/fzeet/windows/user/Window/Dialog.rb +19 -0
  55. data/lib/fzeet/windows/user/Window/MDI.rb +19 -0
  56. data/lib/fzeet/windows/user/Window/View.rb +19 -0
  57. data/lib/fzeet/windows/user/Window/Window.rb +19 -0
  58. data/lib/fzeet/windows/user/Window/WindowMethods.rb +1 -1
  59. metadata +9 -9
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MGM1NjUwNmIyNWVlOTQyMjE2MjdmNTIzYmIzYWQ0ZTUxOGNmOThlMQ==
5
- data.tar.gz: !binary |-
6
- NTRmZDhlMzY5OTgxYThjOWFmODQzYTc2NTk1MmViZDkzMDlkYzFkYQ==
2
+ SHA1:
3
+ metadata.gz: 5df0ce12171c265bfb86d255ae7bc2e40140500f
4
+ data.tar.gz: 7217069cca2a8c17b672525413048889ee5f202c
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YzBjOWE1ZDM4MmVjYWQ1NzJiMmRmMDk5MDkzNTJmMTZiOWQ0MGQxMGRhNzUx
10
- NzdhYWU3NmFjMjdiYjY0MTQ5OGE1NjkzMTllNWNlZjQ5MGQxMmRlMDMxOTQy
11
- NDE1ZDhlNjJiNzEwNjZiYThjMTdlZDExOThlYWM2MjVhODNlZWQ=
12
- data.tar.gz: !binary |-
13
- NzgzMzIxNTRkMTg5NTYzNzI3N2FlZTgyZmY1Njg4MGUwYjBlODkxMDczYzdk
14
- NTE5MTc2ZTgyNWZlYzAwN2RjMWI0ZDE2YTc3ZTU3ZDRlMjdkMDA4NmEzODA2
15
- NDUxOTkxNjMzY2M3Yjg3MzFhODM2MzgzNmMxMGZkNWE4NmVkMTE=
6
+ metadata.gz: 1be673c897d2994791643ea4a168e0d4a3f4610a73002a44ffb40e975c9a794cfd38cd914e168192cbaedace399c2131ba8caf790c4f95306a61f72910a2c011
7
+ data.tar.gz: 59bc5eca31c720a41ae486bb4d3dc6d71be7b67f696c06e13b110898a269a570ba6429eadfbc1f7935d225a1b73e6bf54f38233d8d2ec1df0ed14c2b3e3cc512
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2017 Radoslav Peev
3
+ Copyright (c) 2017 Radoslav Peev <rpeev@ymail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,9 +1,34 @@
1
1
  # fzeet
2
2
 
3
- Ruby-FFI (x86) bindings to (and rubyesque APIs on top) GUI/COM-related Windows APIs
3
+ Ruby FFI (x86) bindings to (and rubyesque APIs on top) GUI/COM related Windows APIs
4
4
 
5
5
  ![Screenshot](./screenshot.png)
6
6
 
7
+ ```ruby
8
+ require 'fzeet'
9
+
10
+ include Fzeet
11
+
12
+ Application.run(View.new) { |window|
13
+ UIRibbon.new(window).
14
+ on(CmdButton1) { message 'on(CmdButton1)' }.
15
+ on(CmdSplit1) { message 'on(CmdSplit1)' }.
16
+ on(CmdToggle1) { window.ribbon[CmdCheck1].toggle(:checked) }.
17
+ on(CmdCheck1) { window.ribbon[CmdToggle1].toggle(:checked) }.
18
+
19
+ on(CmdHelp) { message 'on(CmdHelp)' }
20
+
21
+ window.ribbon[CmdToggle1].checked = true
22
+
23
+ window.
24
+ on(:draw, Control::Font) { |dc| dc.sms 'Right-click (or menu key) for context menu' }.
25
+
26
+ on(:contextmenu) { |args|
27
+ window.ribbon.contextualUI(CmdContextMap1, args[:x], args[:y])
28
+ }
29
+ }
30
+ ```
31
+
7
32
  ## Install
8
33
 
9
34
  gem install fzeet
@@ -11,3 +36,10 @@ gem install fzeet
11
36
  ## Use
12
37
 
13
38
  See examples folder
39
+
40
+ ## Issues
41
+
42
+ - uses the ANSI versions of Windows bindings
43
+ - declares DPI awareness, but the examples use pixel coordinates
44
+ - uses _id2ref, so passing -X+O to jrubyw is required when running with JRuby
45
+ - Windows version identification is outdated
data/RELNOTES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release Notes
2
2
 
3
+ ## 0.7.0
4
+
5
+ Fixes to ensure the library works with recent Ruby and FFI
6
+
3
7
  ## 0.6.7
4
8
 
5
9
  Recover source from gem
@@ -24,7 +24,7 @@ Application.run { |window| window.dialog = true
24
24
  window[:button2].on(:doubleclicked) { message 'on(:command, :button2, :doubleclicked)' }
25
25
  window[:button3].
26
26
  on(:clicked) { message 'on(:command, :button3, :clicked)' }.
27
- on(:dropdown) { |args| using(
27
+ on(:dropdown) { |args| Fzeet.using(
28
28
  PopupMenu.new.
29
29
  append(:string, 'Item&1', :item1)
30
30
  ) { |popup|
@@ -3,38 +3,24 @@
3
3
  <head>
4
4
  <title>jQueryUI</title>
5
5
 
6
- <link rel='stylesheet' href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css' />
6
+ <link rel='stylesheet' href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/base/jquery-ui.css' />
7
7
 
8
8
  <style>
9
9
  * {
10
10
  font-size: small;
11
11
  }
12
-
13
- #themeswitcher {
14
- float: right;
15
- }
16
-
17
- #tabs {
18
- clear: both;
19
- }
20
12
  </style>
21
13
 
22
- <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'></script>
23
- <script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js'></script>
24
-
25
- <script src='http://jqueryui.com/themeroller/themeswitchertool/'></script>
14
+ <script src='http://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
15
+ <script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js'></script>
26
16
 
27
17
  <script>
28
18
  jQuery(function (j) {
29
- j('#themeswitcher').themeswitcher({width: 250, height: 600, closeOnSelect: false});
30
-
31
19
  j('#tabs').tabs();
32
20
  });
33
21
  </script>
34
22
  </head>
35
23
  <body>
36
- <div id='themeswitcher'></div>
37
-
38
24
  <div id='tabs'>
39
25
  <ul>
40
26
  <li><a id='tab1' href='#page1'>tab1</a></li>
@@ -6,7 +6,7 @@ Application.run(View.new) { |window|
6
6
  window.
7
7
  on(:draw, Control::Font) { |dc| dc.sms 'Right-click (or menu key) for context menu' }.
8
8
 
9
- on(:contextmenu) { |args| using(
9
+ on(:contextmenu) { |args| Fzeet.using(
10
10
  PopupMenu.new.
11
11
  append(:string, 'Item&1', :item1)
12
12
  ) { |popup|
@@ -1,3 +1,22 @@
1
+ if __FILE__ == $0
2
+ require 'ffi'
3
+
4
+ # FIXME: dirty fix to propagate FFI structs layout down the inheritance hierarchy
5
+ # TODO: switch to composition instead inheriting FFI structs
6
+ module PropagateFFIStructLayout
7
+ def inherited(child_class)
8
+ child_class.instance_variable_set '@layout', layout
9
+ end
10
+ end
11
+
12
+ class FFI::Struct
13
+ def self.inherited(child_class)
14
+ child_class.extend PropagateFFIStructLayout
15
+ end
16
+ end
17
+ # END FIXME
18
+ end
19
+
1
20
  require 'fzeet/windows'
2
21
 
3
22
  include Fzeet::Windows
@@ -1,3 +1,22 @@
1
+ if __FILE__ == $0
2
+ require 'ffi'
3
+
4
+ # FIXME: dirty fix to propagate FFI structs layout down the inheritance hierarchy
5
+ # TODO: switch to composition instead inheriting FFI structs
6
+ module PropagateFFIStructLayout
7
+ def inherited(child_class)
8
+ child_class.instance_variable_set '@layout', layout
9
+ end
10
+ end
11
+
12
+ class FFI::Struct
13
+ def self.inherited(child_class)
14
+ child_class.extend PropagateFFIStructLayout
15
+ end
16
+ end
17
+ # END FIXME
18
+ end
19
+
1
20
  require 'fzeet/windows'
2
21
 
3
22
  include Fzeet::Windows
@@ -1,3 +1,22 @@
1
+ if __FILE__ == $0
2
+ require 'ffi'
3
+
4
+ # FIXME: dirty fix to propagate FFI structs layout down the inheritance hierarchy
5
+ # TODO: switch to composition instead inheriting FFI structs
6
+ module PropagateFFIStructLayout
7
+ def inherited(child_class)
8
+ child_class.instance_variable_set '@layout', layout
9
+ end
10
+ end
11
+
12
+ class FFI::Struct
13
+ def self.inherited(child_class)
14
+ child_class.extend PropagateFFIStructLayout
15
+ end
16
+ end
17
+ # END FIXME
18
+ end
19
+
1
20
  require 'fzeet/windows'
2
21
 
3
22
  include Fzeet::Windows
@@ -1,3 +1,22 @@
1
+ if __FILE__ == $0
2
+ require 'ffi'
3
+
4
+ # FIXME: dirty fix to propagate FFI structs layout down the inheritance hierarchy
5
+ # TODO: switch to composition instead inheriting FFI structs
6
+ module PropagateFFIStructLayout
7
+ def inherited(child_class)
8
+ child_class.instance_variable_set '@layout', layout
9
+ end
10
+ end
11
+
12
+ class FFI::Struct
13
+ def self.inherited(child_class)
14
+ child_class.extend PropagateFFIStructLayout
15
+ end
16
+ end
17
+ # END FIXME
18
+ end
19
+
1
20
  require 'fzeet/windows'
2
21
 
3
22
  include Fzeet::Windows
data/lib/fzeet.rb CHANGED
@@ -1,8 +1,25 @@
1
+ require 'ffi'
2
+
3
+ # FIXME: dirty fix to propagate FFI structs layout down the inheritance hierarchy
4
+ # TODO: switch to composition instead inheriting FFI structs
5
+ module PropagateFFIStructLayout
6
+ def inherited(child_class)
7
+ child_class.instance_variable_set '@layout', layout
8
+ end
9
+ end
10
+
11
+ class FFI::Struct
12
+ def self.inherited(child_class)
13
+ child_class.extend PropagateFFIStructLayout
14
+ end
15
+ end
16
+ # END FIXME
17
+
1
18
  require_relative 'fzeet/windows'
2
19
 
3
- module Fzeet
4
- VERSION = '0.6.7'
20
+ FZEET_VERSION = '0.7.0'
5
21
 
22
+ module Fzeet
6
23
  module Windows
7
24
  DetonateLastError(0, :InitCommonControlsEx,
8
25
  INITCOMMONCONTROLSEX.new.tap { |icc|
@@ -24,7 +41,3 @@ module Fzeet
24
41
  InitializeOle()
25
42
  end
26
43
  end
27
-
28
- if __FILE__ == $0
29
- puts Fzeet::VERSION
30
- end
data/lib/fzeet/windows.rb CHANGED
@@ -1,3 +1,22 @@
1
+ if __FILE__ == $0
2
+ require 'ffi'
3
+
4
+ # FIXME: dirty fix to propagate FFI structs layout down the inheritance hierarchy
5
+ # TODO: switch to composition instead inheriting FFI structs
6
+ module PropagateFFIStructLayout
7
+ def inherited(child_class)
8
+ child_class.instance_variable_set '@layout', layout
9
+ end
10
+ end
11
+
12
+ class FFI::Struct
13
+ def self.inherited(child_class)
14
+ child_class.extend PropagateFFIStructLayout
15
+ end
16
+ end
17
+ # END FIXME
18
+ end
19
+
1
20
  require_relative 'windows/libc'
2
21
 
3
22
  require_relative 'windows/kernel'
@@ -109,8 +109,9 @@ module Fzeet
109
109
  const_set(:VTBL, Class.new(FFI::Struct) {
110
110
  const_set(:SPEC, Hash[(ifaces.map { |iface| iface::VTBL::SPEC.to_a } << spec.to_a).flatten(1)])
111
111
 
112
- layout \
112
+ layout(
113
113
  *self::SPEC.map { |name, signature| [name, callback(*signature)] }.flatten
114
+ )
114
115
  })
115
116
 
116
117
  layout \
@@ -159,7 +160,7 @@ module Fzeet
159
160
  send(:include, Helpers)
160
161
 
161
162
  def initialize(pointer)
162
- self.pointer = pointer
163
+ super(pointer)
163
164
 
164
165
  @vtbl = self.class::VTBL.new(self[:lpVtbl])
165
166
  end
@@ -191,7 +192,7 @@ module Fzeet
191
192
  raise "CoCreateInstance failed (#{self.class})." if
192
193
  Windows.FAILED(Windows.CoCreateInstance(self.class::CLSID, nil, @opts[:clsctx], self.class::IID, ppv))
193
194
 
194
- self.pointer = ppv.read_pointer
195
+ super(ppv.read_pointer)
195
196
  }
196
197
 
197
198
  @vtbl = self.class::VTBL.new(self[:lpVtbl])
@@ -1,3 +1,22 @@
1
+ if __FILE__ == $0
2
+ require 'ffi'
3
+
4
+ # FIXME: dirty fix to propagate FFI structs layout down the inheritance hierarchy
5
+ # TODO: switch to composition instead inheriting FFI structs
6
+ module PropagateFFIStructLayout
7
+ def inherited(child_class)
8
+ child_class.instance_variable_set '@layout', layout
9
+ end
10
+ end
11
+
12
+ class FFI::Struct
13
+ def self.inherited(child_class)
14
+ child_class.extend PropagateFFIStructLayout
15
+ end
16
+ end
17
+ # END FIXME
18
+ end
19
+
1
20
  require_relative 'comctl/Button'
2
21
  require_relative 'comctl/SysLink' if Fzeet::Windows::Version >= :xp
3
22
  require_relative 'comctl/Edit'
@@ -1,3 +1,22 @@
1
+ if __FILE__ == $0
2
+ require 'ffi'
3
+
4
+ # FIXME: dirty fix to propagate FFI structs layout down the inheritance hierarchy
5
+ # TODO: switch to composition instead inheriting FFI structs
6
+ module PropagateFFIStructLayout
7
+ def inherited(child_class)
8
+ child_class.instance_variable_set '@layout', layout
9
+ end
10
+ end
11
+
12
+ class FFI::Struct
13
+ def self.inherited(child_class)
14
+ child_class.extend PropagateFFIStructLayout
15
+ end
16
+ end
17
+ # END FIXME
18
+ end
19
+
1
20
  require_relative 'Common'
2
21
 
3
22
  module Fzeet
@@ -1,3 +1,22 @@
1
+ if __FILE__ == $0
2
+ require 'ffi'
3
+
4
+ # FIXME: dirty fix to propagate FFI structs layout down the inheritance hierarchy
5
+ # TODO: switch to composition instead inheriting FFI structs
6
+ module PropagateFFIStructLayout
7
+ def inherited(child_class)
8
+ child_class.instance_variable_set '@layout', layout
9
+ end
10
+ end
11
+
12
+ class FFI::Struct
13
+ def self.inherited(child_class)
14
+ child_class.extend PropagateFFIStructLayout
15
+ end
16
+ end
17
+ # END FIXME
18
+ end
19
+
1
20
  require_relative 'Common'
2
21
 
3
22
  module Fzeet
@@ -1,3 +1,22 @@
1
+ if __FILE__ == $0
2
+ require 'ffi'
3
+
4
+ # FIXME: dirty fix to propagate FFI structs layout down the inheritance hierarchy
5
+ # TODO: switch to composition instead inheriting FFI structs
6
+ module PropagateFFIStructLayout
7
+ def inherited(child_class)
8
+ child_class.instance_variable_set '@layout', layout
9
+ end
10
+ end
11
+
12
+ class FFI::Struct
13
+ def self.inherited(child_class)
14
+ child_class.extend PropagateFFIStructLayout
15
+ end
16
+ end
17
+ # END FIXME
18
+ end
19
+
1
20
  require_relative 'Common'
2
21
 
3
22
  module Fzeet
@@ -1,3 +1,22 @@
1
+ if __FILE__ == $0
2
+ require 'ffi'
3
+
4
+ # FIXME: dirty fix to propagate FFI structs layout down the inheritance hierarchy
5
+ # TODO: switch to composition instead inheriting FFI structs
6
+ module PropagateFFIStructLayout
7
+ def inherited(child_class)
8
+ child_class.instance_variable_set '@layout', layout
9
+ end
10
+ end
11
+
12
+ class FFI::Struct
13
+ def self.inherited(child_class)
14
+ child_class.extend PropagateFFIStructLayout
15
+ end
16
+ end
17
+ # END FIXME
18
+ end
19
+
1
20
  require_relative '../user'
2
21
 
3
22
  module Fzeet