windows_gui 4.0.3 → 4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b24126d4848b0fcbe9a1f2b36329486cb82cb515
4
- data.tar.gz: 3c00c4590f48bf96be33a1c9862c3bc710896598
3
+ metadata.gz: 70fd00b9f6b9731a32b4c777939230d8c975249a
4
+ data.tar.gz: 160a0a77b51fe4e98cbf95b22ae193d2ce637d45
5
5
  SHA512:
6
- metadata.gz: b47573f09c2a65b50b30c8f322bb9d16a48a406dc9baaf24bc2d22650d16f01c071a815ed72cd51c5c4992392f44c321586f4729d4588420d7d577533514f175
7
- data.tar.gz: 27173f247903abbe80d6bbbb75ef18a59638c23f3a009d80ff65201fb639c9e213908a2655f36ec25f6020befe0e41fa16b899f37038ca16d2f56190f2a75e3e
6
+ metadata.gz: e0cfb247bd7fcfe942633222d5e5cb692dec09642adefa521f7e0c5c3ff7ff4945fdbfae4d9b1b605e1633ceb7a362fac343160c2da5ec180d2bd83df1c931b6
7
+ data.tar.gz: 2e1ec3665a659957201ab32213661b77a399e79c0c05f607d54336daa8702d2842c809d84fab5f70e0a68a91b2011f94e8512cf1cb04572dbcf4fcd789003ce6
data/RELNOTES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release Notes
2
2
 
3
+ ## 4.1.0
4
+
5
+ Add UIRibbon FFI bindings plus example (requires windows_com gem)
6
+
3
7
  ## 4.0.3
4
8
 
5
9
  Minor fixes
Binary file
@@ -0,0 +1,30 @@
1
+ # Generated by the UIRibbon build, do NOT modify
2
+
3
+ CmdAppMenu = 2
4
+ CmdQAT = 3
5
+ CmdTab1 = 4
6
+ CmdTab1_LabelTitle_RESID = 60001
7
+ CmdTab1Group1 = 5
8
+ CmdTab1Group1_LabelTitle_RESID = 60002
9
+ CmdTab1Group1_LabelDescription_RESID = 60003
10
+ CmdTab1Group1_TooltipDescription_RESID = 60004
11
+ CmdTab1Group1_SmallImages_RESID = 60005
12
+ CmdTab1Group1_SmallImages_120__RESID = 60006
13
+ CmdTab1Group1_LargeImages_RESID = 60007
14
+ CmdTab1Group1_LargeImages_120__RESID = 60008
15
+ CmdItem1 = 6
16
+ CmdItem1_LabelTitle_RESID = 60009
17
+ CmdItem1_LabelDescription_RESID = 60010
18
+ CmdItem1_TooltipDescription_RESID = 60011
19
+ CmdItem1_SmallImages_RESID = 60012
20
+ CmdItem1_SmallImages_120__RESID = 60013
21
+ CmdItem1_LargeImages_RESID = 60014
22
+ CmdItem1_LargeImages_120__RESID = 60015
23
+ CmdButton1 = 7
24
+ CmdButton1_LabelTitle_RESID = 60016
25
+ CmdButton1_LabelDescription_RESID = 60017
26
+ CmdButton1_TooltipDescription_RESID = 60018
27
+ CmdButton1_SmallImages_RESID = 60019
28
+ CmdButton1_SmallImages_120__RESID = 60020
29
+ CmdButton1_LargeImages_RESID = 60021
30
+ CmdButton1_LargeImages_120__RESID = 60022
@@ -0,0 +1,201 @@
1
+ #WINDOWS_COM_TRACE_CALLBACK_REFCOUNT = true
2
+
3
+ require 'windows_gui'
4
+ require 'windows_gui/uiribbon' # requires windows_com gem
5
+
6
+ include WindowsGUI
7
+ include UIRibbon
8
+
9
+ class UIF < UIFramework
10
+ def initialize(hwnd)
11
+ @hwnd = hwnd
12
+
13
+ super()
14
+ end
15
+
16
+ attr_reader :hwnd
17
+ end
18
+
19
+ class UICH < IUICommandHandlerImpl
20
+ def initialize(uif)
21
+ @uif = uif
22
+
23
+ super()
24
+ end
25
+
26
+ attr_reader :uif
27
+
28
+ def OnItem1(*args)
29
+ MessageBox(uif.hwnd,
30
+ L("#{self}.#{__method__}"),
31
+ APPNAME,
32
+ MB_OK
33
+ )
34
+
35
+ uif.SetUICommandProperty(CmdButton1, UI_PKEY_Enabled, PROPVARIANT[VT_BOOL, :boolVal, -1])
36
+ uif.SetUICommandProperty(CmdItem1, UI_PKEY_Enabled, PROPVARIANT[VT_BOOL, :boolVal, 0])
37
+ end
38
+
39
+ def OnButton1(*args)
40
+ MessageBox(uif.hwnd,
41
+ L("#{self}.#{__method__}"),
42
+ APPNAME,
43
+ MB_OK
44
+ )
45
+
46
+ uif.SetUICommandProperty(CmdItem1, UI_PKEY_Enabled, PROPVARIANT[VT_BOOL, :boolVal, -1])
47
+ uif.SetUICommandProperty(CmdButton1, UI_PKEY_Enabled, PROPVARIANT[VT_BOOL, :boolVal, 0])
48
+ end
49
+
50
+ def Execute(*args)
51
+ case args[0]
52
+ when CmdItem1
53
+ OnItem1(*args)
54
+ when CmdButton1
55
+ OnButton1(*args)
56
+ end
57
+
58
+ S_OK
59
+ end
60
+ end
61
+
62
+ class UIA < IUIApplicationImpl
63
+ def initialize(uich)
64
+ @uich = uich
65
+
66
+ super()
67
+ end
68
+
69
+ attr_reader :uich
70
+
71
+ def OnCreateUICommand(*args)
72
+ uich.QueryInterface(uich.class::IID, args[-1])
73
+
74
+ S_OK
75
+ end
76
+ end
77
+
78
+ WndExtra = Struct.new(
79
+ :uif,
80
+ :uich,
81
+ :uia
82
+ )
83
+
84
+ def OnCreate(hwnd,
85
+ cs
86
+ )
87
+ xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
88
+
89
+ xtra[:uif] = UIF.new(hwnd)
90
+ xtra[:uich] = UICH.new(xtra[:uif])
91
+ xtra[:uia] = UIA.new(xtra[:uich])
92
+
93
+ xtra[:uif].Initialize(hwnd, xtra[:uia].vptr)
94
+ xtra[:uif].LoadUI(LoadUIDll(), L('APPLICATION_RIBBON'))
95
+
96
+ 0
97
+ end
98
+
99
+ def OnDestroy(hwnd)
100
+ xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
101
+
102
+ xtra[:uif].Destroy()
103
+ xtra[:uif].Release()
104
+ xtra[:uich].Release()
105
+ xtra[:uia].Release()
106
+
107
+ PostQuitMessage(0); 0
108
+ end
109
+
110
+ WindowProc = FFI::Function.new(:long,
111
+ [:pointer, :uint, :uint, :long],
112
+ convention: :stdcall
113
+ ) { |hwnd, uMsg, wParam, lParam|
114
+ begin
115
+ result = case uMsg
116
+ when WM_NCCREATE
117
+ DefWindowProc(hwnd, uMsg, wParam, lParam)
118
+
119
+ SetWindowLong(hwnd,
120
+ GWL_USERDATA,
121
+ CREATESTRUCT.new(FFI::Pointer.new(lParam))[:lpCreateParams].to_i
122
+ )
123
+
124
+ 1
125
+ when WM_CREATE
126
+ OnCreate(hwnd, CREATESTRUCT.new(FFI::Pointer.new(lParam)))
127
+ when WM_DESTROY
128
+ OnDestroy(hwnd)
129
+ end
130
+
131
+ result || DefWindowProc(hwnd, uMsg, wParam, lParam)
132
+ rescue SystemExit => ex
133
+ PostQuitMessage(ex.status)
134
+ rescue
135
+ case MessageBox(hwnd,
136
+ L(FormatException($!)),
137
+ APPNAME,
138
+ MB_ABORTRETRYIGNORE | MB_ICONERROR
139
+ )
140
+ when IDABORT
141
+ PostQuitMessage(2)
142
+ when IDRETRY
143
+ retry
144
+ end
145
+ end
146
+ }
147
+
148
+ def WinMain
149
+ Id2RefTrack(xtra = WndExtra.new)
150
+
151
+ UsingFFIStructs(WNDCLASSEX.new) { |wc|
152
+ wc[:cbSize] = wc.size
153
+ wc[:lpfnWndProc] = WindowProc
154
+ wc[:cbWndExtra] = FFI::Type::Builtin::POINTER.size
155
+ wc[:hInstance] = GetModuleHandle(nil)
156
+ wc[:hIcon] = LoadIcon(nil, IDI_APPLICATION)
157
+ wc[:hCursor] = LoadCursor(nil, IDC_ARROW)
158
+ wc[:hbrBackground] = FFI::Pointer.new(COLOR_WINDOW + 1)
159
+
160
+ UsingFFIMemoryPointers(PWSTR(APPNAME)) { |className|
161
+ wc[:lpszClassName] = className
162
+
163
+ DetonateLastError(0, :RegisterClassEx,
164
+ wc
165
+ )
166
+ }
167
+ }
168
+
169
+ hwnd = CreateWindowEx(
170
+ WS_EX_CLIENTEDGE, APPNAME, APPNAME, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
171
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
172
+ nil, nil, GetModuleHandle(nil), FFI::Pointer.new(xtra.object_id)
173
+ )
174
+
175
+ raise "CreateWindowEx failed (last error: #{GetLastError()})" if
176
+ hwnd.null? && GetLastError() != 0
177
+
178
+ exit(0) if hwnd.null?
179
+
180
+ ShowWindow(hwnd, SW_SHOWNORMAL)
181
+ UpdateWindow(hwnd)
182
+
183
+ UsingFFIStructs(MSG.new) { |msg|
184
+ until DetonateLastError(-1, :GetMessage,
185
+ msg, nil, 0, 0
186
+ ) == 0
187
+ TranslateMessage(msg)
188
+ DispatchMessage(msg)
189
+ end
190
+
191
+ exit(msg[:wParam])
192
+ }
193
+ rescue
194
+ MessageBox(hwnd,
195
+ L(FormatException($!)),
196
+ APPNAME,
197
+ MB_ICONERROR
198
+ ); exit(1)
199
+ end
200
+
201
+ WinMain()
@@ -0,0 +1,71 @@
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
+ <Image MinDPI='120'>../../res/go-next.bmp</Image>
13
+ </Command.SmallImages>
14
+ <Command.LargeImages>
15
+ <Image>../../res/go-next.bmp</Image>
16
+ <Image MinDPI='120'>../../res/go-next-big.bmp</Image>
17
+ </Command.LargeImages>
18
+ </Command>
19
+
20
+ <Command Name='cmdItem1' LabelTitle='&amp;Item1' LabelDescription='LabelDescription...' TooltipDescription='TooltipDescription...'>
21
+ <Command.SmallImages>
22
+ <Image>../../res/go-previous-small.bmp</Image>
23
+ <Image MinDPI='120'>../../res/go-previous.bmp</Image>
24
+ </Command.SmallImages>
25
+ <Command.LargeImages>
26
+ <Image>../../res/go-previous.bmp</Image>
27
+ <Image MinDPI='120'>../../res/go-previous-big.bmp</Image>
28
+ </Command.LargeImages>
29
+ </Command>
30
+
31
+ <Command Name='cmdButton1' LabelTitle='&amp;Button1' LabelDescription='LabelDescription...' TooltipDescription='TooltipDescription...'>
32
+ <Command.SmallImages>
33
+ <Image>../../res/go-next-small.bmp</Image>
34
+ <Image MinDPI='120'>../../res/go-next.bmp</Image>
35
+ </Command.SmallImages>
36
+ <Command.LargeImages>
37
+ <Image>../../res/go-next.bmp</Image>
38
+ <Image MinDPI='120'>../../res/go-next-big.bmp</Image>
39
+ </Command.LargeImages>
40
+ </Command>
41
+ </Application.Commands>
42
+
43
+ <Application.Views>
44
+ <Ribbon>
45
+ <Ribbon.ApplicationMenu>
46
+ <ApplicationMenu CommandName='cmdAppMenu'>
47
+ <MenuGroup Class='MajorItems'>
48
+ <Button CommandName='cmdItem1' />
49
+ </MenuGroup>
50
+ </ApplicationMenu>
51
+ </Ribbon.ApplicationMenu>
52
+
53
+ <Ribbon.QuickAccessToolbar>
54
+ <QuickAccessToolbar CommandName='cmdQAT'>
55
+ <QuickAccessToolbar.ApplicationDefaults>
56
+ <Button CommandName='cmdItem1' />
57
+ <Button CommandName='cmdButton1' />
58
+ </QuickAccessToolbar.ApplicationDefaults>
59
+ </QuickAccessToolbar>
60
+ </Ribbon.QuickAccessToolbar>
61
+
62
+ <Ribbon.Tabs>
63
+ <Tab CommandName='cmdTab1'>
64
+ <Group CommandName='cmdTab1Group1' SizeDefinition='OneButton'>
65
+ <Button CommandName='cmdButton1' />
66
+ </Group>
67
+ </Tab>
68
+ </Ribbon.Tabs>
69
+ </Ribbon>
70
+ </Application.Views>
71
+ </Application>
@@ -1,7 +1,7 @@
1
1
  require 'weakref'
2
2
  require 'ffi'
3
3
 
4
- WINDOWS_GUI_VERSION = '4.0.3'
4
+ WINDOWS_GUI_VERSION = '4.1.0'
5
5
 
6
6
  WINDOWS_GUI_VISUAL_STYLES = true unless defined?(WINDOWS_GUI_VISUAL_STYLES)
7
7
  WINDOWS_GUI_DPI_AWARE = true unless defined?(WINDOWS_GUI_DPI_AWARE)
@@ -0,0 +1,342 @@
1
+ if __FILE__ == $0
2
+ require_relative 'common'
3
+ require_relative 'libc'
4
+ require_relative 'kernel'
5
+ require_relative 'gdi'
6
+ require_relative 'user'
7
+ end
8
+
9
+ require 'windows_com'
10
+
11
+ module WindowsGUI
12
+ module UIRibbon
13
+ include WindowsCOM
14
+
15
+ def LoadUIDll(name = File.basename($0, '.rbw'))
16
+ path = File.dirname(File.expand_path($0))
17
+ dll_path = "#{path}/#{name}.dll"
18
+
19
+ # pull in generated UIRibbon constants
20
+ require "#{path}/#{name}"
21
+
22
+ # load UIRibbon dll
23
+ hdll = DetonateLastError(FFI::Pointer::NULL, :LoadLibrary,
24
+ L(dll_path.dup)
25
+ )
26
+
27
+ STDERR.puts "#{dll_path} loaded (hdll: #{hdll})" if $DEBUG
28
+
29
+ at_exit {
30
+ FreeLibrary(hdll)
31
+
32
+ STDERR.puts "#{dll_path} unloaded" if $DEBUG
33
+ }
34
+
35
+ hdll
36
+ end
37
+
38
+ module_function \
39
+ :LoadUIDll
40
+
41
+ UI_PKEY_Enabled = PROPERTYKEY[VT_BOOL, 1]
42
+ UI_PKEY_LabelDescription = PROPERTYKEY[VT_LPWSTR, 2]
43
+ UI_PKEY_Keytip = PROPERTYKEY[VT_LPWSTR, 3]
44
+ UI_PKEY_Label = PROPERTYKEY[VT_LPWSTR, 4]
45
+ UI_PKEY_TooltipDescription = PROPERTYKEY[VT_LPWSTR, 5]
46
+ UI_PKEY_TooltipTitle = PROPERTYKEY[VT_LPWSTR, 6]
47
+ UI_PKEY_LargeImage = PROPERTYKEY[VT_UNKNOWN, 7]
48
+ UI_PKEY_LargeHighContrastImage = PROPERTYKEY[VT_UNKNOWN, 8]
49
+ UI_PKEY_SmallImage = PROPERTYKEY[VT_UNKNOWN, 9]
50
+ UI_PKEY_SmallHighContrastImage = PROPERTYKEY[VT_UNKNOWN, 10]
51
+
52
+ UI_PKEY_CommandId = PROPERTYKEY[VT_UI4, 100]
53
+ UI_PKEY_ItemsSource = PROPERTYKEY[VT_UNKNOWN, 101]
54
+ UI_PKEY_Categories = PROPERTYKEY[VT_UNKNOWN, 102]
55
+ UI_PKEY_CategoryId = PROPERTYKEY[VT_UI4, 103]
56
+ UI_PKEY_SelectedItem = PROPERTYKEY[VT_UI4, 104]
57
+ UI_PKEY_CommandType = PROPERTYKEY[VT_UI4, 105]
58
+ UI_PKEY_ItemImage = PROPERTYKEY[VT_UNKNOWN, 106]
59
+
60
+ UI_PKEY_BooleanValue = PROPERTYKEY[VT_BOOL, 200]
61
+ UI_PKEY_DecimalValue = PROPERTYKEY[VT_DECIMAL, 201]
62
+ UI_PKEY_StringValue = PROPERTYKEY[VT_LPWSTR, 202]
63
+ UI_PKEY_MaxValue = PROPERTYKEY[VT_DECIMAL, 203]
64
+ UI_PKEY_MinValue = PROPERTYKEY[VT_DECIMAL, 204]
65
+ UI_PKEY_Increment = PROPERTYKEY[VT_DECIMAL, 205]
66
+ UI_PKEY_DecimalPlaces = PROPERTYKEY[VT_UI4, 206]
67
+ UI_PKEY_FormatString = PROPERTYKEY[VT_LPWSTR, 207]
68
+ UI_PKEY_RepresentativeString = PROPERTYKEY[VT_LPWSTR, 208]
69
+
70
+ UI_PKEY_FontProperties = PROPERTYKEY[VT_UNKNOWN, 300]
71
+ UI_PKEY_FontProperties_Family = PROPERTYKEY[VT_LPWSTR, 301]
72
+ UI_PKEY_FontProperties_Size = PROPERTYKEY[VT_DECIMAL, 302]
73
+ UI_PKEY_FontProperties_Bold = PROPERTYKEY[VT_UI4, 303]
74
+ UI_PKEY_FontProperties_Italic = PROPERTYKEY[VT_UI4, 304]
75
+ UI_PKEY_FontProperties_Underline = PROPERTYKEY[VT_UI4, 305]
76
+ UI_PKEY_FontProperties_Strikethrough = PROPERTYKEY[VT_UI4, 306]
77
+ UI_PKEY_FontProperties_VerticalPositioning = PROPERTYKEY[VT_UI4, 307]
78
+ UI_PKEY_FontProperties_ForegroundColor = PROPERTYKEY[VT_UI4, 308]
79
+ UI_PKEY_FontProperties_BackgroundColor = PROPERTYKEY[VT_UI4, 309]
80
+ UI_PKEY_FontProperties_ForegroundColorType = PROPERTYKEY[VT_UI4, 310]
81
+ UI_PKEY_FontProperties_BackgroundColorType = PROPERTYKEY[VT_UI4, 311]
82
+ UI_PKEY_FontProperties_ChangedProperties = PROPERTYKEY[VT_UNKNOWN, 312]
83
+ UI_PKEY_FontProperties_DeltaSize = PROPERTYKEY[VT_UI4, 313]
84
+
85
+ UI_PKEY_RecentItems = PROPERTYKEY[VT_ARRAY | VT_UNKNOWN, 350]
86
+ UI_PKEY_Pinned = PROPERTYKEY[VT_BOOL, 351]
87
+
88
+ UI_PKEY_Color = PROPERTYKEY[VT_UI4, 400]
89
+ UI_PKEY_ColorType = PROPERTYKEY[VT_UI4, 401]
90
+ UI_PKEY_ColorMode = PROPERTYKEY[VT_UI4, 402]
91
+ UI_PKEY_ThemeColorsCategoryLabel = PROPERTYKEY[VT_LPWSTR, 403]
92
+ UI_PKEY_StandardColorsCategoryLabel = PROPERTYKEY[VT_LPWSTR, 404]
93
+ UI_PKEY_RecentColorsCategoryLabel = PROPERTYKEY[VT_LPWSTR, 405]
94
+ UI_PKEY_AutomaticColorLabel = PROPERTYKEY[VT_LPWSTR, 406]
95
+ UI_PKEY_NoColorLabel = PROPERTYKEY[VT_LPWSTR, 407]
96
+ UI_PKEY_MoreColorsLabel = PROPERTYKEY[VT_LPWSTR, 408]
97
+ UI_PKEY_ThemeColors = PROPERTYKEY[VT_VECTOR | VT_UI4, 409]
98
+ UI_PKEY_StandardColors = PROPERTYKEY[VT_VECTOR | VT_UI4, 410]
99
+ UI_PKEY_ThemeColorsTooltips = PROPERTYKEY[VT_VECTOR | VT_LPWSTR, 411]
100
+ UI_PKEY_StandardColorsTooltips = PROPERTYKEY[VT_VECTOR | VT_LPWSTR, 412]
101
+
102
+ UI_PKEY_Viewable = PROPERTYKEY[VT_BOOL, 1000]
103
+ UI_PKEY_Minimized = PROPERTYKEY[VT_BOOL, 1001]
104
+ UI_PKEY_QuickAccessToolbarDock = PROPERTYKEY[VT_UI4, 1002]
105
+
106
+ UI_PKEY_ContextAvailable = PROPERTYKEY[VT_UI4, 1100]
107
+
108
+ UI_PKEY_GlobalBackgroundColor = PROPERTYKEY[VT_UI4, 2000]
109
+ UI_PKEY_GlobalHighlightColor = PROPERTYKEY[VT_UI4, 2001]
110
+ UI_PKEY_GlobalTextColor = PROPERTYKEY[VT_UI4, 2002]
111
+
112
+ def UI_GetHValue(hsb)
113
+ LOBYTE(hsb)
114
+ end
115
+
116
+ def UI_GetSValue(hsb)
117
+ LOBYTE(hsb >> 8)
118
+ end
119
+
120
+ def UI_GetBValue(hsb)
121
+ LOBYTE(hsb >> 16)
122
+ end
123
+
124
+ def UI_HSB(h, s, b)
125
+ h | (s << 8) | (b << 16)
126
+ end
127
+
128
+ def UI_RGB2HSB(r, g, b)
129
+ r, g, b = r.to_f / 255, g.to_f / 255, b.to_f / 255
130
+ max, min = [r, g, b].max, [r, g, b].min
131
+ l = (max + min) / 2
132
+
133
+ s = if max == min
134
+ 0
135
+ elsif l < 0.5
136
+ (max - min) / (max + min)
137
+ else
138
+ (max - min) / (2 - (max + min))
139
+ end
140
+
141
+ h = if max == min
142
+ 0
143
+ elsif r == max
144
+ (g - b) / (max - min)
145
+ elsif g == max
146
+ 2 + (b - r) / (max - min)
147
+ else
148
+ 4 + (r - g) / (max - min)
149
+ end * 60
150
+
151
+ h += 360 if h < 0
152
+ h = h / 360
153
+
154
+ [
155
+ (255 * h).round, # hue
156
+ (255 * s).round, # saturation
157
+ (l < 0.1793) ? # brightness
158
+ 0 :
159
+ (l > 0.9821) ?
160
+ 255 :
161
+ (257.7 + 149.9 * Math.log(l)).round
162
+ ]
163
+ end
164
+
165
+ module_function \
166
+ :UI_GetHValue,
167
+ :UI_GetSValue,
168
+ :UI_GetBValue,
169
+ :UI_HSB,
170
+ :UI_RGB2HSB
171
+
172
+ UI_CONTEXTAVAILABILITY_NOTAVAILABLE = 0
173
+ UI_CONTEXTAVAILABILITY_AVAILABLE = 1
174
+ UI_CONTEXTAVAILABILITY_ACTIVE = 2
175
+
176
+ UI_FONTPROPERTIES_NOTAVAILABLE = 0
177
+ UI_FONTPROPERTIES_NOTSET = 1
178
+ UI_FONTPROPERTIES_SET = 2
179
+
180
+ UI_FONTVERTICALPOSITION_NOTAVAILABLE = 0
181
+ UI_FONTVERTICALPOSITION_NOTSET = 1
182
+ UI_FONTVERTICALPOSITION_SUPERSCRIPT = 2
183
+ UI_FONTVERTICALPOSITION_SUBSCRIPT = 3
184
+
185
+ UI_FONTUNDERLINE_NOTAVAILABLE = 0
186
+ UI_FONTUNDERLINE_NOTSET = 1
187
+ UI_FONTUNDERLINE_SET = 2
188
+
189
+ UI_FONTDELTASIZE_GROW = 0
190
+ UI_FONTDELTASIZE_SHRINK = 1
191
+
192
+ UI_CONTROLDOCK_TOP = 1
193
+ UI_CONTROLDOCK_BOTTOM = 3
194
+
195
+ UI_SWATCHCOLORTYPE_NOCOLOR = 0
196
+ UI_SWATCHCOLORTYPE_AUTOMATIC = 1
197
+ UI_SWATCHCOLORTYPE_RGB = 2
198
+
199
+ UI_SWATCHCOLORMODE_NORMAL = 0
200
+ UI_SWATCHCOLORMODE_MONOCHROME = 1
201
+
202
+ IUISimplePropertySet = COMInterface[IUnknown,
203
+ 'c205bb48-5b1c-4219-a106-15bd0a5f24e2',
204
+
205
+ GetValue: [[:pointer, :pointer], :long]
206
+ ]
207
+
208
+ IUISimplePropertySetImpl = COMCallback[IUISimplePropertySet]
209
+
210
+ IUIRibbon = COMInterface[IUnknown,
211
+ '803982ab-370a-4f7e-a9e7-8784036a6e26',
212
+
213
+ GetHeight: [[:pointer], :long],
214
+ LoadSettingsFromStream: [[:pointer], :long],
215
+ SaveSettingsToStream: [[:pointer], :long]
216
+ ]
217
+
218
+ UI_INVALIDATIONS_STATE = 0x00000001
219
+ UI_INVALIDATIONS_VALUE = 0x00000002
220
+ UI_INVALIDATIONS_PROPERTY = 0x00000004
221
+ UI_INVALIDATIONS_ALLPROPERTIES = 0x00000008
222
+
223
+ UI_ALL_COMMANDS = 0
224
+
225
+ IUIFramework = COMInterface[IUnknown,
226
+ 'F4F0385D-6872-43a8-AD09-4C339CB3F5C5',
227
+
228
+ Initialize: [[:pointer, :pointer], :long],
229
+ Destroy: [[], :long],
230
+ LoadUI: [[:pointer, :buffer_in], :long],
231
+ GetView: [[:uint, :pointer, :pointer], :long],
232
+ GetUICommandProperty: [[:uint, :pointer, :pointer], :long],
233
+ SetUICommandProperty: [[:uint, :pointer, :pointer], :long],
234
+ InvalidateUICommand: [[:uint, :int, :pointer], :long],
235
+ FlushPendingInvalidations: [[], :long],
236
+ SetModes: [[:int], :long]
237
+ ]
238
+
239
+ UIFramework = COMFactory[IUIFramework, '926749fa-2615-4987-8845-c33e65f2b957']
240
+
241
+ IUIContextualUI = COMInterface[IUnknown,
242
+ 'EEA11F37-7C46-437c-8E55-B52122B29293',
243
+
244
+ ShowAtLocation: [[:int, :int], :long]
245
+ ]
246
+
247
+ IUICollection = COMInterface[IUnknown,
248
+ 'DF4F45BF-6F9D-4dd7-9D68-D8F9CD18C4DB',
249
+
250
+ GetCount: [[:pointer], :long],
251
+ GetItem: [[:uint, :pointer], :long],
252
+ Add: [[:pointer], :long],
253
+ Insert: [[:uint, :pointer], :long],
254
+ RemoveAt: [[:uint], :long],
255
+ Replace: [[:uint, :pointer], :long],
256
+ Clear: [[], :long]
257
+ ]
258
+
259
+ UI_COLLECTIONCHANGE_INSERT = 0
260
+ UI_COLLECTIONCHANGE_REMOVE = 1
261
+ UI_COLLECTIONCHANGE_REPLACE = 2
262
+ UI_COLLECTIONCHANGE_RESET = 3
263
+
264
+ UI_COLLECTION_INVALIDINDEX = 0xffffffff
265
+
266
+ IUICollectionChangedEvent = COMInterface[IUnknown,
267
+ '6502AE91-A14D-44b5-BBD0-62AACC581D52',
268
+
269
+ OnChanged: [[:int, :uint, :pointer, :uint, :pointer], :long]
270
+ ]
271
+
272
+ IUICollectionChangedEventImpl = COMCallback[IUICollectionChangedEvent]
273
+
274
+ UI_EXECUTIONVERB_EXECUTE = 0
275
+ UI_EXECUTIONVERB_PREVIEW = 1
276
+ UI_EXECUTIONVERB_CANCELPREVIEW = 2
277
+
278
+ IUICommandHandler = COMInterface[IUnknown,
279
+ '75ae0a2d-dc03-4c9f-8883-069660d0beb6',
280
+
281
+ Execute: [[:uint, :int, :pointer, :pointer, :pointer], :long],
282
+ UpdateProperty: [[:uint, :pointer, :pointer, :pointer], :long]
283
+ ]
284
+
285
+ IUICommandHandlerImpl = COMCallback[IUICommandHandler]
286
+
287
+ UI_COMMANDTYPE_UNKNOWN = 0
288
+ UI_COMMANDTYPE_GROUP = 1
289
+ UI_COMMANDTYPE_ACTION = 2
290
+ UI_COMMANDTYPE_ANCHOR = 3
291
+ UI_COMMANDTYPE_CONTEXT = 4
292
+ UI_COMMANDTYPE_COLLECTION = 5
293
+ UI_COMMANDTYPE_COMMANDCOLLECTION = 6
294
+ UI_COMMANDTYPE_DECIMAL = 7
295
+ UI_COMMANDTYPE_BOOLEAN = 8
296
+ UI_COMMANDTYPE_FONT = 9
297
+ UI_COMMANDTYPE_RECENTITEMS = 10
298
+ UI_COMMANDTYPE_COLORANCHOR = 11
299
+ UI_COMMANDTYPE_COLORCOLLECTION = 12
300
+
301
+ UI_VIEWTYPE_RIBBON = 1
302
+
303
+ UI_VIEWVERB_CREATE = 0
304
+ UI_VIEWVERB_DESTROY = 1
305
+ UI_VIEWVERB_SIZE = 2
306
+ UI_VIEWVERB_ERROR = 3
307
+
308
+ IUIApplication = COMInterface[IUnknown,
309
+ 'D428903C-729A-491d-910D-682A08FF2522',
310
+
311
+ OnViewChanged: [[:uint, :int, :pointer, :int, :int], :long],
312
+ OnCreateUICommand: [[:uint, :int, :pointer], :long],
313
+ OnDestroyUICommand: [[:uint, :int, :pointer], :long]
314
+ ]
315
+
316
+ IUIApplicationImpl = COMCallback[IUIApplication]
317
+
318
+ IUIImage = COMInterface[IUnknown,
319
+ '23c8c838-4de6-436b-ab01-5554bb7c30dd',
320
+
321
+ GetBitmap: [[:pointer], :long]
322
+ ]
323
+
324
+ UI_OWNERSHIP_TRANSFER = 0
325
+ UI_OWNERSHIP_COPY = 1
326
+
327
+ IUIImageFromBitmap = COMInterface[IUnknown,
328
+ '18aba7f3-4c1c-4ba2-bf6c-f5c3326fa816',
329
+
330
+ CreateImage: [[:pointer, :int, :pointer], :long]
331
+ ]
332
+
333
+ UIImageFromBitmap = COMFactory[IUIImageFromBitmap, '0f7434b6-59b6-4250-999e-d168d6ae4293']
334
+
335
+ def UI_MAKEAPPMODE(x)
336
+ 1 << x
337
+ end
338
+
339
+ module_function \
340
+ :UI_MAKEAPPMODE
341
+ end
342
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: windows_gui
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.3
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Radoslav Peev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-28 00:00:00.000000000 Z
11
+ date: 2017-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -50,6 +50,10 @@ files:
50
50
  - examples/Paint.rbw
51
51
  - examples/Region.rbw
52
52
  - examples/Scribble.rbw
53
+ - examples/UIRibbon/Command.dll
54
+ - examples/UIRibbon/Command.rb
55
+ - examples/UIRibbon/Command.rbw
56
+ - examples/UIRibbon/Command.xml
53
57
  - examples/Version.rbw
54
58
  - examples/WndExtra.rbw
55
59
  - examples/res/face-devilish.bmp
@@ -58,6 +62,7 @@ files:
58
62
  - lib/windows_gui/gdi.rb
59
63
  - lib/windows_gui/kernel.rb
60
64
  - lib/windows_gui/libc.rb
65
+ - lib/windows_gui/uiribbon.rb
61
66
  - lib/windows_gui/user.rb
62
67
  - screenshot.png
63
68
  homepage: https://github.com/rpeev/windows_gui