fzeet 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/examples/Dialog/ColorDialog.rbw +21 -0
  2. data/examples/Dialog/FileDialog.rbw +47 -0
  3. data/examples/Dialog/FindReplaceDialog.rbw +38 -0
  4. data/examples/Dialog/FontDialog.rbw +33 -0
  5. data/examples/Dialog/PrintDialog.rbw +31 -0
  6. data/examples/Dialog/ShellFileDialog.rbw +43 -0
  7. data/examples/Version.rbw +5 -1
  8. data/lib/fzeet/Common.rb +6 -1
  9. data/lib/fzeet/Dialog/ColorDialog.rb +44 -0
  10. data/lib/fzeet/Dialog/Common.rb +84 -0
  11. data/lib/fzeet/Dialog/FileDialog.rb +83 -27
  12. data/lib/fzeet/Dialog/FindReplaceDialog.rb +105 -0
  13. data/lib/fzeet/Dialog/FontDialog.rb +39 -0
  14. data/lib/fzeet/Dialog/PrintDialog.rb +75 -0
  15. data/lib/fzeet/Dialog/ShellFileDialog.rb +133 -0
  16. data/lib/fzeet/Dialog.rb +5 -1
  17. data/lib/fzeet/windows/com.rb +16 -1
  18. data/lib/fzeet/windows/comdlg/ColorDialog.rb +34 -0
  19. data/lib/fzeet/windows/comdlg/Common.rb +37 -1
  20. data/lib/fzeet/windows/comdlg/FileDialog.rb +37 -0
  21. data/lib/fzeet/windows/comdlg/FindReplaceDialog.rb +50 -0
  22. data/lib/fzeet/windows/comdlg/FontDialog.rb +78 -0
  23. data/lib/fzeet/windows/comdlg/PrintDialog.rb +198 -0
  24. data/lib/fzeet/windows/comdlg.rb +4 -0
  25. data/lib/fzeet/windows/gdi.rb +3 -0
  26. data/lib/fzeet/windows/shell/{FolderDialog.rb → BrowseForFolder.rb} +11 -0
  27. data/lib/fzeet/windows/shell/Common.rb +56 -0
  28. data/lib/fzeet/windows/shell/FileDialog.rb +78 -0
  29. data/lib/fzeet/windows/shell.rb +2 -1
  30. data/lib/fzeet/windows/user/Message.rb +1 -0
  31. data/lib/fzeet/windows.rb +1 -0
  32. metadata +24 -6
  33. data/examples/Dialog/FileAndFolderDialog.rbw +0 -34
  34. data/lib/fzeet/Dialog/FolderDialog.rb +0 -45
@@ -1 +1,5 @@
1
1
  require_relative 'comdlg/FileDialog'
2
+ require_relative 'comdlg/FontDialog'
3
+ require_relative 'comdlg/ColorDialog'
4
+ require_relative 'comdlg/FindReplaceDialog'
5
+ require_relative 'comdlg/PrintDialog'
@@ -43,6 +43,9 @@ module Fzeet
43
43
 
44
44
  attach_function :SelectObject, [:pointer, :pointer], :pointer
45
45
 
46
+ attach_function :GetTextColor, [:pointer], :ulong
47
+ attach_function :SetTextColor, [:pointer, :ulong], :ulong
48
+
46
49
  attach_function :MoveToEx, [:pointer, :int, :int, :pointer], :int
47
50
  attach_function :LineTo, [:pointer, :int, :int], :int
48
51
  end
@@ -35,5 +35,16 @@ module Fzeet
35
35
  end
36
36
 
37
37
  attach_function :SHBrowseForFolder, :SHBrowseForFolderA, [:pointer], :pointer
38
+
39
+ BFFM_INITIALIZED = 1
40
+ BFFM_SELCHANGED = 2
41
+ BFFM_VALIDATEFAILED = 3
42
+ BFFM_IUNKNOWN = 5
43
+
44
+ BFFM_SETSTATUSTEXT = WM_USER + 100
45
+ BFFM_ENABLEOK = WM_USER + 101
46
+ BFFM_SETSELECTION = WM_USER + 102
47
+ BFFM_SETOKTEXT = WM_USER + 105
48
+ BFFM_SETEXPANDED = WM_USER + 106
38
49
  end
39
50
  end
@@ -1,3 +1,4 @@
1
+ require_relative '../user'
1
2
  require_relative '../com'
2
3
 
3
4
  module Fzeet
@@ -8,5 +9,60 @@ module Fzeet
8
9
  attach_function :ShellExecute, :ShellExecuteA, [:pointer, :string, :string, :string, :string, :int], :pointer
9
10
 
10
11
  attach_function :SHGetPathFromIDList, :SHGetPathFromIDListA, [:pointer, :pointer], :int
12
+
13
+ SIGDN_NORMALDISPLAY = 0x00000000
14
+ SIGDN_PARENTRELATIVEPARSING = 0x80018001
15
+ SIGDN_DESKTOPABSOLUTEPARSING = 0x80028000
16
+ SIGDN_PARENTRELATIVEEDITING = 0x80031001
17
+ SIGDN_DESKTOPABSOLUTEEDITING = 0x8004c000
18
+ SIGDN_FILESYSPATH = 0x80058000
19
+ SIGDN_URL = 0x80068000
20
+ SIGDN_PARENTRELATIVEFORADDRESSBAR = 0x8007c001
21
+ SIGDN_PARENTRELATIVE = 0x80080001
22
+
23
+ SICHINT_DISPLAY = 0x00000000
24
+ SICHINT_ALLFIELDS = 0x80000000
25
+ SICHINT_CANONICAL = 0x10000000
26
+ SICHINT_TEST_FILESYSPATH_IF_NOT_EQUAL = 0x20000000
27
+
28
+ IShellItem = COM::Interface[IUnknown,
29
+ GUID['43826d1e-e718-42ee-bc55-a1e261c37bfe'],
30
+
31
+ BindToHandler: [[:pointer, :pointer, :pointer, :pointer], :long],
32
+ GetParent: [[:pointer], :long],
33
+ GetDisplayName: [[:ulong, :pointer], :long],
34
+ GetAttributes: [[:ulong, :pointer], :long],
35
+ Compare: [[:pointer, :ulong, :pointer], :long]
36
+ ]
37
+
38
+ ShellItem = COM::Instance[IShellItem]
39
+
40
+ SIATTRIBFLAGS_AND = 0x00000001
41
+ SIATTRIBFLAGS_OR = 0x00000002
42
+ SIATTRIBFLAGS_APPCOMPAT = 0x00000003
43
+ SIATTRIBFLAGS_MASK = 0x00000003
44
+ SIATTRIBFLAGS_ALLITEMS = 0x00004000
45
+
46
+ IShellItemArray = COM::Interface[IUnknown,
47
+ GUID['b63ea76d-1f85-456f-a19c-48159efa858b'],
48
+
49
+ BindToHandler: [[:pointer, :pointer, :pointer, :pointer], :long],
50
+ GetPropertyStore: [[:ulong, :pointer, :pointer], :long],
51
+ GetPropertyDescriptionList: [[:pointer, :pointer, :pointer], :long],
52
+ GetAttributes: [[:ulong, :ulong, :pointer], :long],
53
+ GetCount: [[:pointer], :long],
54
+ GetItemAt: [[:ulong, :pointer], :long],
55
+ EnumItems: [[:pointer], :long]
56
+ ]
57
+
58
+ ShellItemArray = COM::Instance[IShellItemArray]
59
+
60
+ IModalWindow = COM::Interface[IUnknown,
61
+ GUID['b4db1657-70d7-485e-8e3e-6fcb5a5c1802'],
62
+
63
+ Show: [[:pointer], :long]
64
+ ]
65
+
66
+ ModalWindow = COM::Instance[IModalWindow]
11
67
  end
12
68
  end
@@ -0,0 +1,78 @@
1
+ require_relative 'Common'
2
+
3
+ module Fzeet
4
+ module Windows
5
+ FOS_OVERWRITEPROMPT = 0x00000002
6
+ FOS_STRICTFILETYPES = 0x00000004
7
+ FOS_NOCHANGEDIR = 0x00000008
8
+ FOS_PICKFOLDERS = 0x00000020
9
+ FOS_FORCEFILESYSTEM = 0x00000040
10
+ FOS_ALLNONSTORAGEITEMS = 0x00000080
11
+ FOS_NOVALIDATE = 0x00000100
12
+ FOS_ALLOWMULTISELECT = 0x00000200
13
+ FOS_PATHMUSTEXIST = 0x00000800
14
+ FOS_FILEMUSTEXIST = 0x00001000
15
+ FOS_CREATEPROMPT = 0x00002000
16
+ FOS_SHAREAWARE = 0x00004000
17
+ FOS_NOREADONLYRETURN = 0x00008000
18
+ FOS_NOTESTFILECREATE = 0x00010000
19
+ FOS_HIDEMRUPLACES = 0x00020000
20
+ FOS_HIDEPINNEDPLACES = 0x00040000
21
+ FOS_NODEREFERENCELINKS = 0x00100000
22
+ FOS_DONTADDTORECENT = 0x02000000
23
+ FOS_FORCESHOWHIDDEN = 0x10000000
24
+ FOS_DEFAULTNOMINIMODE = 0x20000000
25
+ FOS_FORCEPREVIEWPANEON = 0x40000000
26
+
27
+ IFileDialog = COM::Interface[IModalWindow,
28
+ GUID['42f85136-db7e-439c-85f1-e4075d135fc8'],
29
+
30
+ SetFileTypes: [[:uint, :pointer], :long],
31
+ SetFileTypeIndex: [[:uint], :long],
32
+ GetFileTypeIndex: [[:pointer], :long],
33
+ Advise: [[:pointer, :pointer], :long],
34
+ Unadvise: [[:ulong], :long],
35
+ SetOptions: [[:uint], :long],
36
+ GetOptions: [[:pointer], :long],
37
+ SetDefaultFolder: [[:pointer], :long],
38
+ SetFolder: [[:pointer], :long],
39
+ GetFolder: [[:pointer], :long],
40
+ GetCurrentSelection: [[:pointer], :long],
41
+ SetFileName: [[:pointer], :long],
42
+ GetFileName: [[:pointer], :long],
43
+ SetTitle: [[:pointer], :long],
44
+ SetOkButtonLabel: [[:pointer], :long],
45
+ SetFileNameLabel: [[:pointer], :long],
46
+ GetResult: [[:pointer], :long],
47
+ AddPlace: [[:pointer, :uint], :long],
48
+ SetDefaultExtension: [[:pointer], :long],
49
+ Close: [[:long], :long],
50
+ SetClientGuid: [[:pointer], :long],
51
+ ClearClientData: [[], :long],
52
+ SetFilter: [[:pointer], :long]
53
+ ]
54
+
55
+ FileDialog = COM::Instance[IFileDialog]
56
+
57
+ IFileOpenDialog = COM::Interface[IFileDialog,
58
+ GUID['d57c7288-d4ad-4768-be02-9d969532d960'],
59
+
60
+ GetResults: [[:pointer], :long],
61
+ GetSelectedItems: [[:pointer], :long]
62
+ ]
63
+
64
+ FileOpenDialog = COM::Factory[IFileOpenDialog, GUID['DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7']]
65
+
66
+ IFileSaveDialog = COM::Interface[IFileDialog,
67
+ GUID['84bccd23-5fde-4cdb-aea4-af64b83d78ab'],
68
+
69
+ SetSaveAsItem: [[:pointer], :long],
70
+ SetProperties: [[:pointer], :long],
71
+ SetCollectedProperties: [[:pointer, :int], :long],
72
+ GetProperties: [[:pointer], :long],
73
+ ApplyProperties: [[:pointer, :pointer, :pointer, :pointer], :long],
74
+ ]
75
+
76
+ FileSaveDialog = COM::Factory[IFileSaveDialog, GUID['C0B4E2F3-BA21-4773-8DBA-335EC946EB8B']]
77
+ end
78
+ end
@@ -1 +1,2 @@
1
- require_relative 'shell/FolderDialog'
1
+ require_relative 'shell/BrowseForFolder'
2
+ require_relative 'shell/FileDialog' if Fzeet::Windows::WINVER.AtLeastWindowsVista?
@@ -246,6 +246,7 @@ module Fzeet
246
246
  :pt, POINT
247
247
  end
248
248
 
249
+ attach_function :RegisterWindowMessage, :RegisterWindowMessageA, [:string], :uint
249
250
  attach_function :GetMessage, :GetMessageA, [:pointer, :pointer, :uint, :uint], :int
250
251
  attach_function :IsDialogMessage, [:pointer, :pointer], :int
251
252
  attach_function :TranslateAccelerator, :TranslateAcceleratorA, [:pointer, :pointer, :pointer], :int
data/lib/fzeet/windows.rb CHANGED
@@ -13,4 +13,5 @@ require_relative 'windows/ole'
13
13
  require_relative 'windows/shell'
14
14
 
15
15
  require_relative 'windows/propsys' if Fzeet::Windows::WINVER.AtLeastWindowsVista?
16
+
16
17
  require_relative 'windows/uiribbon' if Fzeet::Windows::WINVER.AtLeastWindowsVista?
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fzeet
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 5
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 6
8
- - 0
9
- version: 0.6.0
9
+ - 1
10
+ version: 0.6.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Radoslav Peev
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-09-03 00:00:00 +03:00
18
+ date: 2010-09-10 00:00:00 +03:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -25,6 +26,7 @@ dependencies:
25
26
  requirements:
26
27
  - - ~>
27
28
  - !ruby/object:Gem::Version
29
+ hash: 1
28
30
  segments:
29
31
  - 0
30
32
  - 6
@@ -81,10 +83,15 @@ files:
81
83
  - lib/fzeet/windows/comctl/SysLink.rb
82
84
  - lib/fzeet/windows/comctl/TreeView.rb
83
85
  - lib/fzeet/windows/comctl/UpDown.rb
86
+ - lib/fzeet/windows/comdlg/ColorDialog.rb
84
87
  - lib/fzeet/windows/comdlg/Common.rb
85
88
  - lib/fzeet/windows/comdlg/FileDialog.rb
89
+ - lib/fzeet/windows/comdlg/FindReplaceDialog.rb
90
+ - lib/fzeet/windows/comdlg/FontDialog.rb
91
+ - lib/fzeet/windows/comdlg/PrintDialog.rb
92
+ - lib/fzeet/windows/shell/BrowseForFolder.rb
86
93
  - lib/fzeet/windows/shell/Common.rb
87
- - lib/fzeet/windows/shell/FolderDialog.rb
94
+ - lib/fzeet/windows/shell/FileDialog.rb
88
95
  - lib/fzeet/Accelerator.rb
89
96
  - lib/fzeet/Application.rb
90
97
  - lib/fzeet/Common.rb
@@ -114,9 +121,13 @@ files:
114
121
  - lib/fzeet/Control/SysLink.rb
115
122
  - lib/fzeet/Control/TreeView.rb
116
123
  - lib/fzeet/Control/UpDown.rb
124
+ - lib/fzeet/Dialog/ColorDialog.rb
117
125
  - lib/fzeet/Dialog/Common.rb
118
126
  - lib/fzeet/Dialog/FileDialog.rb
119
- - lib/fzeet/Dialog/FolderDialog.rb
127
+ - lib/fzeet/Dialog/FindReplaceDialog.rb
128
+ - lib/fzeet/Dialog/FontDialog.rb
129
+ - lib/fzeet/Dialog/PrintDialog.rb
130
+ - lib/fzeet/Dialog/ShellFileDialog.rb
120
131
  - lib/fzeet.rb
121
132
  - examples/res/audio-volume-muted-big.bmp
122
133
  - examples/res/audio-volume-muted-small.bmp
@@ -184,9 +195,14 @@ files:
184
195
  - examples/Control/SysLink.rbw
185
196
  - examples/Control/TreeView.rbw
186
197
  - examples/Control/UpDown.rbw
198
+ - examples/Dialog/ColorDialog.rbw
187
199
  - examples/Dialog/Dialog.rbw
188
200
  - examples/Dialog/DialogApplication.rbw
189
- - examples/Dialog/FileAndFolderDialog.rbw
201
+ - examples/Dialog/FileDialog.rbw
202
+ - examples/Dialog/FindReplaceDialog.rbw
203
+ - examples/Dialog/FontDialog.rbw
204
+ - examples/Dialog/PrintDialog.rbw
205
+ - examples/Dialog/ShellFileDialog.rbw
190
206
  - examples/UIRibbon/Color.rbw
191
207
  - examples/UIRibbon/Command.rbw
192
208
  - examples/UIRibbon/ContextPopup.rbw
@@ -221,6 +237,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
221
237
  requirements:
222
238
  - - ">="
223
239
  - !ruby/object:Gem::Version
240
+ hash: 3
224
241
  segments:
225
242
  - 0
226
243
  version: "0"
@@ -229,6 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
246
  requirements:
230
247
  - - ">="
231
248
  - !ruby/object:Gem::Version
249
+ hash: 3
232
250
  segments:
233
251
  - 0
234
252
  version: "0"
@@ -1,34 +0,0 @@
1
- require 'fzeet'
2
-
3
- include Fzeet
4
-
5
- Application.run { |window|
6
- window.menu = Menu.new.
7
- append(:popup, '&File', PopupMenu.new.
8
- append(:string, '&Open...', :open).
9
- append(:string, 'Save &As...', :saveAs).
10
-
11
- append(:separator).
12
-
13
- append(:string, 'Browse for &Folder...', :browseForFolder)
14
- )
15
-
16
- window.
17
- on(:command, :open) {
18
- dialog = OpenFileDialog.new
19
-
20
- message dialog.path if dialog.show.ok?
21
- }.
22
-
23
- on(:command, :saveAs) {
24
- dialog = SaveFileDialog.new
25
-
26
- message dialog.path if dialog.show.ok?
27
- }.
28
-
29
- on(:command, :browseForFolder) {
30
- dialog = FolderDialog.new
31
-
32
- message dialog.path if dialog.show.ok?
33
- }
34
- }
@@ -1,45 +0,0 @@
1
- require_relative 'Common'
2
-
3
- module Fzeet
4
- class FolderDialog
5
- def initialize(opts = {})
6
- _opts = {
7
- root: nil,
8
- displayName: nil,
9
- title: nil,
10
- flags: 0,
11
- hook: nil,
12
- param: 0,
13
- image: 0
14
- }
15
- badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty?
16
- _opts.merge!(opts)
17
-
18
- @bi = Windows::BROWSEINFO.new
19
-
20
- @bi[:ulFlags] = Fzeet.flags([:returnonlyfsdirs, :usenewui], :bif_)
21
- end
22
-
23
- attr_reader :bi
24
-
25
- def path; @path && @path.dup end
26
-
27
- def show(window = Application.window)
28
- bi[:hwndOwner] = window.handle
29
-
30
- @path = nil
31
-
32
- DialogResult.new(((pidl = Windows.SHBrowseForFolder(bi)).null?) ? Windows::IDCANCEL : Windows::IDOK).tap { |result|
33
- next unless result.ok?
34
-
35
- FFI::MemoryPointer.new(:char, 4096) { |p|
36
- Windows.SHGetPathFromIDList(pidl, p)
37
-
38
- @path = p.read_string
39
- }
40
- }
41
- ensure
42
- Windows.CoTaskMemFree(pidl)
43
- end
44
- end
45
- end