Changeset 282
- Timestamp:
- Jul 2, 2007, 1:33:52 AM (17 years ago)
- Location:
- Include
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/Drawing/Color.ab
r212 r282 112 112 Function GetHue() As Single 113 113 Dim max As Long, min As Long, d As Long 114 max = Math.Max(Math.Max(r, g), b) 115 min = Math.Min(Math.Min(r, g), b) 114 Dim r = R 115 Dim g = G 116 Dim b = B 117 max = System.Math.Max(System.Math.Max(r, g), b) 118 min = System.Math.Min(System.Math.Min(r, g), b) 116 119 d = max - min 117 120 If g = max Then … … 128 131 Function GetSaturation() As Single 129 132 Dim max As Long, min As Long 130 max = Math.Max(Math.Max(r, g), b) 131 min = Math.Min(Math.Min(r, g), b) 133 Dim r = R 134 Dim g = G 135 Dim b = B 136 max = System.Math.Max(System.Math.Max(r, g), b) 137 min = System.Math.Min(System.Math.Min(r, g), b) 132 138 Return (max - min) / max 133 139 End Function … … 135 141 Function GetBrightness() As Single 136 142 Dim max As Long 137 max = Math.Max(Math.Max(r, g), b) 143 Dim r = R 144 Dim g = G 145 Dim b = B 146 max = System.Math.Max(System.Math.Max(r, g), b) 138 147 Return max * (1 / 255) 139 148 End Function -
Include/Classes/System/Runtime/InteropServices/GCHandle.ab
r257 r282 2 2 3 3 #require <Classes/System/Collections/ArrayList.ab> 4 5 Namespace System 6 Namespace Runtime 7 Namespace InteropServices 4 8 5 9 Class GCHandle … … 65 69 handle As VoidPtr 66 70 67 Static allocated As ArrayList71 Static allocated As /*System.Collections.*/ArrayList 68 72 End Class 73 74 End Namespace 'System 75 End Namespace 'Runtime 76 End Namespace 'InteropServices -
Include/Classes/System/Windows/Forms/Control.ab
r240 r282 17 17 #require <Classes/System/Drawing/Rectangle.ab> 18 18 #require <Classes/System/Runtime/InteropServices/GCHandle.ab> 19 #require <Classes/ActiveBasic/Strings/Strings.ab> 20 21 Namespace System 22 Namespace Windows 23 Namespace Forms 24 25 Namespace Detail 19 26 20 27 TypeDef InvokeProc = *Function(p As VoidPtr) As VoidPtr 21 28 22 29 Class AsyncResultForInvoke 23 Inherits IAsyncResult30 Inherits System.IAsyncResult 24 31 Public 25 32 ' Properties … … 32 39 End Function 33 40 34 Override Function AsyncWaitHandle() As WaitHandle41 Override Function AsyncWaitHandle() As System.Threading.WaitHandle 35 42 Return waitHandle 36 43 End Function … … 53 60 54 61 Private 55 waitHandle As WaitHandle62 waitHandle As System.Threading.WaitHandle 56 63 result As VoidPtr 57 64 End Class … … 63 70 AsyncResult As AsyncResultForInvoke 64 71 End Class 72 73 End Namespace 'Detail 65 74 66 75 Class Control … … 290 299 ' 同期関数呼出、Controlが作成されたスレッドで関数を実行する。 291 300 ' 関数は同期的に呼び出されるので、関数が終わるまでInvokeは制御を戻さない。 292 Function Invoke(pfn As InvokeProc, p As VoidPtr) As VoidPtr301 Function Invoke(pfn As System.Windows.Forms.Detail.InvokeProc, p As VoidPtr) As VoidPtr 293 302 Return wnd.SendMessage(WM_CONTROL_INVOKE, p As WPARAM, pfn As LPARAM) As VoidPtr 294 303 End Function … … 297 306 ' 関数は非同期的に呼び出されるので、BeginInvokeはすぐに制御を戻す。 298 307 ' 後にEndInvokeを呼び出すことにより、関数の戻り値を受け取れる。 299 Function BeginInvoke(pfn As InvokeProc, p As VoidPtr) AsIAsyncResult308 Function BeginInvoke(pfn As System.Windows.Forms.Detail.InvokeProc, p As VoidPtr) As System.IAsyncResult 300 309 ' EndInvokeがDeleteする 301 Dim asyncResult = New AsyncResultForInvoke(CreateEvent(0, FALSE, FALSE, 0))310 Dim asyncResult = New System.Windows.Forms.Detail.AsyncResultForInvoke(CreateEvent(0, FALSE, FALSE, 0)) 302 311 ' OnControlBeginInvokeがDeleteする 303 Dim asyncInvokeData = New AsyncInvokeData312 Dim asyncInvokeData = New System.Windows.Forms.Detail.AsyncInvokeData 304 313 With asyncInvokeData 305 314 .FuncPtr = pfn … … 307 316 .AsyncResult = asyncResult 308 317 End With 309 Dim gch = GCHandle.Alloc(asyncInvokeData)310 wnd.PostMessage(WM_CONTROL_BEGININVOKE, 0, GCHandle.ToIntPtr(gch))318 Dim gch = System.Runtime.InteropServices.GCHandle.Alloc(asyncInvokeData) 319 wnd.PostMessage(WM_CONTROL_BEGININVOKE, 0, System.Runtime.InteropServices.GCHandle.ToIntPtr(gch)) 311 320 Return pAsyncResult 312 321 End Function … … 314 323 ' BeginInvokeで呼び出した関数の戻り値を受け取る。 315 324 ' その関数がまだ終了していない場合、終了するまで待機する。 316 Function EndInvoke(ar As IAsyncResult) As VoidPtr325 Function EndInvoke(ar As System.IAsyncResult) As VoidPtr 317 326 ar.WaitHandle.WaitOne() 318 Dim arInvoke = ar As AsyncResultForInvoke327 Dim arInvoke = ar As System.Windows.Forms.Detail.AsyncResultForInvoke 319 328 Return arInvoke.Result 320 329 End Function … … 327 336 If IsWindow(hwnd) Then 328 337 If GetClassLongPtr(hwnd, GCW_ATOM) = atom Then 329 Dim gch = GCHandle.FromIntPtr(GetWindowLongPtr(hwnd, GWLP_THIS))338 Dim gch = System.Runtime.InteropServices.GCHandle.FromIntPtr(GetWindowLongPtr(hwnd, GWLP_THIS)) 330 339 Return gch.Target As Control 331 340 End If … … 424 433 Select Case .Msg 425 434 Case WM_GETTEXTLENGTH 426 .Result = text.Length 435 .Result = text.Length 'ToDo: Unicode対応 427 436 Case WM_GETTEXT 428 Dim size = Math.Min(.WParam As ULONG_PTR, (text.Length + 1) As ULONG_PTR)429 memcpy(.LParam As PCTSTR, ToTCStr(text), size * SizeOf (TCHAR))437 Dim size = System.Math.Min(.WParam As SIZE_T, (text.Length + 1) As SIZE_T) 438 ActiveBasic.Strings.ChrCopy(.LParam As PCTSTR, ToTCStr(text), size) 430 439 .Result = size 431 440 Case WM_SETTEXT 432 441 text = New String(.LParam As PCTSTR) 433 442 Case WM_ENABLE 434 OnEnabledChanged( EventArgs.Empty)443 OnEnabledChanged(System.EventArgs.Empty) 435 444 Case WM_ERASEBKGND 436 445 ' OnPaintBackgroundに移すべき … … 443 452 DeleteObject(hbr) 444 453 Case WM_CONTROL_INVOKE 445 Dim pfn = .LParam As InvokeProc454 Dim pfn = .LParam As System.Windows.Forms.Detail.InvokeProc 446 455 .Result = pfn(m.WParam As VoidPtr) As LRESULT 447 456 Case WM_CONTROL_BEGININVOKE 448 457 OnControlBeginInvoke(m) 449 458 Case WM_CREATE 450 OnHandleCreated( EventArgs.Empty)459 OnHandleCreated(System.EventArgs.Empty) 451 460 Case WM_DESTROY 452 OnHandleDestroyed( EventArgs.Empty)461 OnHandleDestroyed(System.EventArgs.Empty) 453 462 Case Else 454 463 DefWndProc(m) … … 498 507 499 508 Virtual Sub OnPaintBackground(e As PaintEventArgs) : End Sub 500 Virtual Sub OnEnabledChanged(e As EventArgs) : End Sub501 Virtual Sub OnBackColorChanged(e As EventArgs) : End Sub502 Virtual Sub OnHandleCreated(e As EventArgs) : End Sub503 Virtual Sub OnHandleDestroyed(e As EventArgs) : End Sub504 Virtual Sub OnTextChanged(e As EventArgs)509 Virtual Sub OnEnabledChanged(e As System.EventArgs) : End Sub 510 Virtual Sub OnBackColorChanged(e As System.EventArgs) : End Sub 511 Virtual Sub OnHandleCreated(e As System.EventArgs) : End Sub 512 Virtual Sub OnHandleDestroyed(e As System.EventArgs) : End Sub 513 Virtual Sub OnTextChanged(e As System.EventArgs) 505 514 wnd.SetText(ToTCStr(text)) 506 515 End Sub … … 574 583 If Object.ReferenceEquals(rThis As Object, Nothing) Then 575 584 Dim gchValue = TlsGetValue(tlsIndex) As LONG_PTR 576 Dim gch = GCHandle.FromIntPtr(gchValue)585 Dim gch = System.Runtime.InteropServices.GCHandle.FromIntPtr(gchValue) 577 586 rThis = gch.Target As Control 578 587 ' ウィンドウが作られて最初にWndProcFirstが呼ばれたとき … … 593 602 ' BeginInvokeが呼ばれたときの処理 594 603 Sub OnControlBeginInvoke(m As Message) 595 Dim gch = GCHandle.FromIntPtr(m.LParam)596 Dim data = gch.Target As AsyncInvokeData604 Dim gch = System.Runtime.InteropServices.GCHandle.FromIntPtr(m.LParam) 605 Dim data = gch.Target As System.Windows.Forms.Detail.AsyncInvokeData 597 606 With data 598 607 Dim pfn = .FuncPtr … … 603 612 End Class 604 613 614 Namespace Detail 605 615 Class _System_ControlIinitializer 606 616 Public 607 617 Sub _System_ControlIinitializer(hinst As HINSTANCE) 608 Control.Initialize(hinst)618 System.Windows.Forms.Control.Initialize(hinst) 609 619 End Sub 610 620 611 621 Sub ~_System_ControlIinitializer() 612 Control.Uninitialize()622 System.Windows.Forms.Control.Uninitialize() 613 623 End Sub 614 624 End Class … … 618 628 #endif '_SYSTEM_NO_INITIALIZE_CONTROL_ 619 629 630 End Namespace 631 632 End Namespace 'Forms 633 End Namespace 'Widnows 634 End Namespace 'System 635 620 636 #endif '__SYSTEM_WINDOWS_FORMS_CONTROL_AB__ 621 637 -
Include/Classes/System/Windows/Forms/CreateParams.ab
r240 r282 3 3 #ifndef __SYSTEM_WINDOWS_FORMS_CREATEPARAMS_AB__ 4 4 #define __SYSTEM_WINDOWS_FORMS_CREATEPARAMS_AB__ 5 6 Namespace System 7 Namespace Windows 8 Namespace Forms 5 9 6 10 Class CreateParams … … 19 23 End Class 20 24 25 End Namespace 'Forms 26 End Namespace 'Widnows 27 End Namespace 'System 28 21 29 #endif '__SYSTEM_WINDOWS_FORMS_CREATEPARAMS_AB__ -
Include/Classes/System/Windows/Forms/Message.ab
r240 r282 5 5 6 6 #require <windows.sbp> 7 8 Namespace System 9 Namespace Windows 10 Namespace Forms 7 11 8 12 Class Message … … 87 91 End Class 88 92 93 End Namespace 'Forms 94 End Namespace 'Widnows 95 End Namespace 'System 96 89 97 #endif '__SYSTEM_WINDOWS_FORMS_MESSAGE_AB__ -
Include/Classes/System/Windows/Forms/PaintEventArgs.ab
r223 r282 6 6 #require <Classes/System/misc.ab> 7 7 8 Namespace System 9 Namespace Windows 10 Namespace Forms 11 8 12 Class PaintEventArgs 9 Inherits EventArgs13 Inherits System.EventArgs 10 14 End Class 11 15 16 End Namespace 'Forms 17 End Namespace 'Widnows 18 End Namespace 'System 19 12 20 #endif '__SYSTEM_WINDOWS_FORMS_PAINTEVENTARGS_AB__ -
Include/Classes/System/Windows/Forms/misc.ab
r223 r282 3 3 #ifndef __SYSTEM_WINDOWS_FORMS_MISC_AB__ 4 4 #define __SYSTEM_WINDOWS_FORMS_MISC_AB__ 5 6 Namespace System 7 Namespace Windows 8 Namespace Forms 5 9 6 10 Interface IWin32Window … … 19 23 End Enum 20 24 25 Enum Keys 26 LButton = VK_LBUTTON 27 RButton = VK_RBUTTON 28 Cancel = VK_CANCEL 29 MButton = VK_MBUTTON 30 XButton1 = VK_XBUTTON1 31 XButton2 = VK_XBUTTON2 32 Back = VK_BACK 33 Tab = VK_TAB 34 Clear = VK_CLEAR 35 Return_ = VK_RETURN 36 Shift = VK_SHIFT 37 Control = VK_CONTROL 38 Menu = VK_MENU 39 Pause = VK_PAUSE 40 Capital = VK_CAPITAL 41 KanaMode = VK_KANA 42 HangulMode = VK_HANGUL 43 JunjaMode = VK_JUNJA 44 FinalMode = VK_FINAL 45 HanjaMode = VK_HANJA 46 KanjiMode = VK_KANJI 47 Escape = VK_ESCAPE 48 IMEConvert = VK_CONVERT 49 IMENonconvert = VK_NONCONVERT 50 IMEAccept = VK_ACCEPT 51 IMEModeChange = VK_MODECHANGE 52 Space = VK_SPACE 53 PageUp = VK_PRIOR 54 PageDown = VK_NEXT 55 End_ = VK_END 56 Home = VK_HOME 57 Left = VK_LEFT 58 Up = VK_UP 59 Right = VK_RIGHT 60 Down = VK_DOWN 61 Select_ = VK_SELECT 62 Print = VK_PRINT 63 Execute = VK_EXECUTE 64 Snapshot = VK_SNAPSHOT 65 Insert = VK_INSERT 66 Delete_ = VK_DELETE 67 Help = VK_HELP 68 D0 = &h30 69 D1 = &h31 70 D2 = &h32 71 D3 = &h33 72 D4 = &h34 73 D5 = &h35 74 D6 = &h36 75 D7 = &h37 76 D8 = &h38 77 D9 = &h39 78 A = &h41 79 B = &h42 80 C = &h43 81 D = &h44 82 E = &h45 83 F = &h46 84 G = &h47 85 H = &h48 86 I = &h49 87 J = &h4a 88 K = &h4b 89 L = &h4c 90 M = &h4d 91 N = &h4e 92 O = &h4f 93 P = &h50 94 Q = &h51 95 R = &h52 96 S = &h53 97 T = &h54 98 U = &h55 99 V = &h56 100 W = &h57 101 X = &h58 102 Y = &h59 103 Z = &h5A 104 LWin = VK_LWIN 105 RWin = VK_RWIN 106 Apps = VK_APPS 107 Sleep = VK_SLEEP 108 NumPad0 = VK_NUMPAD0 109 NumPad1 = VK_NUMPAD1 110 NumPad2 = VK_NUMPAD2 111 NumPad3 = VK_NUMPAD3 112 NumPad4 = VK_NUMPAD4 113 NumPad5 = VK_NUMPAD5 114 NumPad6 = VK_NUMPAD6 115 NumPad7 = VK_NUMPAD7 116 NumPad8 = VK_NUMPAD8 117 NumPad9 = VK_NUMPAD9 118 Multiply = VK_MULTIPLY 119 Add = VK_ADD 120 Separator = VK_SEPARATOR 121 Substract = VK_SUBTRACT 122 Decimal = VK_DECIMAL 123 Divide = VK_DIVIDE 124 F1 = VK_F1 125 F2 = VK_F2 126 F3 = VK_F3 127 F4 = VK_F4 128 F5 = VK_F5 129 F6 = VK_F6 130 F7 = VK_F7 131 F8 = VK_F8 132 F9 = VK_F9 133 F10 = VK_F10 134 F11 = VK_F11 135 F12 = VK_F12 136 F13 = VK_F13 137 F14 = VK_F14 138 F15 = VK_F15 139 F16 = VK_F16 140 F17 = VK_F17 141 F18 = VK_F18 142 F19 = VK_F19 143 F20 = VK_F20 144 F21 = VK_F21 145 F22 = VK_F22 146 F23 = VK_F23 147 F24 = VK_F24 148 NumLock = VK_NUMLOCK 149 Scroll = VK_SCROLL 150 LShiftKey = VK_LSHIFT 151 RShiftKey = VK_RSHIFT 152 LControlKey = VK_LCONTROL 153 RControlKey = VK_RCONTROL 154 LMenu = VK_LMENU 155 RMenu = VK_RMENU 156 BrowserBack = VK_BROWSER_BACK 157 BrowserForward = VK_BROWSER_FORWARD 158 BrowserRefresh = VK_BROWSER_REFRESH 159 BrowserStop = VK_BROWSER_STOP 160 BrowserSearch = VK_BROWSER_SEARCH 161 BrowserFavorites = VK_BROWSER_FAVORITES 162 BrowserHome = VK_BROWSER_HOME 163 VolumeMute = VK_VOLUME_MUTE 164 VolumeDown = VK_VOLUME_DOWN 165 VolumeUp = VK_VOLUME_UP 166 MediaNextTrack = VK_MEDIA_NEXT_TRACK 167 MediaPreviousTrack = VK_MEDIA_PREV_TRACK 168 MediaStop = VK_MEDIA_STOP 169 MediaPlayPause = VK_MEDIA_PLAY_PAUSE 170 LaunchMail = VK_LAUNCH_MAIL 171 SelectMedia = VK_LAUNCH_MEDIA_SELECT 172 LaunchApplication1 = VK_LAUNCH_APP1 173 LaunchApplication2 = VK_LAUNCH_APP2 174 Oem1 = VK_OEM_1 175 Oemplus = VK_OEM_PLUS 176 Oemcomma = VK_OEM_COMMA 177 OemMinus = VK_OEM_MINUS 178 OemPeriod = VK_OEM_PERIOD 179 Oem2 = VK_OEM_2 180 Oem3 = VK_OEM_3 181 Oem4 = VK_OEM_4 182 Oem5 = VK_OEM_5 183 Oem6 = VK_OEM_6 184 Oem7 = VK_OEM_7 185 Oem8 = VK_OEM_8 186 Oem102 = VK_OEM_102 187 ProcessKey = VK_PROCESSKEY 188 Packet = VK_PACKET 189 Attn = VK_ATTN 190 Crsel = VK_CRSEL 191 Exsel = VK_EXSEL 192 EraseEof = VK_EREOF 193 Play = VK_PLAY 194 Zoom = VK_ZOOM 195 Pa1 = VK_PA1 196 OemClear = VK_OEM_CLEAR 197 End Enum 198 199 End Namespace 'Forms 200 End Namespace 'Widnows 201 End Namespace 'System 202 21 203 #endif '__SYSTEM_WINDOWS_FORMS_MISC_AB__ -
Include/system/enum.sbp
r210 r282 2 2 Protected 3 3 value As Long 4 lpszName As LP STR4 lpszName As LPTSTR 5 5 Public 6 Sub EnumBase(value As Long,lpszName As LP STR)6 Sub EnumBase(value As Long,lpszName As LPTSTR) 7 7 This.value = value 8 8 This.lpszName = lpszName 9 9 End Sub 10 10 11 11 Sub ~EnumBase() 12 12 End Sub … … 20 20 This.lpszName = obj.lpszName 21 21 End Sub 22 22 23 23 Function Operator() As Long 24 24 Return This.value -
Include/windows/WindowHandle.sbp
r272 r282 89 89 End Function 90 90 91 Const Function ClientToScreen(ByRef rc As RECT) As Boolean 92 Dim ppt = VarPtr(rc) As *POINTAPI 93 Return (_System_ClientToScreen(hwnd, ppt[0]) <> FALSE And _System_ClientToScreen(hwnd, ppt[1]) <> FALSE) As Boolean 94 End Function 95 91 96 Function Close() As Boolean 92 97 Return CloseWindow(hwnd) As Boolean
Note:
See TracChangeset
for help on using the changeset viewer.