Changeset 282 for Include/Classes


Ignore:
Timestamp:
Jul 2, 2007, 1:33:52 AM (17 years ago)
Author:
イグトランス (egtra)
Message:

#121対応、Classes/System/Windows/Forms以下を名前空間に入れた。

Location:
Include/Classes/System
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/Drawing/Color.ab

    r212 r282  
    112112    Function GetHue() As Single
    113113        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)
    116119        d = max - min
    117120        If g = max Then
     
    128131    Function GetSaturation() As Single
    129132        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)
    132138        Return (max - min) / max
    133139    End Function
     
    135141    Function GetBrightness() As Single
    136142        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)
    138147        Return max * (1 / 255)
    139148    End Function
  • Include/Classes/System/Runtime/InteropServices/GCHandle.ab

    r257 r282  
    22
    33#require <Classes/System/Collections/ArrayList.ab>
     4
     5Namespace System
     6Namespace Runtime
     7Namespace InteropServices
    48
    59Class GCHandle
     
    6569    handle As VoidPtr
    6670
    67     Static allocated As ArrayList
     71    Static allocated As /*System.Collections.*/ArrayList
    6872End Class
     73
     74End Namespace 'System
     75End Namespace 'Runtime
     76End Namespace 'InteropServices
  • Include/Classes/System/Windows/Forms/Control.ab

    r240 r282  
    1717#require <Classes/System/Drawing/Rectangle.ab>
    1818#require <Classes/System/Runtime/InteropServices/GCHandle.ab>
     19#require <Classes/ActiveBasic/Strings/Strings.ab>
     20
     21Namespace System
     22Namespace Windows
     23Namespace Forms
     24
     25Namespace Detail
    1926
    2027TypeDef InvokeProc = *Function(p As VoidPtr) As VoidPtr
    2128
    2229Class AsyncResultForInvoke
    23     Inherits IAsyncResult
     30    Inherits System.IAsyncResult
    2431Public
    2532    ' Properties
     
    3239    End Function
    3340
    34     Override Function AsyncWaitHandle() As WaitHandle
     41    Override Function AsyncWaitHandle() As System.Threading.WaitHandle
    3542        Return waitHandle
    3643    End Function
     
    5360
    5461Private
    55     waitHandle As WaitHandle
     62    waitHandle As System.Threading.WaitHandle
    5663    result As VoidPtr
    5764End Class
     
    6370    AsyncResult As AsyncResultForInvoke
    6471End Class
     72
     73End Namespace 'Detail
    6574
    6675Class Control
     
    290299    ' 同期関数呼出、Controlが作成されたスレッドで関数を実行する。
    291300    ' 関数は同期的に呼び出されるので、関数が終わるまでInvokeは制御を戻さない。
    292     Function Invoke(pfn As InvokeProc, p As VoidPtr) As VoidPtr
     301    Function Invoke(pfn As System.Windows.Forms.Detail.InvokeProc, p As VoidPtr) As VoidPtr
    293302        Return wnd.SendMessage(WM_CONTROL_INVOKE, p As WPARAM, pfn As LPARAM) As VoidPtr
    294303    End Function
     
    297306    ' 関数は非同期的に呼び出されるので、BeginInvokeはすぐに制御を戻す。
    298307    ' 後にEndInvokeを呼び出すことにより、関数の戻り値を受け取れる。
    299     Function BeginInvoke(pfn As InvokeProc, p As VoidPtr) As IAsyncResult
     308    Function BeginInvoke(pfn As System.Windows.Forms.Detail.InvokeProc, p As VoidPtr) As System.IAsyncResult
    300309        ' 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))
    302311        ' OnControlBeginInvokeがDeleteする
    303         Dim asyncInvokeData = New AsyncInvokeData
     312        Dim asyncInvokeData = New System.Windows.Forms.Detail.AsyncInvokeData
    304313        With asyncInvokeData
    305314            .FuncPtr = pfn
     
    307316            .AsyncResult = asyncResult
    308317        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))
    311320        Return pAsyncResult
    312321    End Function
     
    314323    ' BeginInvokeで呼び出した関数の戻り値を受け取る。
    315324    ' その関数がまだ終了していない場合、終了するまで待機する。
    316     Function EndInvoke(ar As IAsyncResult) As VoidPtr
     325    Function EndInvoke(ar As System.IAsyncResult) As VoidPtr
    317326        ar.WaitHandle.WaitOne()
    318         Dim arInvoke = ar As AsyncResultForInvoke
     327        Dim arInvoke = ar As System.Windows.Forms.Detail.AsyncResultForInvoke
    319328        Return arInvoke.Result
    320329    End Function
     
    327336        If IsWindow(hwnd) Then
    328337            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))
    330339                Return gch.Target As Control
    331340            End If
     
    424433            Select Case .Msg
    425434                Case WM_GETTEXTLENGTH
    426                     .Result = text.Length
     435                    .Result = text.Length 'ToDo: Unicode対応
    427436                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)
    430439                    .Result = size
    431440                Case WM_SETTEXT
    432441                    text = New String(.LParam As PCTSTR)
    433442                Case WM_ENABLE
    434                     OnEnabledChanged(EventArgs.Empty)
     443                    OnEnabledChanged(System.EventArgs.Empty)
    435444                Case WM_ERASEBKGND
    436445                    ' OnPaintBackgroundに移すべき
     
    443452                    DeleteObject(hbr)
    444453                Case WM_CONTROL_INVOKE
    445                     Dim pfn = .LParam As InvokeProc
     454                    Dim pfn = .LParam As System.Windows.Forms.Detail.InvokeProc
    446455                    .Result = pfn(m.WParam As VoidPtr) As LRESULT
    447456                Case WM_CONTROL_BEGININVOKE
    448457                    OnControlBeginInvoke(m)
    449458                Case WM_CREATE
    450                     OnHandleCreated(EventArgs.Empty)
     459                    OnHandleCreated(System.EventArgs.Empty)
    451460                Case WM_DESTROY
    452                     OnHandleDestroyed(EventArgs.Empty)
     461                    OnHandleDestroyed(System.EventArgs.Empty)
    453462                Case Else
    454463                    DefWndProc(m)
     
    498507
    499508    Virtual Sub OnPaintBackground(e As PaintEventArgs) : End Sub
    500     Virtual Sub OnEnabledChanged(e As EventArgs) : End Sub
    501     Virtual Sub OnBackColorChanged(e As EventArgs) : End Sub
    502     Virtual Sub OnHandleCreated(e As EventArgs) : End Sub
    503     Virtual Sub OnHandleDestroyed(e As EventArgs) : End Sub
    504     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)
    505514        wnd.SetText(ToTCStr(text))
    506515    End Sub
     
    574583        If Object.ReferenceEquals(rThis As Object, Nothing) Then
    575584            Dim gchValue = TlsGetValue(tlsIndex) As LONG_PTR
    576             Dim gch = GCHandle.FromIntPtr(gchValue)
     585            Dim gch = System.Runtime.InteropServices.GCHandle.FromIntPtr(gchValue)
    577586            rThis = gch.Target As Control
    578587            ' ウィンドウが作られて最初にWndProcFirstが呼ばれたとき
     
    593602    ' BeginInvokeが呼ばれたときの処理
    594603    Sub OnControlBeginInvoke(m As Message)
    595         Dim gch = GCHandle.FromIntPtr(m.LParam)
    596         Dim data = gch.Target As AsyncInvokeData
     604        Dim gch = System.Runtime.InteropServices.GCHandle.FromIntPtr(m.LParam)
     605        Dim data = gch.Target As System.Windows.Forms.Detail.AsyncInvokeData
    597606        With data
    598607            Dim pfn = .FuncPtr
     
    603612End Class
    604613
     614Namespace Detail
    605615Class _System_ControlIinitializer
    606616Public
    607617    Sub _System_ControlIinitializer(hinst As HINSTANCE)
    608         Control.Initialize(hinst)
     618        System.Windows.Forms.Control.Initialize(hinst)
    609619    End Sub
    610620
    611621    Sub ~_System_ControlIinitializer()
    612         Control.Uninitialize()
     622        System.Windows.Forms.Control.Uninitialize()
    613623    End Sub
    614624End Class
     
    618628#endif '_SYSTEM_NO_INITIALIZE_CONTROL_
    619629
     630End Namespace
     631
     632End Namespace 'Forms
     633End Namespace 'Widnows
     634End Namespace 'System
     635
    620636#endif '__SYSTEM_WINDOWS_FORMS_CONTROL_AB__
    621637
  • Include/Classes/System/Windows/Forms/CreateParams.ab

    r240 r282  
    33#ifndef __SYSTEM_WINDOWS_FORMS_CREATEPARAMS_AB__
    44#define __SYSTEM_WINDOWS_FORMS_CREATEPARAMS_AB__
     5
     6Namespace System
     7Namespace Windows
     8Namespace Forms
    59
    610Class CreateParams
     
    1923End Class
    2024
     25End Namespace 'Forms
     26End Namespace 'Widnows
     27End Namespace 'System
     28
    2129#endif '__SYSTEM_WINDOWS_FORMS_CREATEPARAMS_AB__
  • Include/Classes/System/Windows/Forms/Message.ab

    r240 r282  
    55
    66#require <windows.sbp>
     7
     8Namespace System
     9Namespace Windows
     10Namespace Forms
    711
    812Class Message
     
    8791End Class
    8892
     93End Namespace 'Forms
     94End Namespace 'Widnows
     95End Namespace 'System
     96
    8997#endif '__SYSTEM_WINDOWS_FORMS_MESSAGE_AB__
  • Include/Classes/System/Windows/Forms/PaintEventArgs.ab

    r223 r282  
    66#require <Classes/System/misc.ab>
    77
     8Namespace System
     9Namespace Windows
     10Namespace Forms
     11
    812Class PaintEventArgs
    9     Inherits EventArgs
     13    Inherits System.EventArgs
    1014End Class
    1115
     16End Namespace 'Forms
     17End Namespace 'Widnows
     18End Namespace 'System
     19
    1220#endif '__SYSTEM_WINDOWS_FORMS_PAINTEVENTARGS_AB__
  • Include/Classes/System/Windows/Forms/misc.ab

    r223 r282  
    33#ifndef __SYSTEM_WINDOWS_FORMS_MISC_AB__
    44#define __SYSTEM_WINDOWS_FORMS_MISC_AB__
     5
     6Namespace System
     7Namespace Windows
     8Namespace Forms
    59
    610Interface IWin32Window
     
    1923End Enum
    2024
     25Enum 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
     197End Enum
     198
     199End Namespace 'Forms
     200End Namespace 'Widnows
     201End Namespace 'System
     202
    21203#endif '__SYSTEM_WINDOWS_FORMS_MISC_AB__
Note: See TracChangeset for help on using the changeset viewer.