[MLton-commit] r5287

Vesa Karvonen vesak at mlton.org
Wed Feb 21 08:41:25 PST 2007


Some more windows functionality.
----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/windows/unstable/detail/constants.sml.cpp
U   mltonlib/trunk/com/ssh/windows/unstable/detail/ffi/windows.h
U   mltonlib/trunk/com/ssh/windows/unstable/detail/windows.sml
U   mltonlib/trunk/com/ssh/windows/unstable/public/windows-ex.sig

----------------------------------------------------------------------

Modified: mltonlib/trunk/com/ssh/windows/unstable/detail/constants.sml.cpp
===================================================================
--- mltonlib/trunk/com/ssh/windows/unstable/detail/constants.sml.cpp	2007-02-21 15:27:12 UTC (rev 5286)
+++ mltonlib/trunk/com/ssh/windows/unstable/detail/constants.sml.cpp	2007-02-21 16:41:12 UTC (rev 5287)
@@ -15,6 +15,7 @@
 
 #define WIN_CONST(name, type) val wc_##name = wt_##type <name>
 
+fun wt_int    x : Int32.t   = Word32.toIntX x
 fun wt_DWORD  x : Word32.t  = x
 fun wt_WORD   x : Word16.t  = x
 fun wt_REGSAM x : Word32.t  = x

Modified: mltonlib/trunk/com/ssh/windows/unstable/detail/ffi/windows.h
===================================================================
--- mltonlib/trunk/com/ssh/windows/unstable/detail/ffi/windows.h	2007-02-21 15:27:12 UTC (rev 5286)
+++ mltonlib/trunk/com/ssh/windows/unstable/detail/ffi/windows.h	2007-02-21 16:41:12 UTC (rev 5287)
@@ -201,6 +201,27 @@
 
 /************************************************************************/
 
+WIN_TYPEDEF(HWND, void *)
+
+WIN_CONST(SW_FORCEMINIMIZE, int)
+WIN_CONST(SW_HIDE, int)
+WIN_CONST(SW_MAXIMIZE, int)
+WIN_CONST(SW_MINIMIZE, int)
+WIN_CONST(SW_RESTORE, int)
+WIN_CONST(SW_SHOW, int)
+WIN_CONST(SW_SHOWDEFAULT, int)
+WIN_CONST(SW_SHOWMAXIMIZED, int)
+WIN_CONST(SW_SHOWMINIMIZED, int)
+WIN_CONST(SW_SHOWMINNOACTIVE, int)
+WIN_CONST(SW_SHOWNA, int)
+WIN_CONST(SW_SHOWNOACTIVATE, int)
+WIN_CONST(SW_SHOWNORMAL, int)
+
+WIN_FUNCTION(ShowWindow, BOOL, 2, (HWND, int))
+WIN_FUNCTION(FindWindow, HWND, 2, (LPCTSTR, LPCTSTR))
+
+/************************************************************************/
+
 C_CODE(LPTSTR win_FormatErrorLocalAlloc(DWORD error))
 
 #endif

Modified: mltonlib/trunk/com/ssh/windows/unstable/detail/windows.sml
===================================================================
--- mltonlib/trunk/com/ssh/windows/unstable/detail/windows.sml	2007-02-21 15:27:12 UTC (rev 5286)
+++ mltonlib/trunk/com/ssh/windows/unstable/detail/windows.sml	2007-02-21 16:41:12 UTC (rev 5287)
@@ -430,4 +430,36 @@
       val close = ptrToBool "FileChange.close" F_win_FindCloseChangeNotification.f'
       val toWait = id
    end
+
+   structure Window = struct
+      type t = C.voidptr
+
+      fun find {class, window} =
+          (withOptZs class >>& withOptZs window)
+             (fn c & w =>
+                 raiseOnNull
+                    (fn () => F"Window.find"
+                               [A (opt str) class, A (opt str) window])
+                    F_win_FindWindow.f'
+                    (c, w))
+
+      structure SW = struct
+         type t = Int.t
+         val forceminimize = wc_SW_FORCEMINIMIZE
+         val hide = wc_SW_HIDE
+         val maximize = wc_SW_MAXIMIZE
+         val minimize = wc_SW_MINIMIZE
+         val restore = wc_SW_RESTORE
+         val show = wc_SW_SHOW
+         val showdefault = wc_SW_SHOWDEFAULT
+         val showmaximized = wc_SW_SHOWMAXIMIZED
+         val showminimized = wc_SW_SHOWMINIMIZED
+         val showminnoactive = wc_SW_SHOWMINNOACTIVE
+         val showna = wc_SW_SHOWNA
+         val shownoactivate = wc_SW_SHOWNOACTIVATE
+         val shownormal = wc_SW_SHOWNORMAL
+      end
+
+      fun show (w, c) = 0 <> F_win_ShowWindow.f' (w, c)
+   end
 end

Modified: mltonlib/trunk/com/ssh/windows/unstable/public/windows-ex.sig
===================================================================
--- mltonlib/trunk/com/ssh/windows/unstable/public/windows-ex.sig	2007-02-21 15:27:12 UTC (rev 5286)
+++ mltonlib/trunk/com/ssh/windows/unstable/public/windows-ex.sig	2007-02-21 16:41:12 UTC (rev 5287)
@@ -83,4 +83,29 @@
       val close : t Effect.t
       val toWait : t -> Wait.t
    end
+
+   structure Window : sig
+      type t
+
+      val find : {class : String.t Option.t, window : String.t  Option.t} -> t
+
+      structure SW : sig
+         type t
+         val forceminimize : t
+         val hide : t
+         val maximize : t
+         val minimize : t
+         val restore : t
+         val show : t
+         val showdefault : t
+         val showmaximized : t
+         val showminimized : t
+         val showminnoactive : t
+         val showna : t
+         val shownoactivate : t
+         val shownormal : t
+      end
+
+      val show : t * SW.t -> Bool.t
+   end
 end




More information about the MLton-commit mailing list