ffi-wingui-core 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/Command.rbw +34 -7
- data/examples/Hello.rbw +2 -2
- data/examples/HelloOptout.rbw +14 -0
- data/examples/{Hello1.rbw → HelloTimeout.rbw} +2 -2
- data/examples/LifeCycle.rbw +6 -4
- data/examples/{LifeCycle1.rbw → LifeCycleNC.rbw} +6 -4
- data/examples/Menu.rbw +288 -0
- data/examples/MenuContext.rbw +164 -0
- data/examples/MenuPARGB32.rbw +326 -0
- data/examples/Minimal.rbw +6 -4
- data/examples/Scribble.rbw +4 -18
- data/examples/WndExtra.rbw +6 -4
- data/examples/res/face-devilish.bmp +0 -0
- data/lib/ffi-wingui-core.rb +233 -62
- metadata +11 -6
data/examples/Minimal.rbw
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'ffi-wingui-core'
|
2
2
|
|
3
|
-
|
3
|
+
exit if defined?(Ocra)
|
4
4
|
|
5
|
-
|
5
|
+
include WinGUI
|
6
6
|
|
7
7
|
APPNAME = L(File.basename(__FILE__, '.rbw'))
|
8
8
|
|
@@ -42,7 +42,9 @@ def main
|
|
42
42
|
wc[:hInstance] = GetModuleHandle(nil)
|
43
43
|
wc[:hIcon] = LoadIcon(nil, IDI_APPLICATION)
|
44
44
|
wc[:hCursor] = LoadCursor(nil, IDC_ARROW)
|
45
|
-
wc[:hbrBackground] = FFI::Pointer.new(
|
45
|
+
wc[:hbrBackground] = FFI::Pointer.new(
|
46
|
+
((WINVER == WINXP) ? COLOR_MENUBAR : COLOR_MENU) + 1
|
47
|
+
)
|
46
48
|
|
47
49
|
PWSTR(APPNAME) { |className|
|
48
50
|
wc[:lpszClassName] = className
|
@@ -54,7 +56,7 @@ def main
|
|
54
56
|
}
|
55
57
|
|
56
58
|
hwnd = CreateWindowEx(
|
57
|
-
0, APPNAME, APPNAME, WS_OVERLAPPEDWINDOW,
|
59
|
+
0, APPNAME, APPNAME, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
|
58
60
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
59
61
|
nil, nil, GetModuleHandle(nil), nil
|
60
62
|
)
|
data/examples/Scribble.rbw
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
require 'ffi-wingui-core'
|
2
2
|
|
3
|
-
|
3
|
+
exit if defined?(Ocra)
|
4
4
|
|
5
|
-
|
5
|
+
include WinGUI
|
6
6
|
|
7
7
|
APPNAME = L(File.basename(__FILE__, '.rbw'))
|
8
8
|
|
9
9
|
WndExtra = Struct.new(
|
10
10
|
:scribbles,
|
11
11
|
:hpen
|
12
|
-
)
|
13
|
-
|
14
|
-
class WndExtra
|
15
|
-
REFS = {}
|
16
|
-
|
17
|
-
def initialize(*args)
|
18
|
-
super
|
19
|
-
|
20
|
-
REFS[object_id] = self
|
21
|
-
|
22
|
-
ObjectSpace.define_finalizer(self, -> id {
|
23
|
-
REFS.delete(id)
|
24
|
-
})
|
25
|
-
end
|
26
|
-
end
|
12
|
+
).send(:include, Util::Id2RefTracking)
|
27
13
|
|
28
14
|
def onCreate(hwnd,
|
29
15
|
cs
|
@@ -212,7 +198,7 @@ def main
|
|
212
198
|
}
|
213
199
|
|
214
200
|
hwnd = CreateWindowEx(
|
215
|
-
|
201
|
+
WS_EX_CLIENTEDGE, APPNAME, APPNAME, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
|
216
202
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
217
203
|
nil, nil, GetModuleHandle(nil), FFI::Pointer.new(xtra.object_id)
|
218
204
|
)
|
data/examples/WndExtra.rbw
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'ffi-wingui-core'
|
2
2
|
|
3
|
-
|
3
|
+
exit if defined?(Ocra)
|
4
4
|
|
5
|
-
|
5
|
+
include WinGUI
|
6
6
|
|
7
7
|
APPNAME = L(File.basename(__FILE__, '.rbw'))
|
8
8
|
|
@@ -78,7 +78,9 @@ def main
|
|
78
78
|
wc[:hInstance] = GetModuleHandle(nil)
|
79
79
|
wc[:hIcon] = LoadIcon(nil, IDI_APPLICATION)
|
80
80
|
wc[:hCursor] = LoadCursor(nil, IDC_ARROW)
|
81
|
-
wc[:hbrBackground] = FFI::Pointer.new(
|
81
|
+
wc[:hbrBackground] = FFI::Pointer.new(
|
82
|
+
((WINVER == WINXP) ? COLOR_MENUBAR : COLOR_MENU) + 1
|
83
|
+
)
|
82
84
|
|
83
85
|
PWSTR(APPNAME) { |className|
|
84
86
|
wc[:lpszClassName] = className
|
@@ -90,7 +92,7 @@ def main
|
|
90
92
|
}
|
91
93
|
|
92
94
|
hwnd = CreateWindowEx(
|
93
|
-
0, APPNAME, APPNAME, WS_OVERLAPPEDWINDOW,
|
95
|
+
0, APPNAME, APPNAME, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
|
94
96
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
95
97
|
nil, nil, GetModuleHandle(nil), FFI::Pointer.new(xtra.object_id)
|
96
98
|
)
|
Binary file
|
data/lib/ffi-wingui-core.rb
CHANGED
@@ -29,6 +29,14 @@ module WinGUI
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
unless FFI::Struct.respond_to?(:by_ref)
|
33
|
+
class << FFI::Struct
|
34
|
+
def by_ref(*args)
|
35
|
+
FFI::Type::Builtin::POINTER
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
32
40
|
module ScopedStruct
|
33
41
|
def new(*args)
|
34
42
|
raise ArgumentError, 'Cannot accept both arguments and a block' if
|
@@ -51,7 +59,9 @@ module WinGUI
|
|
51
59
|
end
|
52
60
|
end
|
53
61
|
|
62
|
+
#{ INVALID_xxx
|
54
63
|
INVALID_HANDLE_VALUE = FFI::Pointer.new(-1)
|
64
|
+
#}
|
55
65
|
|
56
66
|
def MAKEWORD(lobyte, hibyte)
|
57
67
|
(lobyte & 0xff) | ((hibyte & 0xff) << 8)
|
@@ -65,6 +75,8 @@ module WinGUI
|
|
65
75
|
(word >> 8) & 0xff
|
66
76
|
end
|
67
77
|
|
78
|
+
module_function :MAKEWORD, :LOBYTE, :HIBYTE
|
79
|
+
|
68
80
|
def MAKELONG(loword, hiword)
|
69
81
|
(loword & 0xffff) | ((hiword & 0xffff) << 16)
|
70
82
|
end
|
@@ -77,9 +89,7 @@ module WinGUI
|
|
77
89
|
(long >> 16) & 0xffff
|
78
90
|
end
|
79
91
|
|
80
|
-
module_function
|
81
|
-
:MAKEWORD, :LOBYTE, :HIBYTE,
|
82
|
-
:MAKELONG, :LOWORD, :HIWORD
|
92
|
+
module_function :MAKELONG, :LOWORD, :HIWORD
|
83
93
|
|
84
94
|
def L(str)
|
85
95
|
(str << "\0").encode!('utf-16le')
|
@@ -184,7 +194,7 @@ module WinGUI
|
|
184
194
|
end
|
185
195
|
|
186
196
|
attach_function :GetVersionEx, :GetVersionExW, [
|
187
|
-
|
197
|
+
OSVERSIONINFOEX.by_ref
|
188
198
|
], :int
|
189
199
|
|
190
200
|
OSVERSION = OSVERSIONINFOEX.new.tap { |ovi|
|
@@ -249,14 +259,6 @@ module WinGUI
|
|
249
259
|
|
250
260
|
WINVER = HIWORD(NTDDI_VERSION)
|
251
261
|
|
252
|
-
if WINVER == WIN2K
|
253
|
-
class << FFI::Struct
|
254
|
-
def by_ref(*args)
|
255
|
-
FFI::Type::Builtin::POINTER
|
256
|
-
end
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
262
|
attach_function :GetModuleHandle, :GetModuleHandleW, [
|
261
263
|
:buffer_in
|
262
264
|
], :pointer
|
@@ -375,6 +377,9 @@ module WinGUI
|
|
375
377
|
|
376
378
|
module_function :EnableVisualStyles
|
377
379
|
|
380
|
+
EnableVisualStyles() unless
|
381
|
+
Object.const_defined?(:WINGUI_VISUAL_STYLES) && !WINGUI_VISUAL_STYLES
|
382
|
+
|
378
383
|
attach_function :MulDiv, [
|
379
384
|
:int,
|
380
385
|
:int,
|
@@ -535,7 +540,7 @@ module WinGUI
|
|
535
540
|
], :int
|
536
541
|
|
537
542
|
Detonate(0, :SetProcessDPIAware) unless
|
538
|
-
Object.const_defined?(:
|
543
|
+
Object.const_defined?(:WINGUI_DPI_AWARE) && !WINGUI_DPI_AWARE
|
539
544
|
end
|
540
545
|
|
541
546
|
attach_function :GetDC, [
|
@@ -682,6 +687,7 @@ module WinGUI
|
|
682
687
|
:ulong
|
683
688
|
], :int
|
684
689
|
rescue FFI::NotFoundError # MessageBoxTimeout is undocumented
|
690
|
+
|
685
691
|
end
|
686
692
|
end
|
687
693
|
|
@@ -713,6 +719,30 @@ module WinGUI
|
|
713
719
|
:long
|
714
720
|
], :long
|
715
721
|
|
722
|
+
#{ IMAGE_xxx
|
723
|
+
IMAGE_BITMAP = 0
|
724
|
+
IMAGE_ICON = 1
|
725
|
+
IMAGE_CURSOR = 2
|
726
|
+
#}
|
727
|
+
|
728
|
+
#{ LR_xxx
|
729
|
+
LR_SHARED = 0x00008000
|
730
|
+
LR_LOADFROMFILE = 0x00000010
|
731
|
+
LR_CREATEDIBSECTION = 0x00002000
|
732
|
+
LR_LOADTRANSPARENT = 0x00000020
|
733
|
+
LR_LOADMAP3DCOLORS = 0x00001000
|
734
|
+
LR_DEFAULTSIZE = 0x00000040
|
735
|
+
#}
|
736
|
+
|
737
|
+
attach_function :LoadImage, :LoadImageW, [
|
738
|
+
:pointer,
|
739
|
+
:buffer_in,
|
740
|
+
:uint,
|
741
|
+
:int,
|
742
|
+
:int,
|
743
|
+
:uint
|
744
|
+
], :pointer
|
745
|
+
|
716
746
|
#{ IDI_xxx
|
717
747
|
IDI_WINLOGO = FFI::Pointer.new(32517)
|
718
748
|
IDI_APPLICATION = FFI::Pointer.new(32512)
|
@@ -732,11 +762,16 @@ module WinGUI
|
|
732
762
|
], :pointer
|
733
763
|
|
734
764
|
#{ IDC_xxx
|
735
|
-
IDC_ARROW = FFI::Pointer.new(32512)
|
736
765
|
IDC_WAIT = FFI::Pointer.new(32514)
|
737
766
|
IDC_APPSTARTING = FFI::Pointer.new(32650)
|
767
|
+
|
768
|
+
IDC_ARROW = FFI::Pointer.new(32512)
|
738
769
|
IDC_HAND = FFI::Pointer.new(32649)
|
770
|
+
IDC_IBEAM = FFI::Pointer.new(32513)
|
739
771
|
IDC_CROSS = FFI::Pointer.new(32515)
|
772
|
+
IDC_HELP = FFI::Pointer.new(32651)
|
773
|
+
IDC_NO = FFI::Pointer.new(32648)
|
774
|
+
|
740
775
|
IDC_SIZEALL = FFI::Pointer.new(32646)
|
741
776
|
IDC_SIZENS = FFI::Pointer.new(32645)
|
742
777
|
IDC_SIZEWE = FFI::Pointer.new(32644)
|
@@ -749,11 +784,23 @@ module WinGUI
|
|
749
784
|
:buffer_in
|
750
785
|
], :pointer
|
751
786
|
|
752
|
-
|
787
|
+
attach_function :SetCursorPos, [
|
788
|
+
:int,
|
789
|
+
:int
|
790
|
+
], :int
|
791
|
+
|
792
|
+
attach_function :GetCursorPos, [
|
793
|
+
POINT.by_ref(:out)
|
794
|
+
], :int
|
795
|
+
|
796
|
+
#{ COLOR_xxx
|
753
797
|
COLOR_DESKTOP = 1
|
754
798
|
COLOR_APPWORKSPACE = 12
|
755
799
|
COLOR_WINDOW = 5
|
756
|
-
|
800
|
+
if WINVER >= WINXP
|
801
|
+
COLOR_MENUBAR = 30
|
802
|
+
end
|
803
|
+
COLOR_MENU = 4
|
757
804
|
#}
|
758
805
|
|
759
806
|
class WNDCLASSEX < FFI::Struct
|
@@ -789,6 +836,32 @@ module WinGUI
|
|
789
836
|
WNDCLASSEX.by_ref(:out)
|
790
837
|
], :int
|
791
838
|
|
839
|
+
#{ WS_EX_xxx
|
840
|
+
WS_EX_WINDOWEDGE = 0x00000100
|
841
|
+
WS_EX_CLIENTEDGE = 0x00000200
|
842
|
+
WS_EX_STATICEDGE = 0x00020000
|
843
|
+
WS_EX_DLGMODALFRAME = 0x00000001
|
844
|
+
WS_EX_CONTEXTHELP = 0x00000400
|
845
|
+
WS_EX_ACCEPTFILES = 0x00000010
|
846
|
+
|
847
|
+
WS_EX_TOPMOST = 0x00000008
|
848
|
+
WS_EX_LAYERED = 0x00080000
|
849
|
+
if WINVER >= WINXP
|
850
|
+
WS_EX_COMPOSITED = 0x02000000
|
851
|
+
end
|
852
|
+
WS_EX_TRANSPARENT = 0x00000020
|
853
|
+
|
854
|
+
WS_EX_NOPARENTNOTIFY = 0x00000004
|
855
|
+
|
856
|
+
WS_EX_APPWINDOW = 0x00040000
|
857
|
+
WS_EX_OVERLAPPEDWINDOW = \
|
858
|
+
WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE
|
859
|
+
WS_EX_TOOLWINDOW = 0x00000080
|
860
|
+
WS_EX_PALETTEWINDOW = WS_EX_TOOLWINDOW |
|
861
|
+
WS_EX_WINDOWEDGE | WS_EX_TOPMOST
|
862
|
+
WS_EX_CONTROLPARENT = 0x00010000
|
863
|
+
#}
|
864
|
+
|
792
865
|
#{ WS_xxx
|
793
866
|
WS_BORDER = 0x00800000
|
794
867
|
WS_DLGFRAME = 0x00400000
|
@@ -799,24 +872,24 @@ module WinGUI
|
|
799
872
|
WS_MAXIMIZEBOX = 0x00010000
|
800
873
|
WS_HSCROLL = 0x00100000
|
801
874
|
WS_VSCROLL = 0x00200000
|
875
|
+
|
802
876
|
WS_DISABLED = 0x08000000
|
803
877
|
WS_VISIBLE = 0x10000000
|
804
878
|
WS_MINIMIZE = 0x20000000
|
805
879
|
WS_MAXIMIZE = 0x01000000
|
806
880
|
WS_CLIPCHILDREN = 0x02000000
|
807
|
-
|
881
|
+
|
808
882
|
WS_GROUP = 0x00020000
|
809
883
|
WS_TABSTOP = 0x00010000
|
884
|
+
WS_CLIPSIBLINGS = 0x04000000
|
810
885
|
|
811
886
|
WS_OVERLAPPED = 0x00000000
|
812
887
|
WS_OVERLAPPEDWINDOW = WS_OVERLAPPED |
|
813
888
|
WS_CAPTION | WS_SYSMENU |
|
814
889
|
WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
|
815
|
-
|
816
890
|
WS_POPUP = 0x80000000
|
817
891
|
WS_POPUPWINDOW = WS_POPUP |
|
818
892
|
WS_BORDER | WS_SYSMENU
|
819
|
-
|
820
893
|
WS_CHILD = 0x40000000
|
821
894
|
WS_CHILDWINDOW = WS_CHILD
|
822
895
|
#}
|
@@ -881,13 +954,13 @@ module WinGUI
|
|
881
954
|
], :int
|
882
955
|
|
883
956
|
#{ GWL_xxx
|
957
|
+
GWL_WNDPROC = -4
|
884
958
|
GWL_EXSTYLE = -20
|
885
959
|
GWL_STYLE = -16
|
886
960
|
GWL_HWNDPARENT = -8
|
887
961
|
GWL_ID = -12
|
888
962
|
GWL_HINSTANCE = -6
|
889
963
|
GWL_USERDATA = -21
|
890
|
-
GWL_WNDPROC = -4
|
891
964
|
#}
|
892
965
|
|
893
966
|
attach_function :SetWindowLong, :SetWindowLongW, [
|
@@ -917,11 +990,8 @@ module WinGUI
|
|
917
990
|
#{ SW_xxx
|
918
991
|
SW_HIDE = 0
|
919
992
|
SW_SHOW = 5
|
920
|
-
SW_SHOWNA = 8
|
921
993
|
SW_SHOWNORMAL = 1
|
922
|
-
SW_SHOWNOACTIVATE = 4
|
923
994
|
SW_SHOWMINIMIZED = 2
|
924
|
-
SW_SHOWMINNOACTIVE = 7
|
925
995
|
SW_SHOWMAXIMIZED = 3
|
926
996
|
SW_RESTORE = 9
|
927
997
|
#}
|
@@ -939,21 +1009,11 @@ module WinGUI
|
|
939
1009
|
#}
|
940
1010
|
|
941
1011
|
#{ SWP_xxx
|
942
|
-
SWP_NOSIZE = 0x0001
|
943
|
-
SWP_NOMOVE = 0x0002
|
944
|
-
SWP_NOZORDER = 0x0004
|
945
|
-
SWP_NOREDRAW = 0x0008
|
946
|
-
SWP_NOACTIVATE = 0x0010
|
947
1012
|
SWP_FRAMECHANGED = 0x0020
|
948
|
-
SWP_SHOWWINDOW = 0x0040
|
949
|
-
SWP_HIDEWINDOW = 0x0080
|
950
|
-
SWP_NOCOPYBITS = 0x0100
|
951
1013
|
SWP_NOOWNERZORDER = 0x0200
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
SWP_DEFERERASE = 0x2000
|
956
|
-
SWP_ASYNCWINDOWPOS = 0x4000
|
1014
|
+
SWP_NOZORDER = 0x0004
|
1015
|
+
SWP_NOMOVE = 0x0002
|
1016
|
+
SWP_NOSIZE = 0x0001
|
957
1017
|
#}
|
958
1018
|
|
959
1019
|
attach_function :SetWindowPos, [
|
@@ -995,10 +1055,6 @@ module WinGUI
|
|
995
1055
|
RECT.by_ref(:out)
|
996
1056
|
], :int
|
997
1057
|
|
998
|
-
attach_function :GetCursorPos, [
|
999
|
-
POINT.by_ref(:out)
|
1000
|
-
], :int
|
1001
|
-
|
1002
1058
|
attach_function :ScreenToClient, [
|
1003
1059
|
:pointer,
|
1004
1060
|
POINT.by_ref
|
@@ -1015,28 +1071,16 @@ module WinGUI
|
|
1015
1071
|
:int
|
1016
1072
|
], :int
|
1017
1073
|
|
1018
|
-
attach_function :UpdateWindow, [
|
1019
|
-
:pointer
|
1020
|
-
], :int
|
1021
|
-
|
1022
|
-
attach_function :SetCapture, [
|
1023
|
-
:pointer
|
1024
|
-
], :pointer
|
1025
|
-
|
1026
|
-
attach_function :ReleaseCapture, [
|
1027
|
-
|
1028
|
-
], :int
|
1029
|
-
|
1030
|
-
attach_function :GetCapture, [
|
1031
|
-
|
1032
|
-
], :pointer
|
1033
|
-
|
1034
1074
|
attach_function :GetUpdateRect, [
|
1035
1075
|
:pointer,
|
1036
1076
|
RECT.by_ref(:out),
|
1037
1077
|
:int
|
1038
1078
|
], :int
|
1039
1079
|
|
1080
|
+
attach_function :UpdateWindow, [
|
1081
|
+
:pointer
|
1082
|
+
], :int
|
1083
|
+
|
1040
1084
|
class PAINTSTRUCT < FFI::Struct
|
1041
1085
|
extend Util::ScopedStruct
|
1042
1086
|
|
@@ -1059,6 +1103,18 @@ module WinGUI
|
|
1059
1103
|
PAINTSTRUCT.by_ref(:in)
|
1060
1104
|
], :int
|
1061
1105
|
|
1106
|
+
attach_function :SetCapture, [
|
1107
|
+
:pointer
|
1108
|
+
], :pointer
|
1109
|
+
|
1110
|
+
attach_function :ReleaseCapture, [
|
1111
|
+
|
1112
|
+
], :int
|
1113
|
+
|
1114
|
+
attach_function :GetCapture, [
|
1115
|
+
|
1116
|
+
], :pointer
|
1117
|
+
|
1062
1118
|
attach_function :SetMenu, [
|
1063
1119
|
:pointer,
|
1064
1120
|
:pointer
|
@@ -1077,6 +1133,18 @@ module WinGUI
|
|
1077
1133
|
:int
|
1078
1134
|
], :pointer
|
1079
1135
|
|
1136
|
+
attach_function :GetDlgCtrlID, [
|
1137
|
+
:pointer
|
1138
|
+
], :int
|
1139
|
+
|
1140
|
+
attach_function :SetFocus, [
|
1141
|
+
:pointer
|
1142
|
+
], :pointer
|
1143
|
+
|
1144
|
+
attach_function :GetFocus, [
|
1145
|
+
|
1146
|
+
], :pointer
|
1147
|
+
|
1080
1148
|
#{ HWND_xxx
|
1081
1149
|
HWND_BROADCAST = FFI::Pointer.new(0xffff)
|
1082
1150
|
#}
|
@@ -1108,34 +1176,45 @@ module WinGUI
|
|
1108
1176
|
WM_DESTROY = 0x0002
|
1109
1177
|
WM_NCDESTROY = 0x0082
|
1110
1178
|
|
1179
|
+
#{ WA_xxx
|
1180
|
+
WA_INACTIVE = 0
|
1181
|
+
WA_ACTIVE = 1
|
1182
|
+
WA_CLICKACTIVE = 2
|
1183
|
+
#}
|
1184
|
+
|
1185
|
+
WM_ACTIVATE = 0x0006
|
1186
|
+
|
1111
1187
|
WM_SETFONT = 0x0030
|
1112
1188
|
WM_GETFONT = 0x0031
|
1113
1189
|
|
1114
1190
|
WM_PAINT = 0x000F
|
1115
1191
|
|
1116
1192
|
def GET_X_LPARAM(lParam)
|
1117
|
-
((x = LOWORD(lParam)) > 0x7fff) ?
|
1118
|
-
x - 0x1_0000 :
|
1119
|
-
x
|
1193
|
+
((x = LOWORD(lParam)) > 0x7fff) ? x - 0x1_0000 : x
|
1120
1194
|
end
|
1121
1195
|
|
1122
1196
|
def GET_Y_LPARAM(lParam)
|
1123
|
-
((y = HIWORD(lParam)) > 0x7fff) ?
|
1124
|
-
y - 0x1_0000 :
|
1125
|
-
y
|
1197
|
+
((y = HIWORD(lParam)) > 0x7fff) ? y - 0x1_0000 : y
|
1126
1198
|
end
|
1127
1199
|
|
1200
|
+
module_function :GET_X_LPARAM, :GET_Y_LPARAM
|
1201
|
+
|
1128
1202
|
WM_LBUTTONDOWN = 0x0201
|
1129
1203
|
WM_LBUTTONUP = 0x0202
|
1130
1204
|
WM_LBUTTONDBLCLK = 0x0203
|
1205
|
+
|
1131
1206
|
WM_RBUTTONDOWN = 0x0204
|
1132
1207
|
WM_RBUTTONUP = 0x0205
|
1133
1208
|
WM_RBUTTONDBLCLK = 0x0206
|
1209
|
+
|
1134
1210
|
WM_MBUTTONDOWN = 0x0207
|
1135
1211
|
WM_MBUTTONUP = 0x0208
|
1136
1212
|
WM_MBUTTONDBLCLK = 0x0209
|
1213
|
+
|
1137
1214
|
WM_MOUSEMOVE = 0x0200
|
1138
1215
|
|
1216
|
+
WM_CONTEXTMENU = 0x007B
|
1217
|
+
|
1139
1218
|
WM_COMMAND = 0x0111
|
1140
1219
|
|
1141
1220
|
class NMHDR < FFI::Struct
|
@@ -1149,6 +1228,7 @@ module WinGUI
|
|
1149
1228
|
|
1150
1229
|
WM_NOTIFY = 0x004E
|
1151
1230
|
|
1231
|
+
WM_USER = 0x0400
|
1152
1232
|
WM_APP = 0x8000
|
1153
1233
|
#}
|
1154
1234
|
|
@@ -1229,6 +1309,7 @@ module WinGUI
|
|
1229
1309
|
MF_MENUBARBREAK = 0x00000020
|
1230
1310
|
MF_MENUBREAK = 0x00000040
|
1231
1311
|
MF_RIGHTJUSTIFY = 0x00004000
|
1312
|
+
|
1232
1313
|
MF_ENABLED = 0x00000000
|
1233
1314
|
MF_DISABLED = 0x00000002
|
1234
1315
|
MF_GRAYED = 0x00000001
|
@@ -1246,6 +1327,23 @@ module WinGUI
|
|
1246
1327
|
:buffer_in
|
1247
1328
|
], :int
|
1248
1329
|
|
1330
|
+
attach_function :SetMenuDefaultItem, [
|
1331
|
+
:pointer,
|
1332
|
+
:uint,
|
1333
|
+
:uint
|
1334
|
+
], :int
|
1335
|
+
|
1336
|
+
#{ GMDI_xxx
|
1337
|
+
GMDI_USEDISABLED = 0x0001
|
1338
|
+
GMDI_GOINTOPOPUPS = 0x0002
|
1339
|
+
#}
|
1340
|
+
|
1341
|
+
attach_function :GetMenuDefaultItem, [
|
1342
|
+
:pointer,
|
1343
|
+
:uint,
|
1344
|
+
:uint
|
1345
|
+
], :uint
|
1346
|
+
|
1249
1347
|
#{ MF_xxx
|
1250
1348
|
MF_BYCOMMAND = 0x00000000
|
1251
1349
|
MF_BYPOSITION = 0x00000400
|
@@ -1284,6 +1382,79 @@ module WinGUI
|
|
1284
1382
|
:uint
|
1285
1383
|
], :uint
|
1286
1384
|
|
1385
|
+
MIIM_STATE = 0x00000001
|
1386
|
+
MIIM_ID = 0x00000002
|
1387
|
+
MIIM_SUBMENU = 0x00000004
|
1388
|
+
MIIM_CHECKMARKS = 0x00000008
|
1389
|
+
MIIM_TYPE = 0x00000010
|
1390
|
+
MIIM_DATA = 0x00000020
|
1391
|
+
MIIM_STRING = 0x00000040
|
1392
|
+
MIIM_BITMAP = 0x00000080
|
1393
|
+
MIIM_FTYPE = 0x00000100
|
1394
|
+
|
1395
|
+
class MENUITEMINFO < FFI::Struct
|
1396
|
+
extend Util::ScopedStruct
|
1397
|
+
|
1398
|
+
layout \
|
1399
|
+
:cbSize, :uint,
|
1400
|
+
:fMask, :uint,
|
1401
|
+
:fType, :uint,
|
1402
|
+
:fState, :uint,
|
1403
|
+
:wID, :uint,
|
1404
|
+
:hSubMenu, :pointer,
|
1405
|
+
:hbmpChecked, :pointer,
|
1406
|
+
:hbmpUnchecked, :pointer,
|
1407
|
+
:dwItemData, :ulong,
|
1408
|
+
:dwTypeData, :pointer,
|
1409
|
+
:cch, :uint,
|
1410
|
+
:hbmpItem, :pointer
|
1411
|
+
end
|
1412
|
+
|
1413
|
+
attach_function :SetMenuItemInfo, :SetMenuItemInfoW, [
|
1414
|
+
:pointer,
|
1415
|
+
:uint,
|
1416
|
+
:int,
|
1417
|
+
MENUITEMINFO.by_ref(:in)
|
1418
|
+
], :int
|
1419
|
+
|
1420
|
+
attach_function :GetMenuItemInfo, :GetMenuItemInfoW, [
|
1421
|
+
:pointer,
|
1422
|
+
:uint,
|
1423
|
+
:int,
|
1424
|
+
MENUITEMINFO.by_ref
|
1425
|
+
], :int
|
1426
|
+
|
1427
|
+
#{ TPM_xxx
|
1428
|
+
TPM_LEFTBUTTON = 0x0000
|
1429
|
+
TPM_RIGHTBUTTON = 0x0002
|
1430
|
+
|
1431
|
+
TPM_LEFTALIGN = 0x0000
|
1432
|
+
TPM_CENTERALIGN = 0x0004
|
1433
|
+
TPM_RIGHTALIGN = 0x0008
|
1434
|
+
|
1435
|
+
TPM_TOPALIGN = 0x0000
|
1436
|
+
TPM_VCENTERALIGN = 0x0010
|
1437
|
+
TPM_BOTTOMALIGN = 0x0020
|
1438
|
+
|
1439
|
+
TPM_HORIZONTAL = 0x0000
|
1440
|
+
TPM_VERTICAL = 0x0040
|
1441
|
+
|
1442
|
+
TPM_NONOTIFY = 0x0080
|
1443
|
+
TPM_RETURNCMD = 0x0100
|
1444
|
+
|
1445
|
+
TPM_RECURSE = 0x0001
|
1446
|
+
#}
|
1447
|
+
|
1448
|
+
attach_function :TrackPopupMenu, [
|
1449
|
+
:pointer,
|
1450
|
+
:uint,
|
1451
|
+
:int,
|
1452
|
+
:int,
|
1453
|
+
:int,
|
1454
|
+
:pointer,
|
1455
|
+
RECT.by_ref(:in)
|
1456
|
+
], :int
|
1457
|
+
|
1287
1458
|
#{ Fxxx
|
1288
1459
|
FVIRTKEY = 1
|
1289
1460
|
FCONTROL = 0x08
|