fzeet 0.4.2 → 0.5.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 (63) hide show
  1. data/examples/Dialog/FileDialog.rbw +34 -0
  2. data/examples/Raw/UIRibbon/Command.dll +0 -0
  3. data/examples/Raw/UIRibbon/Command.rb +22 -0
  4. data/examples/Raw/UIRibbon/Command.rbw +51 -0
  5. data/examples/Raw/UIRibbon/Command.xml +65 -0
  6. data/examples/Raw/UIRibbon/Minimal.dll +0 -0
  7. data/examples/Raw/UIRibbon/Minimal.rb +16 -0
  8. data/examples/Raw/UIRibbon/Minimal.rbw +39 -0
  9. data/examples/Raw/UIRibbon/Minimal.xml +55 -0
  10. data/examples/UIRibbon/Command.dll +0 -0
  11. data/examples/UIRibbon/Command.rb +22 -0
  12. data/examples/UIRibbon/Command.rbw +20 -0
  13. data/examples/UIRibbon/Command.xml +65 -0
  14. data/examples/UIRibbon/Minimal.dll +0 -0
  15. data/examples/UIRibbon/Minimal.rb +16 -0
  16. data/examples/UIRibbon/Minimal.rbw +8 -0
  17. data/examples/UIRibbon/Minimal.xml +55 -0
  18. data/examples/UIRibbon/Viewer.rbw +9 -0
  19. data/examples/res/go-next-small.bmp +0 -0
  20. data/examples/res/go-next.bmp +0 -0
  21. data/examples/res/go-previous-small.bmp +0 -0
  22. data/examples/res/go-previous.bmp +0 -0
  23. data/lib/fzeet/Control.rb +1 -89
  24. data/lib/fzeet/ControlButton.rb +28 -0
  25. data/lib/fzeet/ControlCommon.rb +64 -0
  26. data/lib/fzeet/Dialog.rb +1 -0
  27. data/lib/fzeet/DialogCommon.rb +5 -0
  28. data/lib/fzeet/DialogFileDialog.rb +116 -0
  29. data/lib/fzeet/UIRibbon.rb +99 -0
  30. data/lib/fzeet/Window.rb +2 -336
  31. data/lib/fzeet/WindowCommon.rb +256 -0
  32. data/lib/fzeet/WindowDialog.rb +73 -0
  33. data/lib/fzeet/WindowWindow.rb +13 -0
  34. data/lib/fzeet/common.rb +2 -0
  35. data/lib/fzeet/windows/com.rb +186 -0
  36. data/lib/fzeet/windows/comctl.rb +1 -59
  37. data/lib/fzeet/windows/comctlbutton.rb +30 -0
  38. data/lib/fzeet/windows/comctlcommon.rb +34 -0
  39. data/lib/fzeet/windows/comdlg.rb +1 -0
  40. data/lib/fzeet/windows/comdlgcommon.rb +9 -0
  41. data/lib/fzeet/windows/comdlgofn.rb +70 -0
  42. data/lib/fzeet/windows/common.rb +18 -0
  43. data/lib/fzeet/windows/kernel.rb +3 -0
  44. data/lib/fzeet/windows/libc.rb +1 -0
  45. data/lib/fzeet/windows/ole.rb +213 -0
  46. data/lib/fzeet/windows/shell.rb +43 -0
  47. data/lib/fzeet/windows/uiribbon.rb +111 -0
  48. data/lib/fzeet/windows/user.rb +7 -438
  49. data/lib/fzeet/windows/usercommon.rb +8 -0
  50. data/lib/fzeet/windows/userctl.rb +1 -68
  51. data/lib/fzeet/windows/userctlbutton.rb +56 -0
  52. data/lib/fzeet/windows/userctlcommon.rb +12 -0
  53. data/lib/fzeet/windows/userkbd.rb +20 -0
  54. data/lib/fzeet/windows/usermbox.rb +62 -0
  55. data/lib/fzeet/windows/usermenu.rb +50 -0
  56. data/lib/fzeet/windows/usermsg.rb +1 -6
  57. data/lib/fzeet/windows/userspi.rb +29 -0
  58. data/lib/fzeet/windows/userwnd.rb +276 -0
  59. data/lib/fzeet/windows.rb +24 -4
  60. data/lib/fzeet.rb +2 -0
  61. metadata +54 -6
  62. /data/examples/{Dialog.rbw → Dialog/Dialog.rbw} +0 -0
  63. /data/examples/{DialogApplication.rbw → Dialog/DialogApplication.rbw} +0 -0
@@ -0,0 +1,34 @@
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
+ }
Binary file
@@ -0,0 +1,22 @@
1
+ CmdAppMenu = 2
2
+ CmdQAT = 3
3
+ CmdTab1 = 4
4
+ CmdTab1_LabelTitle_RESID = 60001
5
+ CmdTab1Group1 = 5
6
+ CmdTab1Group1_LabelTitle_RESID = 60002
7
+ CmdTab1Group1_LabelDescription_RESID = 60003
8
+ CmdTab1Group1_TooltipDescription_RESID = 60004
9
+ CmdTab1Group1_SmallImages_RESID = 60005
10
+ CmdTab1Group1_LargeImages_RESID = 60006
11
+ CmdItem1 = 6
12
+ CmdItem1_LabelTitle_RESID = 60007
13
+ CmdItem1_LabelDescription_RESID = 60008
14
+ CmdItem1_TooltipDescription_RESID = 60009
15
+ CmdItem1_SmallImages_RESID = 60010
16
+ CmdItem1_LargeImages_RESID = 60011
17
+ CmdButton1 = 7
18
+ CmdButton1_LabelTitle_RESID = 60012
19
+ CmdButton1_LabelDescription_RESID = 60013
20
+ CmdButton1_TooltipDescription_RESID = 60014
21
+ CmdButton1_SmallImages_RESID = 60015
22
+ CmdButton1_LargeImages_RESID = 60016
@@ -0,0 +1,51 @@
1
+ require 'fzeet'
2
+
3
+ include Fzeet::Windows
4
+
5
+ def onItem1(*args)
6
+ Fzeet.message __method__
7
+
8
+ UIF.SetUICommandProperty(CmdButton1, UI_PKEY_Enabled, PROPVARIANT[:bool, true])
9
+ UIF.SetUICommandProperty(CmdItem1, UI_PKEY_Enabled, PROPVARIANT[:bool, false])
10
+ end
11
+
12
+ def onButton1(*args)
13
+ Fzeet.message __method__
14
+
15
+ UIF.SetUICommandProperty(CmdItem1, UI_PKEY_Enabled, PROPVARIANT[:bool, true])
16
+ UIF.SetUICommandProperty(CmdButton1, UI_PKEY_Enabled, PROPVARIANT[:bool, false])
17
+ end
18
+
19
+ UICH = UICommandHandler.new
20
+
21
+ def UICH.Execute(*args)
22
+ case args[0]
23
+ when CmdItem1
24
+ onItem1(*args)
25
+ when CmdButton1
26
+ onButton1(*args)
27
+ end
28
+
29
+ S_OK
30
+ end
31
+
32
+ UIA = UIApplication.new
33
+
34
+ def UIA.OnCreateUICommand(*args)
35
+ UICH.QueryInterface(UICH.class::IID, args[-1])
36
+
37
+ S_OK
38
+ end
39
+
40
+ UIF = UIFramework.new
41
+
42
+ Fzeet::Application.run { |window|
43
+ UIF.Initialize(window.handle, UIA)
44
+ UIF.LoadUI(LoadRibbonDll(), "APPLICATION_RIBBON\0".encode('utf-16le'))
45
+
46
+ window.on(:destroy) {
47
+ UICH.Release
48
+ UIA.Release
49
+ UIF.Destroy; UIF.Release
50
+ }
51
+ }
@@ -0,0 +1,65 @@
1
+ <?xml version='1.0' encoding='utf-8' ?>
2
+ <Application xmlns='http://schemas.microsoft.com/windows/2009/Ribbon'>
3
+ <Application.Commands>
4
+ <Command Name='cmdAppMenu' />
5
+
6
+ <Command Name='cmdQAT' />
7
+
8
+ <Command Name='cmdTab1' LabelTitle='Tab1' />
9
+ <Command Name='cmdTab1Group1' LabelTitle='&amp;Group1' LabelDescription='LabelDescription...' TooltipDescription='TooltipDescription...'>
10
+ <Command.SmallImages>
11
+ <Image>../../res/go-next-small.bmp</Image>
12
+ </Command.SmallImages>
13
+ <Command.LargeImages>
14
+ <Image>../../res/go-next.bmp</Image>
15
+ </Command.LargeImages>
16
+ </Command>
17
+
18
+ <Command Name='cmdItem1' LabelTitle='&amp;Item1' LabelDescription='LabelDescription...' TooltipDescription='TooltipDescription...'>
19
+ <Command.SmallImages>
20
+ <Image>../../res/go-previous-small.bmp</Image>
21
+ </Command.SmallImages>
22
+ <Command.LargeImages>
23
+ <Image>../../res/go-previous.bmp</Image>
24
+ </Command.LargeImages>
25
+ </Command>
26
+
27
+ <Command Name='cmdButton1' LabelTitle='&amp;Button1' LabelDescription='LabelDescription...' TooltipDescription='TooltipDescription...'>
28
+ <Command.SmallImages>
29
+ <Image>../../res/go-next-small.bmp</Image>
30
+ </Command.SmallImages>
31
+ <Command.LargeImages>
32
+ <Image>../../res/go-next.bmp</Image>
33
+ </Command.LargeImages>
34
+ </Command>
35
+ </Application.Commands>
36
+
37
+ <Application.Views>
38
+ <Ribbon>
39
+ <Ribbon.ApplicationMenu>
40
+ <ApplicationMenu CommandName='cmdAppMenu'>
41
+ <MenuGroup Class='MajorItems'>
42
+ <Button CommandName='cmdItem1' />
43
+ </MenuGroup>
44
+ </ApplicationMenu>
45
+ </Ribbon.ApplicationMenu>
46
+
47
+ <Ribbon.QuickAccessToolbar>
48
+ <QuickAccessToolbar CommandName='cmdQAT'>
49
+ <QuickAccessToolbar.ApplicationDefaults>
50
+ <Button CommandName='cmdItem1' />
51
+ <Button CommandName='cmdButton1' />
52
+ </QuickAccessToolbar.ApplicationDefaults>
53
+ </QuickAccessToolbar>
54
+ </Ribbon.QuickAccessToolbar>
55
+
56
+ <Ribbon.Tabs>
57
+ <Tab CommandName='cmdTab1'>
58
+ <Group CommandName='cmdTab1Group1' SizeDefinition='OneButton'>
59
+ <Button CommandName='cmdButton1' />
60
+ </Group>
61
+ </Tab>
62
+ </Ribbon.Tabs>
63
+ </Ribbon>
64
+ </Application.Views>
65
+ </Application>
Binary file
@@ -0,0 +1,16 @@
1
+ CmdAppMenu = 2
2
+ CmdQAT = 3
3
+ CmdTab1 = 4
4
+ CmdTab1_LabelTitle_RESID = 60001
5
+ CmdTab1Group1 = 5
6
+ CmdTab1Group1_LabelTitle_RESID = 60002
7
+ CmdTab1Group1_LabelDescription_RESID = 60003
8
+ CmdTab1Group1_TooltipDescription_RESID = 60004
9
+ CmdTab1Group1_SmallImages_RESID = 60005
10
+ CmdTab1Group1_LargeImages_RESID = 60006
11
+ CmdButton1 = 6
12
+ CmdButton1_LabelTitle_RESID = 60007
13
+ CmdButton1_LabelDescription_RESID = 60008
14
+ CmdButton1_TooltipDescription_RESID = 60009
15
+ CmdButton1_SmallImages_RESID = 60010
16
+ CmdButton1_LargeImages_RESID = 60011
@@ -0,0 +1,39 @@
1
+ require 'fzeet'
2
+
3
+ include Fzeet::Windows
4
+
5
+ def onButton1(*args)
6
+ Fzeet.message __method__
7
+ end
8
+
9
+ UICH = UICommandHandler.new
10
+
11
+ def UICH.Execute(*args)
12
+ case args[0]
13
+ when CmdButton1
14
+ onButton1(*args)
15
+ end
16
+
17
+ S_OK
18
+ end
19
+
20
+ UIA = UIApplication.new
21
+
22
+ def UIA.OnCreateUICommand(*args)
23
+ UICH.QueryInterface(UICH.class::IID, args[-1])
24
+
25
+ S_OK
26
+ end
27
+
28
+ UIF = UIFramework.new
29
+
30
+ Fzeet::Application.run { |window|
31
+ UIF.Initialize(window.handle, UIA)
32
+ UIF.LoadUI(LoadRibbonDll(), "APPLICATION_RIBBON\0".encode('utf-16le'))
33
+
34
+ window.on(:destroy) {
35
+ UICH.Release
36
+ UIA.Release
37
+ UIF.Destroy; UIF.Release
38
+ }
39
+ }
@@ -0,0 +1,55 @@
1
+ <?xml version='1.0' encoding='utf-8' ?>
2
+ <Application xmlns='http://schemas.microsoft.com/windows/2009/Ribbon'>
3
+ <Application.Commands>
4
+ <Command Name='cmdAppMenu' />
5
+
6
+ <Command Name='cmdQAT' />
7
+
8
+ <Command Name='cmdTab1' LabelTitle='Tab1' />
9
+ <Command Name='cmdTab1Group1' LabelTitle='&amp;Group1' LabelDescription='LabelDescription...' TooltipDescription='TooltipDescription...'>
10
+ <Command.SmallImages>
11
+ <Image>../../res/go-next-small.bmp</Image>
12
+ </Command.SmallImages>
13
+ <Command.LargeImages>
14
+ <Image>../../res/go-next.bmp</Image>
15
+ </Command.LargeImages>
16
+ </Command>
17
+
18
+ <Command Name='cmdButton1' LabelTitle='&amp;Button1' LabelDescription='LabelDescription...' TooltipDescription='TooltipDescription...'>
19
+ <Command.SmallImages>
20
+ <Image>../../res/go-next-small.bmp</Image>
21
+ </Command.SmallImages>
22
+ <Command.LargeImages>
23
+ <Image>../../res/go-next.bmp</Image>
24
+ </Command.LargeImages>
25
+ </Command>
26
+ </Application.Commands>
27
+
28
+ <Application.Views>
29
+ <Ribbon>
30
+ <Ribbon.ApplicationMenu>
31
+ <ApplicationMenu CommandName='cmdAppMenu'>
32
+ <MenuGroup Class='MajorItems'>
33
+ <Button CommandName='cmdButton1' />
34
+ </MenuGroup>
35
+ </ApplicationMenu>
36
+ </Ribbon.ApplicationMenu>
37
+
38
+ <Ribbon.QuickAccessToolbar>
39
+ <QuickAccessToolbar CommandName='cmdQAT'>
40
+ <QuickAccessToolbar.ApplicationDefaults>
41
+ <Button CommandName='cmdButton1' />
42
+ </QuickAccessToolbar.ApplicationDefaults>
43
+ </QuickAccessToolbar>
44
+ </Ribbon.QuickAccessToolbar>
45
+
46
+ <Ribbon.Tabs>
47
+ <Tab CommandName='cmdTab1'>
48
+ <Group CommandName='cmdTab1Group1' SizeDefinition='OneButton'>
49
+ <Button CommandName='cmdButton1' />
50
+ </Group>
51
+ </Tab>
52
+ </Ribbon.Tabs>
53
+ </Ribbon>
54
+ </Application.Views>
55
+ </Application>
Binary file
@@ -0,0 +1,22 @@
1
+ CmdAppMenu = 2
2
+ CmdQAT = 3
3
+ CmdTab1 = 4
4
+ CmdTab1_LabelTitle_RESID = 60001
5
+ CmdTab1Group1 = 5
6
+ CmdTab1Group1_LabelTitle_RESID = 60002
7
+ CmdTab1Group1_LabelDescription_RESID = 60003
8
+ CmdTab1Group1_TooltipDescription_RESID = 60004
9
+ CmdTab1Group1_SmallImages_RESID = 60005
10
+ CmdTab1Group1_LargeImages_RESID = 60006
11
+ CmdItem1 = 6
12
+ CmdItem1_LabelTitle_RESID = 60007
13
+ CmdItem1_LabelDescription_RESID = 60008
14
+ CmdItem1_TooltipDescription_RESID = 60009
15
+ CmdItem1_SmallImages_RESID = 60010
16
+ CmdItem1_LargeImages_RESID = 60011
17
+ CmdButton1 = 7
18
+ CmdButton1_LabelTitle_RESID = 60012
19
+ CmdButton1_LabelDescription_RESID = 60013
20
+ CmdButton1_TooltipDescription_RESID = 60014
21
+ CmdButton1_SmallImages_RESID = 60015
22
+ CmdButton1_LargeImages_RESID = 60016
@@ -0,0 +1,20 @@
1
+ require 'fzeet'
2
+
3
+ include Fzeet
4
+
5
+ Application.run { |window|
6
+ UIRibbon.new(window).
7
+ on(CmdItem1) { |args|
8
+ message 'on(CmdItem1)'
9
+
10
+ args[:ribbon][CmdButton1].enabled = true
11
+ args[:sender].enabled = false
12
+ }.
13
+
14
+ on(CmdButton1) { |args|
15
+ message 'on(CmdButton1)'
16
+
17
+ args[:ribbon][CmdItem1].enabled = true
18
+ args[:sender].enabled = false
19
+ }
20
+ }
@@ -0,0 +1,65 @@
1
+ <?xml version='1.0' encoding='utf-8' ?>
2
+ <Application xmlns='http://schemas.microsoft.com/windows/2009/Ribbon'>
3
+ <Application.Commands>
4
+ <Command Name='cmdAppMenu' />
5
+
6
+ <Command Name='cmdQAT' />
7
+
8
+ <Command Name='cmdTab1' LabelTitle='Tab1' />
9
+ <Command Name='cmdTab1Group1' LabelTitle='&amp;Group1' LabelDescription='LabelDescription...' TooltipDescription='TooltipDescription...'>
10
+ <Command.SmallImages>
11
+ <Image>../res/go-next-small.bmp</Image>
12
+ </Command.SmallImages>
13
+ <Command.LargeImages>
14
+ <Image>../res/go-next.bmp</Image>
15
+ </Command.LargeImages>
16
+ </Command>
17
+
18
+ <Command Name='cmdItem1' LabelTitle='&amp;Item1' LabelDescription='LabelDescription...' TooltipDescription='TooltipDescription...'>
19
+ <Command.SmallImages>
20
+ <Image>../res/go-previous-small.bmp</Image>
21
+ </Command.SmallImages>
22
+ <Command.LargeImages>
23
+ <Image>../res/go-previous.bmp</Image>
24
+ </Command.LargeImages>
25
+ </Command>
26
+
27
+ <Command Name='cmdButton1' LabelTitle='&amp;Button1' LabelDescription='LabelDescription...' TooltipDescription='TooltipDescription...'>
28
+ <Command.SmallImages>
29
+ <Image>../res/go-next-small.bmp</Image>
30
+ </Command.SmallImages>
31
+ <Command.LargeImages>
32
+ <Image>../res/go-next.bmp</Image>
33
+ </Command.LargeImages>
34
+ </Command>
35
+ </Application.Commands>
36
+
37
+ <Application.Views>
38
+ <Ribbon>
39
+ <Ribbon.ApplicationMenu>
40
+ <ApplicationMenu CommandName='cmdAppMenu'>
41
+ <MenuGroup Class='MajorItems'>
42
+ <Button CommandName='cmdItem1' />
43
+ </MenuGroup>
44
+ </ApplicationMenu>
45
+ </Ribbon.ApplicationMenu>
46
+
47
+ <Ribbon.QuickAccessToolbar>
48
+ <QuickAccessToolbar CommandName='cmdQAT'>
49
+ <QuickAccessToolbar.ApplicationDefaults>
50
+ <Button CommandName='cmdItem1' />
51
+ <Button CommandName='cmdButton1' />
52
+ </QuickAccessToolbar.ApplicationDefaults>
53
+ </QuickAccessToolbar>
54
+ </Ribbon.QuickAccessToolbar>
55
+
56
+ <Ribbon.Tabs>
57
+ <Tab CommandName='cmdTab1'>
58
+ <Group CommandName='cmdTab1Group1' SizeDefinition='OneButton'>
59
+ <Button CommandName='cmdButton1' />
60
+ </Group>
61
+ </Tab>
62
+ </Ribbon.Tabs>
63
+ </Ribbon>
64
+ </Application.Views>
65
+ </Application>
Binary file
@@ -0,0 +1,16 @@
1
+ CmdAppMenu = 2
2
+ CmdQAT = 3
3
+ CmdTab1 = 4
4
+ CmdTab1_LabelTitle_RESID = 60001
5
+ CmdTab1Group1 = 5
6
+ CmdTab1Group1_LabelTitle_RESID = 60002
7
+ CmdTab1Group1_LabelDescription_RESID = 60003
8
+ CmdTab1Group1_TooltipDescription_RESID = 60004
9
+ CmdTab1Group1_SmallImages_RESID = 60005
10
+ CmdTab1Group1_LargeImages_RESID = 60006
11
+ CmdButton1 = 6
12
+ CmdButton1_LabelTitle_RESID = 60007
13
+ CmdButton1_LabelDescription_RESID = 60008
14
+ CmdButton1_TooltipDescription_RESID = 60009
15
+ CmdButton1_SmallImages_RESID = 60010
16
+ CmdButton1_LargeImages_RESID = 60011
@@ -0,0 +1,8 @@
1
+ require 'fzeet'
2
+
3
+ include Fzeet
4
+
5
+ Application.run { |window|
6
+ UIRibbon.new(window).
7
+ on(CmdButton1) { message 'on(CmdButton1)' }
8
+ }
@@ -0,0 +1,55 @@
1
+ <?xml version='1.0' encoding='utf-8' ?>
2
+ <Application xmlns='http://schemas.microsoft.com/windows/2009/Ribbon'>
3
+ <Application.Commands>
4
+ <Command Name='cmdAppMenu' />
5
+
6
+ <Command Name='cmdQAT' />
7
+
8
+ <Command Name='cmdTab1' LabelTitle='Tab1' />
9
+ <Command Name='cmdTab1Group1' LabelTitle='&amp;Group1' LabelDescription='LabelDescription...' TooltipDescription='TooltipDescription...'>
10
+ <Command.SmallImages>
11
+ <Image>../res/go-next-small.bmp</Image>
12
+ </Command.SmallImages>
13
+ <Command.LargeImages>
14
+ <Image>../res/go-next.bmp</Image>
15
+ </Command.LargeImages>
16
+ </Command>
17
+
18
+ <Command Name='cmdButton1' LabelTitle='&amp;Button1' LabelDescription='LabelDescription...' TooltipDescription='TooltipDescription...'>
19
+ <Command.SmallImages>
20
+ <Image>../res/go-next-small.bmp</Image>
21
+ </Command.SmallImages>
22
+ <Command.LargeImages>
23
+ <Image>../res/go-next.bmp</Image>
24
+ </Command.LargeImages>
25
+ </Command>
26
+ </Application.Commands>
27
+
28
+ <Application.Views>
29
+ <Ribbon>
30
+ <Ribbon.ApplicationMenu>
31
+ <ApplicationMenu CommandName='cmdAppMenu'>
32
+ <MenuGroup Class='MajorItems'>
33
+ <Button CommandName='cmdButton1' />
34
+ </MenuGroup>
35
+ </ApplicationMenu>
36
+ </Ribbon.ApplicationMenu>
37
+
38
+ <Ribbon.QuickAccessToolbar>
39
+ <QuickAccessToolbar CommandName='cmdQAT'>
40
+ <QuickAccessToolbar.ApplicationDefaults>
41
+ <Button CommandName='cmdButton1' />
42
+ </QuickAccessToolbar.ApplicationDefaults>
43
+ </QuickAccessToolbar>
44
+ </Ribbon.QuickAccessToolbar>
45
+
46
+ <Ribbon.Tabs>
47
+ <Tab CommandName='cmdTab1'>
48
+ <Group CommandName='cmdTab1Group1' SizeDefinition='OneButton'>
49
+ <Button CommandName='cmdButton1' />
50
+ </Group>
51
+ </Tab>
52
+ </Ribbon.Tabs>
53
+ </Ribbon>
54
+ </Application.Views>
55
+ </Application>
@@ -0,0 +1,9 @@
1
+ require 'fzeet'
2
+
3
+ include Fzeet
4
+
5
+ Application.name += " - #{name = ARGV[0] || 'Minimal'}.xml"
6
+
7
+ Application.run { |window|
8
+ UIRibbon.new(window, name)
9
+ }
Binary file
Binary file
Binary file
Binary file
data/lib/fzeet/Control.rb CHANGED
@@ -1,89 +1 @@
1
- require_relative 'WindowMethods'
2
-
3
- module Fzeet
4
- class Control < Handle
5
- include WindowMethods
6
-
7
- Windows::NONCLIENTMETRICS.new.tap { |ncm|
8
- ncm[:cbSize] = ncm.size
9
-
10
- Windows.DetonateLastError(0, :SystemParametersInfo, Windows::SPI_GETNONCLIENTMETRICS, ncm.size, ncm, 0)
11
-
12
- Font = IndirectFont.new(ncm[:lfMenuFont])
13
-
14
- at_exit { Font.dispose }
15
- }
16
-
17
- def self.crackNotification(args) end
18
-
19
- def initialize(className, parent, id, opts = {})
20
- @parent = parent
21
- @id = Command[id]
22
-
23
- handlers = {}
24
-
25
- opts.delete_if { |k, v|
26
- next false unless v.kind_of?(Proc)
27
-
28
- handlers[k] = v; true
29
- }
30
-
31
- _opts = {
32
- xstyle: [],
33
- caption: id.capitalize,
34
- style: [],
35
- x: Windows::CW_USEDEFAULT,
36
- y: Windows::CW_USEDEFAULT,
37
- width: Windows::CW_USEDEFAULT,
38
- height: Windows::CW_USEDEFAULT,
39
- }
40
- badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty?
41
- _opts.merge!(opts)
42
-
43
- _opts[:xstyle] = Fzeet.flags(_opts[:xstyle], *self.class::Prefix[:xstyle])
44
- _opts[:caption] = _opts[:caption].to_s
45
- _opts[:style] = Fzeet.flags([:child, :visible, :tabstop], :ws_) | Fzeet.flags(_opts[:style], *self.class::Prefix[:style])
46
-
47
- @handle = Windows.DetonateLastError(FFI::Pointer::NULL, :CreateWindowEx,
48
- _opts[:xstyle], className, _opts[:caption], _opts[:style],
49
- _opts[:x], _opts[:y], _opts[:width], _opts[:height],
50
- @parent.handle, FFI::Pointer.new(@id), Windows.GetModuleHandle(nil), nil
51
- )
52
-
53
- attach
54
-
55
- sendmsg(:setfont, Font.handle, 1)
56
-
57
- handlers.each { |k, v| on(k, &v) }
58
- end
59
-
60
- attr_reader :parent, :id
61
-
62
- def dispose; detach end
63
- end
64
-
65
- class Button < Control
66
- Prefix = {
67
- xstyle: [:ws_ex_],
68
- style: [:bs_, :ws_],
69
- message: [:bm_, :bcm_, :ccm_, :wm_],
70
- notification: [:bn_, :bcn_, :nm_]
71
- }
72
-
73
- def initialize(parent, id, opts = {}, &block)
74
- super('Button', parent, id, opts)
75
-
76
- @parent.on(:command, @id, &block) if block
77
- end
78
-
79
- def on(notification, &block)
80
- if (notification = Fzeet.constant(notification, *self.class::Prefix[:notification])) < Windows::BCN_LAST
81
- @parent.on(:command, @id, notification, &block)
82
- else
83
- @parent.on(:notify, @id, notification, &block)
84
- end
85
-
86
- self
87
- end
88
- end
89
- end
1
+ require_relative 'ControlButton'
@@ -0,0 +1,28 @@
1
+ require_relative 'ControlCommon'
2
+
3
+ module Fzeet
4
+ class Button < Control
5
+ Prefix = {
6
+ xstyle: [:ws_ex_],
7
+ style: [:bs_, :ws_],
8
+ message: [:bm_, :bcm_, :ccm_, :wm_],
9
+ notification: [:bn_, :bcn_, :nm_]
10
+ }
11
+
12
+ def initialize(parent, id, opts = {}, &block)
13
+ super('Button', parent, id, opts)
14
+
15
+ @parent.on(:command, @id, &block) if block
16
+ end
17
+
18
+ def on(notification, &block)
19
+ if (notification = Fzeet.constant(notification, *self.class::Prefix[:notification])) < Windows::BCN_LAST
20
+ @parent.on(:command, @id, notification, &block)
21
+ else
22
+ @parent.on(:notify, @id, notification, &block)
23
+ end
24
+
25
+ self
26
+ end
27
+ end
28
+ end