fzeet 0.6.5 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. data/LICENSE_CEF +29 -0
  2. data/checks/Bstr.rb +14 -0
  3. data/checks/Decimal.rb +27 -0
  4. data/checks/OSVERSIONINFOEX.rb +14 -0
  5. data/checks/Point.rb +65 -0
  6. data/checks/Rect.rb +104 -0
  7. data/checks/RunAll.rb +2 -0
  8. data/checks/SafeArray.rb +27 -0
  9. data/checks/Size.rb +45 -0
  10. data/checks/SystemTime.rb +43 -0
  11. data/checks/Variant.rb +160 -0
  12. data/examples/Control/DateTimePicker.rbw +1 -1
  13. data/examples/Control/MonthCalendar.rbw +1 -1
  14. data/examples/Control/{WebBrowser.rbw → WebBrowser/WebBrowser.rbw} +2 -2
  15. data/examples/Control/{WebBrowser1.rbw → WebBrowser/WebBrowser1.rbw} +0 -0
  16. data/examples/Control/WebBrowser/WebBrowser2.rbw +24 -0
  17. data/examples/Control/{WebBrowser3.rbw → WebBrowser/WebBrowser3.rbw} +0 -0
  18. data/examples/Control/{WebBrowser4.rbw → WebBrowser/WebBrowser4.rbw} +8 -3
  19. data/examples/Control/{WebBrowser4Sinatra.rb → WebBrowser/WebBrowser4Sinatra.rb} +0 -0
  20. data/examples/Control/{WebBrowser5.rbw → WebBrowser/WebBrowser5.rbw} +4 -2
  21. data/examples/Control/WebBrowser/jQueryUI.html +53 -0
  22. data/examples/Control/WebBrowser/jQueryUI.rbw +26 -0
  23. data/examples/MDI.rbw +2 -2
  24. data/examples/Raw/UIRibbon/Command.rbw +3 -3
  25. data/examples/Raw/UIRibbon/Minimal.rbw +3 -3
  26. data/examples/Version.rbw +1 -1
  27. data/lib/fzeet.rb +22 -7
  28. data/lib/fzeet/windows.rb +82 -5
  29. data/lib/fzeet/windows/com.rb +1 -318
  30. data/lib/fzeet/windows/com/Common.rb +318 -0
  31. data/lib/fzeet/windows/comctl.rb +1 -1
  32. data/lib/fzeet/windows/comctl/ComboBoxEx.rb +32 -0
  33. data/lib/fzeet/windows/comctl/DateTimePicker.rb +35 -0
  34. data/lib/fzeet/windows/comctl/Header.rb +61 -1
  35. data/lib/fzeet/windows/comctl/ListView.rb +133 -3
  36. data/lib/fzeet/windows/comctl/MonthCalendar.rb +35 -0
  37. data/lib/fzeet/windows/comctl/ProgressBar.rb +37 -0
  38. data/lib/fzeet/windows/comctl/PropertySheet.rb +50 -2
  39. data/lib/fzeet/windows/comctl/SysLink.rb +37 -0
  40. data/lib/fzeet/windows/comctl/Tab.rb +56 -0
  41. data/lib/fzeet/windows/comctl/TreeView.rb +81 -2
  42. data/lib/fzeet/windows/comctl/UpDown.rb +33 -0
  43. data/lib/fzeet/windows/comdlg.rb +1 -0
  44. data/lib/fzeet/windows/comdlg/ColorDialog.rb +41 -0
  45. data/lib/fzeet/windows/comdlg/Common.rb +87 -0
  46. data/lib/fzeet/windows/comdlg/FileDialog.rb +133 -0
  47. data/lib/fzeet/windows/comdlg/FindReplaceDialog.rb +102 -0
  48. data/lib/fzeet/windows/comdlg/FontDialog.rb +36 -0
  49. data/lib/fzeet/windows/comdlg/PrintDialog.rb +72 -0
  50. data/lib/fzeet/{Dialog → windows/comdlg}/ShellFileDialog.rb +0 -0
  51. data/lib/fzeet/windows/core.rb +5 -0
  52. data/lib/fzeet/windows/core/Common.rb +324 -0
  53. data/lib/fzeet/windows/core/Point.rb +42 -0
  54. data/lib/fzeet/windows/core/Rect.rb +114 -0
  55. data/lib/fzeet/windows/core/Size.rb +34 -0
  56. data/lib/fzeet/windows/core/SystemTime.rb +46 -0
  57. data/lib/fzeet/windows/core/Version.rb +57 -0
  58. data/lib/fzeet/windows/gdi.rb +1 -62
  59. data/lib/fzeet/windows/gdi/Common.rb +40 -0
  60. data/lib/fzeet/windows/gdi/Font.rb +64 -0
  61. data/lib/fzeet/windows/kernel.rb +1 -92
  62. data/lib/fzeet/windows/kernel/Common.rb +92 -0
  63. data/lib/fzeet/windows/libc.rb +1 -1
  64. data/lib/fzeet/windows/libcef.rb +1 -0
  65. data/lib/fzeet/windows/mshtml.rb +1 -1135
  66. data/lib/fzeet/windows/mshtml/Common.rb +1135 -0
  67. data/lib/fzeet/windows/ole.rb +1 -561
  68. data/lib/fzeet/windows/ole/Common.rb +112 -0
  69. data/lib/fzeet/windows/ole/PropVariant.rb +141 -0
  70. data/lib/fzeet/windows/oleaut.rb +3 -0
  71. data/lib/fzeet/windows/oleaut/Bstr.rb +39 -0
  72. data/lib/fzeet/windows/oleaut/Common.rb +187 -0
  73. data/lib/fzeet/windows/oleaut/SafeArray.rb +104 -0
  74. data/lib/fzeet/windows/oleaut/Variant.rb +269 -0
  75. data/lib/fzeet/windows/scintilla.rb +115 -1
  76. data/lib/fzeet/windows/{SciLexer.dll → scintilla/SciLexer.dll} +0 -0
  77. data/lib/fzeet/windows/shdocvw.rb +150 -0
  78. data/lib/fzeet/windows/shell.rb +1 -1
  79. data/lib/fzeet/windows/shell/Common.rb +94 -2
  80. data/lib/fzeet/windows/shlwapi.rb +1 -1
  81. data/lib/fzeet/windows/uiribbon.rb +416 -0
  82. data/lib/fzeet/windows/urlmon.rb +2 -2
  83. data/lib/fzeet/windows/user.rb +20 -0
  84. data/lib/fzeet/windows/user/Accelerator.rb +45 -0
  85. data/lib/fzeet/windows/user/Common.rb +3 -2
  86. data/lib/fzeet/windows/user/Control/Button.rb +54 -0
  87. data/lib/fzeet/windows/user/Control/ComboBox.rb +44 -1
  88. data/lib/fzeet/windows/user/Control/Common.rb +88 -1
  89. data/lib/fzeet/windows/user/Control/Edit.rb +50 -0
  90. data/lib/fzeet/windows/user/Control/ListBox.rb +69 -0
  91. data/lib/fzeet/windows/user/Control/Static.rb +31 -0
  92. data/lib/fzeet/windows/user/Menu.rb +130 -0
  93. data/lib/fzeet/windows/user/Message.rb +9 -0
  94. data/lib/fzeet/windows/user/MessageBox.rb +47 -0
  95. data/lib/fzeet/windows/user/SystemParametersInfo.rb +1 -1
  96. data/lib/fzeet/windows/user/Window.rb +5 -463
  97. data/lib/fzeet/{Window → windows/user/Window}/Common.rb +460 -0
  98. data/lib/fzeet/{Window → windows/user/Window}/Container.rb +0 -0
  99. data/lib/fzeet/{Window → windows/user/Window}/Dialog.rb +0 -0
  100. data/lib/fzeet/{Window → windows/user/Window}/MDI.rb +0 -0
  101. data/lib/fzeet/{Window → windows/user/Window}/View.rb +0 -0
  102. data/lib/fzeet/{Window → windows/user/Window}/Window.rb +0 -0
  103. data/lib/fzeet/{Window → windows/user/Window}/WindowMethods.rb +1 -1
  104. metadata +55 -61
  105. data/examples/Control/WebBrowser2.rbw +0 -39
  106. data/lib/fzeet/Accelerator.rb +0 -48
  107. data/lib/fzeet/Application.rb +0 -71
  108. data/lib/fzeet/Common.rb +0 -350
  109. data/lib/fzeet/Control.rb +0 -19
  110. data/lib/fzeet/Control/Button.rb +0 -57
  111. data/lib/fzeet/Control/ComboBox.rb +0 -46
  112. data/lib/fzeet/Control/ComboBoxEx.rb +0 -35
  113. data/lib/fzeet/Control/Common.rb +0 -89
  114. data/lib/fzeet/Control/DateTimePicker.rb +0 -38
  115. data/lib/fzeet/Control/Edit.rb +0 -53
  116. data/lib/fzeet/Control/ExplorerBrowser.rb +0 -66
  117. data/lib/fzeet/Control/Header.rb +0 -63
  118. data/lib/fzeet/Control/ListBox.rb +0 -72
  119. data/lib/fzeet/Control/ListView.rb +0 -133
  120. data/lib/fzeet/Control/MonthCalendar.rb +0 -38
  121. data/lib/fzeet/Control/ProgressBar.rb +0 -40
  122. data/lib/fzeet/Control/PropertySheet.rb +0 -51
  123. data/lib/fzeet/Control/Scintilla.rb +0 -117
  124. data/lib/fzeet/Control/Static.rb +0 -34
  125. data/lib/fzeet/Control/SysLink.rb +0 -40
  126. data/lib/fzeet/Control/Tab.rb +0 -59
  127. data/lib/fzeet/Control/TreeView.rb +0 -82
  128. data/lib/fzeet/Control/UpDown.rb +0 -36
  129. data/lib/fzeet/Control/WebBrowser.rb +0 -153
  130. data/lib/fzeet/Dialog.rb +0 -6
  131. data/lib/fzeet/Dialog/ColorDialog.rb +0 -44
  132. data/lib/fzeet/Dialog/Common.rb +0 -89
  133. data/lib/fzeet/Dialog/FileDialog.rb +0 -136
  134. data/lib/fzeet/Dialog/FindReplaceDialog.rb +0 -105
  135. data/lib/fzeet/Dialog/FontDialog.rb +0 -39
  136. data/lib/fzeet/Dialog/PrintDialog.rb +0 -75
  137. data/lib/fzeet/Menu.rb +0 -133
  138. data/lib/fzeet/UIRibbon.rb +0 -417
  139. data/lib/fzeet/Window.rb +0 -5
  140. data/lib/fzeet/windows/common.rb +0 -244
@@ -46,4 +46,35 @@ module Fzeet
46
46
  STN_ENABLE = 2
47
47
  STN_DISABLE = 3
48
48
  end
49
+
50
+ module StaticMethods
51
+ def clear; self.text = ''; self end
52
+
53
+ def image=(image) sendmsg(:setimage, Windows::IMAGE_BITMAP, image.handle) end
54
+ end
55
+
56
+ class Static < Control
57
+ include StaticMethods
58
+
59
+ Prefix = {
60
+ xstyle: [:ws_ex_],
61
+ style: [:ss_, :ws_],
62
+ message: [:stm_, :wm_],
63
+ notification: [:stn_]
64
+ }
65
+
66
+ def initialize(parent, id, opts = {}, &block)
67
+ super('Static', parent, id, opts)
68
+
69
+ style >> :tabstop
70
+
71
+ @parent.on(:command, @id, &block) if block
72
+ end
73
+
74
+ def on(notification, &block)
75
+ @parent.on(:command, @id, Fzeet.constant(notification, *self.class::Prefix[:notification]), &block)
76
+
77
+ self
78
+ end
79
+ end
49
80
  end
@@ -111,5 +111,135 @@ module Fzeet
111
111
  TPM_WORKAREA = 0x10000
112
112
 
113
113
  attach_function :TrackPopupMenu, [:pointer, :uint, :int, :int, :int, :pointer, :pointer], :int
114
+
115
+ module MenuMethods
116
+ def rdetach; submenus.each(&:rdetach); detach end
117
+
118
+ class Item
119
+ def initialize(menu, id) @menu, @id = menu, Command[id] end
120
+
121
+ attr_reader :menu, :id
122
+
123
+ def enabled?
124
+ flags = Windows.DetonateLastError(-1, :GetMenuState, @menu.handle, @id, 0)
125
+
126
+ (flags & Windows::MF_GRAYED) != Windows::MF_GRAYED
127
+ end
128
+
129
+ def enabled=(enabled)
130
+ Windows.DetonateLastError(-1, :EnableMenuItem,
131
+ @menu.handle,
132
+ @id,
133
+ (enabled) ? Windows::MF_ENABLED : Windows::MF_GRAYED
134
+ )
135
+ end
136
+
137
+ def checked?
138
+ flags = Windows.DetonateLastError(-1, :GetMenuState, @menu.handle, @id, 0)
139
+
140
+ (flags & Windows::MF_CHECKED) == Windows::MF_CHECKED
141
+ end
142
+
143
+ def checked=(checked)
144
+ Windows.DetonateLastError(-1, :CheckMenuItem,
145
+ @menu.handle,
146
+ @id,
147
+ (checked) ? Windows::MF_CHECKED : Windows::MF_UNCHECKED
148
+ )
149
+ end
150
+
151
+ def select(first, last)
152
+ Windows.DetonateLastError(0, :CheckMenuRadioItem,
153
+ @menu.handle, Command[first], Command[last], @id, 0
154
+ )
155
+
156
+ self
157
+ end
158
+
159
+ def info(mask)
160
+ Windows.DetonateLastError(0, :GetMenuItemInfo,
161
+ @menu.handle,
162
+ @id,
163
+ 0,
164
+ info = Windows::MENUITEMINFO.new.tap { |mii|
165
+ mii[:cbSize] = mii.size
166
+ mii[:fMask] = Fzeet.constant(mask, :miim_)
167
+ }
168
+ )
169
+
170
+ info
171
+ end
172
+
173
+ def info=(mii)
174
+ Windows.DetonateLastError(0, :SetMenuItemInfo,
175
+ @menu.handle,
176
+ @id,
177
+ 0,
178
+ mii.tap { mii[:cbSize] = mii.size }
179
+ )
180
+ end
181
+
182
+ def image; (Handle.instance?(handle = info(:bitmap)[:hbmpItem])) ? Handle.instance(handle) : nil end
183
+
184
+ def image=(image)
185
+ self.info = Windows::MENUITEMINFO.new.tap { |mii|
186
+ mii[:fMask] = Windows::MIIM_BITMAP
187
+ mii[:hbmpItem] = image.handle
188
+ }
189
+ end
190
+ end
191
+
192
+ def [](id) Item.new(self, id) end
193
+
194
+ def append(flags, item = nil, id = 0)
195
+ Windows.DetonateLastError(0, :AppendMenu,
196
+ @handle,
197
+ Fzeet.flags(flags, :mf_, :mft_, :mfs_),
198
+ case id
199
+ when Integer; id
200
+ when Symbol; Command[id]
201
+ when Windows::MenuMethods; submenus << id; id.handle.to_i
202
+ else raise ArgumentError
203
+ end,
204
+ item
205
+ )
206
+
207
+ self
208
+ end
209
+
210
+ def images=(images) images.each { |id, image| self[id].image = image } end
211
+ end
212
+ end
213
+
214
+ Windows::MenuMethods::Item.send(:include, Toggle)
215
+
216
+ class Menu < Handle
217
+ include Windows::MenuMethods
218
+
219
+ def initialize
220
+ @submenus = []
221
+
222
+ @handle = Windows.DetonateLastError(FFI::Pointer::NULL, :CreateMenu); attach
223
+ end
224
+
225
+ attr_reader :submenus
226
+
227
+ def dispose; Windows.DestroyMenu(@handle); rdetach end
228
+ end
229
+
230
+ class PopupMenu < Handle
231
+ include Windows::MenuMethods
232
+
233
+ def initialize
234
+ @submenus = []
235
+
236
+ @handle = Windows.DetonateLastError(FFI::Pointer::NULL, :CreatePopupMenu); attach
237
+ end
238
+
239
+ attr_reader :submenus
240
+
241
+ def dispose; Windows.DestroyMenu(@handle); rdetach end
242
+
243
+ def track(window, x, y, flags = 0) Windows.TrackPopupMenu(@handle, Fzeet.flags(flags, :tpm_), x, y, 0, window.handle, nil); self end
114
244
  end
115
245
  end
@@ -257,4 +257,13 @@ module Fzeet
257
257
  attach_function :PostMessage, :PostMessageA, [:pointer, :uint, :uint, :long], :int
258
258
  attach_function :PostQuitMessage, [:int], :void
259
259
  end
260
+
261
+ class Message < Windows::MSG
262
+ def get!(window = nil, msgFilterMin = 0, msgFilterMax = 0)
263
+ Windows.DetonateLastError(-1, :GetMessage, self, window && window.handle, msgFilterMin, msgFilterMax) != 0
264
+ end
265
+
266
+ def translate; Windows.TranslateMessage(self); self end
267
+ def dispatch; Windows.DispatchMessage(self); self end
268
+ end
260
269
  end
@@ -55,4 +55,51 @@ module Fzeet
55
55
 
56
56
  attach_function :MessageBox, :MessageBoxA, [:pointer, :string, :string, :uint], :int
57
57
  end
58
+
59
+ class DialogResult
60
+ def initialize(id)
61
+ @id = id
62
+ end
63
+
64
+ attr_reader :id
65
+
66
+ Windows.constants.grep(/^ID[A-Z]{2,}$/).each { |c|
67
+ define_method("#{c[2..-1].downcase}?") {
68
+ @id == Windows.const_get(c)
69
+ }
70
+ }
71
+ end
72
+
73
+ def message(message, opts = {})
74
+ _opts = {
75
+ window: Application.window,
76
+ caption: Application.name,
77
+ buttons: [:ok],
78
+ icon: :information
79
+ }
80
+ badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty?
81
+ _opts.merge!(opts)
82
+
83
+ defbutton = nil
84
+ defbutton = if [*_opts[:buttons]].find.with_index { |button, i| defbutton = i + 1; button =~ /^[A-Z]/ }
85
+ constant(defbutton.to_s, :mb_defbutton)
86
+ else
87
+ 0
88
+ end
89
+
90
+ flags = constant([*_opts[:buttons]].join(''), :mb_) | defbutton | constant(_opts[:icon], :mb_icon)
91
+
92
+ DialogResult.new(
93
+ Windows.DetonateLastError(0, :MessageBox, _opts[:window] && _opts[:window].handle, message.to_s, _opts[:caption].to_s, flags)
94
+ )
95
+ end
96
+
97
+ def question(message, opts = {})
98
+ opts[:buttons] ||= [:yes, :no]
99
+ opts[:icon] ||= :question
100
+
101
+ message(message, opts)
102
+ end
103
+
104
+ module_function :message, :question
58
105
  end
@@ -235,7 +235,7 @@ module Fzeet
235
235
  :lfMenuFont, LOGFONT,
236
236
  :lfStatusFont, LOGFONT,
237
237
  :lfMessageFont, LOGFONT,
238
- (WINVER.AtLeastWindowsVista?) ? [:iPaddedBorderWidth, :int] : nil
238
+ (Version >= :vista) ? [:iPaddedBorderWidth, :int] : nil
239
239
  ].flatten.compact
240
240
  end
241
241
 
@@ -1,463 +1,5 @@
1
- require_relative 'Common'
2
-
3
- module Fzeet
4
- module Windows
5
- CS_VREDRAW = 0x0001
6
- CS_HREDRAW = 0x0002
7
- CS_DBLCLKS = 0x0008
8
- CS_OWNDC = 0x0020
9
- CS_CLASSDC = 0x0040
10
- CS_PARENTDC = 0x0080
11
- CS_NOCLOSE = 0x0200
12
- CS_SAVEBITS = 0x0800
13
- CS_BYTEALIGNCLIENT = 0x1000
14
- CS_BYTEALIGNWINDOW = 0x2000
15
- CS_GLOBALCLASS = 0x4000
16
- CS_IME = 0x00010000
17
- CS_DROPSHADOW = 0x00020000
18
-
19
- callback :WNDPROC, [:pointer, :uint, :uint, :long], :long
20
-
21
- attach_function :DefWindowProc, :DefWindowProcA, [:pointer, :uint, :uint, :long], :long
22
- attach_function :DefFrameProc, :DefFrameProcA, [:pointer, :pointer, :uint, :uint, :long], :long
23
- attach_function :DefMDIChildProc, :DefMDIChildProcA, [:pointer, :uint, :uint, :long], :long
24
-
25
- callback :DLGPROC, [:pointer, :uint, :uint, :long], :int
26
-
27
- attach_function :DefDlgProc, :DefDlgProcA, [:pointer, :uint, :uint, :long], :long
28
-
29
- IDI_APPLICATION = FFI::Pointer.new(32512)
30
- IDI_HAND = FFI::Pointer.new(32513)
31
- IDI_QUESTION = FFI::Pointer.new(32514)
32
- IDI_EXCLAMATION = FFI::Pointer.new(32515)
33
- IDI_ASTERISK = FFI::Pointer.new(32516)
34
- IDI_WINLOGO = FFI::Pointer.new(32517)
35
- IDI_SHIELD = FFI::Pointer.new(32518)
36
- IDI_WARNING = IDI_EXCLAMATION
37
- IDI_ERROR = IDI_HAND
38
- IDI_INFORMATION = IDI_ASTERISK
39
-
40
- attach_function :LoadIcon, :LoadIconA, [:pointer, :pointer], :pointer
41
-
42
- IDC_ARROW = FFI::Pointer.new(32512)
43
- IDC_IBEAM = FFI::Pointer.new(32513)
44
- IDC_WAIT = FFI::Pointer.new(32514)
45
- IDC_CROSS = FFI::Pointer.new(32515)
46
- IDC_UPARROW = FFI::Pointer.new(32516)
47
- IDC_SIZE = FFI::Pointer.new(32640)
48
- IDC_ICON = FFI::Pointer.new(32641)
49
- IDC_SIZENWSE = FFI::Pointer.new(32642)
50
- IDC_SIZENESW = FFI::Pointer.new(32643)
51
- IDC_SIZEWE = FFI::Pointer.new(32644)
52
- IDC_SIZENS = FFI::Pointer.new(32645)
53
- IDC_SIZEALL = FFI::Pointer.new(32646)
54
- IDC_NO = FFI::Pointer.new(32648)
55
- IDC_HAND = FFI::Pointer.new(32649)
56
- IDC_APPSTARTING = FFI::Pointer.new(32650)
57
- IDC_HELP = FFI::Pointer.new(32651)
58
-
59
- attach_function :LoadCursor, :LoadCursorA, [:pointer, :pointer], :pointer
60
-
61
- COLOR_SCROLLBAR = 0
62
- COLOR_BACKGROUND = 1
63
- COLOR_ACTIVECAPTION = 2
64
- COLOR_INACTIVECAPTION = 3
65
- COLOR_MENU = 4
66
- COLOR_WINDOW = 5
67
- COLOR_WINDOWFRAME = 6
68
- COLOR_MENUTEXT = 7
69
- COLOR_WINDOWTEXT = 8
70
- COLOR_CAPTIONTEXT = 9
71
- COLOR_ACTIVEBORDER = 10
72
- COLOR_INACTIVEBORDER = 11
73
- COLOR_APPWORKSPACE = 12
74
- COLOR_HIGHLIGHT = 13
75
- COLOR_HIGHLIGHTTEXT = 14
76
- COLOR_BTNFACE = 15
77
- COLOR_BTNSHADOW = 16
78
- COLOR_GRAYTEXT = 17
79
- COLOR_BTNTEXT = 18
80
- COLOR_INACTIVECAPTIONTEXT = 19
81
- COLOR_BTNHIGHLIGHT = 20
82
- COLOR_3DDKSHADOW = 21
83
- COLOR_3DLIGHT = 22
84
- COLOR_INFOTEXT = 23
85
- COLOR_INFOBK = 24
86
- COLOR_HOTLIGHT = 26
87
- COLOR_GRADIENTACTIVECAPTION = 27
88
- COLOR_GRADIENTINACTIVECAPTION = 28
89
- COLOR_MENUHILIGHT = 29
90
- COLOR_MENUBAR = 30
91
- COLOR_DESKTOP = COLOR_BACKGROUND
92
- COLOR_3DFACE = COLOR_BTNFACE
93
- COLOR_3DSHADOW = COLOR_BTNSHADOW
94
- COLOR_3DHIGHLIGHT = COLOR_BTNHIGHLIGHT
95
- COLOR_3DHILIGHT = COLOR_BTNHIGHLIGHT
96
- COLOR_BTNHILIGHT = COLOR_BTNHIGHLIGHT
97
-
98
- CTLCOLOR_MSGBOX = 0
99
- CTLCOLOR_EDIT = 1
100
- CTLCOLOR_LISTBOX = 2
101
- CTLCOLOR_BTN = 3
102
- CTLCOLOR_DLG = 4
103
- CTLCOLOR_SCROLLBAR = 5
104
- CTLCOLOR_STATIC = 6
105
- CTLCOLOR_MAX = 7
106
-
107
- class WNDCLASSEX < FFI::Struct
108
- layout \
109
- :cbSize, :uint,
110
- :style, :uint,
111
- :lpfnWndProc, :WNDPROC,
112
- :cbClsExtra, :int,
113
- :cbWndExtra, :int,
114
- :hInstance, :pointer,
115
- :hIcon, :pointer,
116
- :hCursor, :pointer,
117
- :hbrBackground, :pointer,
118
- :lpszMenuName, :pointer,
119
- :lpszClassName, :pointer,
120
- :hIconSm, :pointer
121
- end
122
-
123
- attach_function :RegisterClassEx, :RegisterClassExA, [:pointer], :ushort
124
-
125
- GCL_MENUNAME = -8
126
- GCL_HBRBACKGROUND = -10
127
- GCL_HCURSOR = -12
128
- GCL_HICON = -14
129
- GCL_HMODULE = -16
130
- GCL_CBWNDEXTRA = -18
131
- GCL_CBCLSEXTRA = -20
132
- GCL_WNDPROC = -24
133
- GCL_STYLE = -26
134
- GCL_HICONSM = -34
135
-
136
- GCLP_MENUNAME = -8
137
- GCLP_HBRBACKGROUND = -10
138
- GCLP_HCURSOR = -12
139
- GCLP_HICON = -14
140
- GCLP_HMODULE = -16
141
- GCLP_WNDPROC = -24
142
- GCLP_HICONSM = -34
143
-
144
- attach_function :GetClassLong, :GetClassLongA, [:pointer, :int], :ulong
145
- attach_function :SetClassLong, :SetClassLongA, [:pointer, :int, :long], :ulong
146
-
147
- HWND_BROADCAST = FFI::Pointer.new(0xffff)
148
- HWND_MESSAGE = FFI::Pointer.new(-3)
149
- HWND_DESKTOP = FFI::Pointer.new(0)
150
- HWND_TOP = FFI::Pointer.new(0)
151
- HWND_BOTTOM = FFI::Pointer.new(1)
152
- HWND_TOPMOST = FFI::Pointer.new(-1)
153
- HWND_NOTOPMOST = FFI::Pointer.new(-2)
154
-
155
- WS_OVERLAPPED = 0x00000000
156
- WS_POPUP = 0x80000000
157
- WS_CHILD = 0x40000000
158
- WS_MINIMIZE = 0x20000000
159
- WS_VISIBLE = 0x10000000
160
- WS_DISABLED = 0x08000000
161
- WS_CLIPSIBLINGS = 0x04000000
162
- WS_CLIPCHILDREN = 0x02000000
163
- WS_MAXIMIZE = 0x01000000
164
- WS_CAPTION = 0x00C00000
165
- WS_BORDER = 0x00800000
166
- WS_DLGFRAME = 0x00400000
167
- WS_VSCROLL = 0x00200000
168
- WS_HSCROLL = 0x00100000
169
- WS_SYSMENU = 0x00080000
170
- WS_THICKFRAME = 0x00040000
171
- WS_GROUP = 0x00020000
172
- WS_TABSTOP = 0x00010000
173
- WS_MINIMIZEBOX = 0x00020000
174
- WS_MAXIMIZEBOX = 0x00010000
175
- WS_TILED = WS_OVERLAPPED
176
- WS_ICONIC = WS_MINIMIZE
177
- WS_SIZEBOX = WS_THICKFRAME
178
- WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
179
- WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW
180
- WS_POPUPWINDOW = WS_POPUP | WS_BORDER | WS_SYSMENU
181
- WS_CHILDWINDOW = WS_CHILD
182
- WS_ACTIVECAPTION = 0x0001
183
-
184
- WS_EX_DLGMODALFRAME = 0x00000001
185
- WS_EX_NOPARENTNOTIFY = 0x00000004
186
- WS_EX_TOPMOST = 0x00000008
187
- WS_EX_ACCEPTFILES = 0x00000010
188
- WS_EX_TRANSPARENT = 0x00000020
189
- WS_EX_MDICHILD = 0x00000040
190
- WS_EX_TOOLWINDOW = 0x00000080
191
- WS_EX_WINDOWEDGE = 0x00000100
192
- WS_EX_CLIENTEDGE = 0x00000200
193
- WS_EX_CONTEXTHELP = 0x00000400
194
- WS_EX_RIGHT = 0x00001000
195
- WS_EX_LEFT = 0x00000000
196
- WS_EX_RTLREADING = 0x00002000
197
- WS_EX_LTRREADING = 0x00000000
198
- WS_EX_LEFTSCROLLBAR = 0x00004000
199
- WS_EX_RIGHTSCROLLBAR = 0x00000000
200
- WS_EX_CONTROLPARENT = 0x00010000
201
- WS_EX_STATICEDGE = 0x00020000
202
- WS_EX_APPWINDOW = 0x00040000
203
- WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE
204
- WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST
205
- WS_EX_LAYERED = 0x00080000
206
- WS_EX_NOINHERITLAYOUT = 0x00100000
207
- WS_EX_LAYOUTRTL = 0x00400000
208
- WS_EX_COMPOSITED = 0x02000000
209
- WS_EX_NOACTIVATE = 0x08000000
210
-
211
- CW_USEDEFAULT = -0x80000000
212
-
213
- class CREATESTRUCT < FFI::Struct
214
- layout \
215
- :lpCreateParams, :pointer,
216
- :hInstance, :pointer,
217
- :hMenu, :pointer,
218
- :hwndParent, :pointer,
219
- :cy, :int,
220
- :cx, :int,
221
- :y, :int,
222
- :x, :int,
223
- :style, :long,
224
- :lpszName, :pointer,
225
- :lpszClass, :pointer,
226
- :dwExStyle, :ulong
227
- end
228
-
229
- attach_function :CreateWindowEx, :CreateWindowExA, [:ulong, :string, :string, :ulong, :int, :int, :int, :int, :pointer, :pointer, :pointer, :pointer], :pointer
230
- attach_function :DestroyWindow, [:pointer], :int
231
-
232
- MDIS_ALLCHILDSTYLES = 0x0001
233
-
234
- class MDICREATESTRUCT < FFI::Struct
235
- layout \
236
- :szClass, :pointer,
237
- :szTitle, :pointer,
238
- :hOwner, :pointer,
239
- :x, :int,
240
- :y, :int,
241
- :cx, :int,
242
- :cy, :int,
243
- :style, :ulong,
244
- :lParam, :long
245
- end
246
-
247
- class CLIENTCREATESTRUCT < FFI::Struct
248
- layout \
249
- :hWindowMenu, :pointer,
250
- :idFirstChild, :uint
251
- end
252
-
253
- attach_function :CreateMDIWindow, :CreateMDIWindowA, [:string, :string, :ulong, :int, :int, :int, :int, :pointer, :pointer, :long], :pointer
254
-
255
- DS_ABSALIGN = 0x01
256
- DS_SYSMODAL = 0x02
257
- DS_LOCALEDIT = 0x20
258
- DS_SETFONT = 0x40
259
- DS_MODALFRAME = 0x80
260
- DS_NOIDLEMSG = 0x100
261
- DS_SETFOREGROUND = 0x200
262
- DS_3DLOOK = 0x0004
263
- DS_FIXEDSYS = 0x0008
264
- DS_NOFAILCREATE = 0x0010
265
- DS_CONTROL = 0x0400
266
- DS_CENTER = 0x0800
267
- DS_CENTERMOUSE = 0x1000
268
- DS_CONTEXTHELP = 0x2000
269
- DS_SHELLFONT = DS_SETFONT | DS_FIXEDSYS
270
-
271
- class DLGTEMPLATE < FFI::Struct
272
- layout \
273
- :style, :ulong,
274
- :dwExtendedStyle, :ulong,
275
- :cdit, :ushort,
276
- :x, :short,
277
- :y, :short,
278
- :cx, :short,
279
- :cy, :short,
280
- :menu, :ushort,
281
- :windowClass, :ushort,
282
- :title, :ushort
283
- end
284
-
285
- attach_function :CreateDialogIndirectParam, :CreateDialogIndirectParamA, [:pointer, :pointer, :pointer, :DLGPROC, :long], :pointer
286
- attach_function :DialogBoxIndirectParam, :DialogBoxIndirectParamA, [:pointer, :pointer, :pointer, :DLGPROC, :long], :int
287
- attach_function :EndDialog, [:pointer, :int], :int
288
-
289
- GWL_WNDPROC = -4
290
- GWL_HINSTANCE = -6
291
- GWL_HWNDPARENT = -8
292
- GWL_STYLE = -16
293
- GWL_EXSTYLE = -20
294
- GWL_USERDATA = -21
295
- GWL_ID = -12
296
-
297
- GWLP_WNDPROC = -4
298
- GWLP_HINSTANCE = -6
299
- GWLP_HWNDPARENT = -8
300
- GWLP_USERDATA = -21
301
- GWLP_ID = -12
302
-
303
- DWL_MSGRESULT = 0
304
- DWL_DLGPROC = 4
305
- DWL_USER = 8
306
-
307
- attach_function :GetWindowLong, :GetWindowLongA, [:pointer, :int], :long
308
- attach_function :SetWindowLong, :SetWindowLongA, [:pointer, :int, :long], :long
309
-
310
- attach_function :IsWindowEnabled, [:pointer], :int
311
- attach_function :EnableWindow, [:pointer, :int], :int
312
-
313
- attach_function :IsWindowVisible, [:pointer], :int
314
-
315
- SW_HIDE = 0
316
- SW_SHOWNORMAL = 1
317
- SW_NORMAL = 1
318
- SW_SHOWMINIMIZED = 2
319
- SW_SHOWMAXIMIZED = 3
320
- SW_MAXIMIZE = 3
321
- SW_SHOWNOACTIVATE = 4
322
- SW_SHOW = 5
323
- SW_MINIMIZE = 6
324
- SW_SHOWMINNOACTIVE = 7
325
- SW_SHOWNA = 8
326
- SW_RESTORE = 9
327
- SW_SHOWDEFAULT = 10
328
- SW_FORCEMINIMIZE = 11
329
- SW_MAX = 11
330
- SW_PARENTCLOSING = 1
331
- SW_OTHERZOOM = 2
332
- SW_PARENTOPENING = 3
333
- SW_OTHERUNZOOM = 4
334
- SW_SCROLLCHILDREN = 0x0001
335
- SW_INVALIDATE = 0x0002
336
- SW_ERASE = 0x0004
337
- SW_SMOOTHSCROLL = 0x0010
338
-
339
- attach_function :ShowWindow, [:pointer, :int], :int
340
-
341
- attach_function :UpdateWindow, [:pointer], :int
342
-
343
- attach_function :GetFocus, [], :pointer
344
- attach_function :SetFocus, [:pointer], :pointer
345
-
346
- attach_function :GetWindowTextLength, :GetWindowTextLengthA, [:pointer], :int
347
- attach_function :GetWindowText, :GetWindowTextA, [:pointer, :pointer, :int], :int
348
- attach_function :SetWindowText, :SetWindowTextA, [:pointer, :string], :int
349
-
350
- attach_function :GetClientRect, [:pointer, :pointer], :int
351
- attach_function :GetWindowRect, [:pointer, :pointer], :int
352
-
353
- SWP_NOSIZE = 0x0001
354
- SWP_NOMOVE = 0x0002
355
- SWP_NOZORDER = 0x0004
356
- SWP_NOREDRAW = 0x0008
357
- SWP_NOACTIVATE = 0x0010
358
- SWP_FRAMECHANGED = 0x0020
359
- SWP_SHOWWINDOW = 0x0040
360
- SWP_HIDEWINDOW = 0x0080
361
- SWP_NOCOPYBITS = 0x0100
362
- SWP_NOOWNERZORDER = 0x0200
363
- SWP_NOSENDCHANGING = 0x0400
364
- SWP_DRAWFRAME = SWP_FRAMECHANGED
365
- SWP_NOREPOSITION = SWP_NOOWNERZORDER
366
- SWP_DEFERERASE = 0x2000
367
- SWP_ASYNCWINDOWPOS = 0x4000
368
-
369
- attach_function :SetWindowPos, [:pointer, :pointer, :int, :int, :int, :int, :uint], :int
370
-
371
- attach_function :BeginDeferWindowPos, [:int], :pointer
372
- attach_function :DeferWindowPos, [:pointer, :pointer, :pointer, :int, :int, :int, :int, :uint], :pointer
373
- attach_function :EndDeferWindowPos, [:pointer], :int
374
-
375
- MDITILE_VERTICAL = 0x0000
376
- MDITILE_HORIZONTAL = 0x0001
377
- MDITILE_SKIPDISABLED = 0x0002
378
- MDITILE_ZORDER = 0x0004
379
-
380
- attach_function :TileWindows, [:pointer, :uint, :pointer, :uint, :pointer], :ushort
381
-
382
- attach_function :CascadeWindows, [:pointer, :uint, :pointer, :uint, :pointer], :ushort
383
- attach_function :ArrangeIconicWindows, [:pointer], :uint
384
-
385
- attach_function :GetCursorPos, [:pointer], :int
386
-
387
- attach_function :ScreenToClient, [:pointer, :pointer], :int
388
- attach_function :ClientToScreen, [:pointer, :pointer], :int
389
-
390
- attach_function :GetCapture, [], :pointer
391
- attach_function :SetCapture, [:pointer], :pointer
392
- attach_function :ReleaseCapture, [], :int
393
-
394
- attach_function :GetDC, [:pointer], :pointer
395
- attach_function :ReleaseDC, [:pointer, :pointer], :int
396
-
397
- class PAINTSTRUCT < FFI::Struct
398
- layout \
399
- :hdc, :pointer,
400
- :fErase, :int,
401
- :rcPaint, RECT,
402
- :fRestore, :int,
403
- :fIncUpdate, :int,
404
- :rgbReserved, [:uchar, 32]
405
- end
406
-
407
- attach_function :BeginPaint, [:pointer, :pointer], :pointer
408
- attach_function :EndPaint, [:pointer, :pointer], :int
409
-
410
- attach_function :InvalidateRect, [:pointer, :pointer, :int], :int
411
-
412
- attach_function :FillRect, [:pointer, :pointer, :pointer], :int
413
-
414
- DT_TOP = 0x00000000
415
- DT_LEFT = 0x00000000
416
- DT_CENTER = 0x00000001
417
- DT_RIGHT = 0x00000002
418
- DT_VCENTER = 0x00000004
419
- DT_BOTTOM = 0x00000008
420
- DT_WORDBREAK = 0x00000010
421
- DT_SINGLELINE = 0x00000020
422
- DT_EXPANDTABS = 0x00000040
423
- DT_TABSTOP = 0x00000080
424
- DT_NOCLIP = 0x00000100
425
- DT_EXTERNALLEADING = 0x00000200
426
- DT_CALCRECT = 0x00000400
427
- DT_NOPREFIX = 0x00000800
428
- DT_INTERNAL = 0x00001000
429
- DT_EDITCONTROL = 0x00002000
430
- DT_PATH_ELLIPSIS = 0x00004000
431
- DT_END_ELLIPSIS = 0x00008000
432
- DT_MODIFYSTRING = 0x00010000
433
- DT_RTLREADING = 0x00020000
434
- DT_WORD_ELLIPSIS = 0x00040000
435
- DT_NOFULLWIDTHCHARBREAK = 0x00080000
436
- DT_HIDEPREFIX = 0x00100000
437
- DT_PREFIXONLY = 0x00200000
438
-
439
- attach_function :DrawText, :DrawTextA, [:pointer, :string, :int, :pointer, :uint], :int
440
-
441
- attach_function :GetMenu, [:pointer], :pointer
442
- attach_function :SetMenu, [:pointer, :pointer], :int
443
-
444
- attach_function :DrawMenuBar, [:pointer], :int
445
-
446
- attach_function :GetDlgItem, [:pointer, :int], :pointer
447
-
448
- GW_HWNDFIRST = 0
449
- GW_HWNDLAST = 1
450
- GW_HWNDNEXT = 2
451
- GW_HWNDPREV = 3
452
- GW_OWNER = 4
453
- GW_CHILD = 5
454
- GW_ENABLEDPOPUP = 6
455
- GW_MAX = 6
456
-
457
- attach_function :GetWindow, [:pointer, :uint], :pointer
458
-
459
- callback :WNDENUMPROC, [:pointer, :long], :int
460
-
461
- attach_function :EnumChildWindows, [:pointer, :WNDENUMPROC, :long], :int
462
- end
463
- end
1
+ require_relative 'Window/Window'
2
+ require_relative 'Window/View'
3
+ require_relative 'Window/Container'
4
+ require_relative 'Window/MDI'
5
+ require_relative 'Window/Dialog'