file-picker: implement save-file-dialog on windows
parent
646f14f249
commit
4ceb098907
|
@ -1,8 +1,8 @@
|
|||
USING: accessors alien.c-types alien.data alien.strings
|
||||
alien.syntax classes.struct destructors file-picker
|
||||
io.encodings.string io.encodings.utf8 kernel libc literals math
|
||||
system windows windows.kernel32 windows.shell32 windows.types
|
||||
windows.user32 ;
|
||||
system windows windows.comdlg32 windows.kernel32 windows.shell32
|
||||
windows.types windows.user32 ;
|
||||
IN: file-picker.windows
|
||||
LIBRARY: shell32
|
||||
|
||||
|
@ -70,4 +70,11 @@ M: windows open-file-dialog
|
|||
] if*
|
||||
] with-destructors ;
|
||||
|
||||
M: windows save-file-dialog ;
|
||||
M: windows save-file-dialog
|
||||
[
|
||||
drop ! TODO: support supplying a suggested file name or path
|
||||
OPENFILENAME [ malloc-struct &free ] [ heap-size ] bi >>lStructSize
|
||||
MAX_UNICODE_PATH [ 2 calloc &free >>lpstrFile ] [ >>nMaxFile ] bi
|
||||
OFN_OVERWRITEPROMPT >>Flags
|
||||
dup GetSaveFileName zero? [ drop f ] [ lpstrFile>> ] if
|
||||
] with-destructors ;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Alexander Ilin
|
|
@ -0,0 +1,40 @@
|
|||
! Copyright (C) 2017 Alexander Ilin.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors alien alien.c-types alien.libraries
|
||||
alien.syntax classes.struct destructors kernel libc math
|
||||
sequences strings windows windows.types ;
|
||||
|
||||
IN: windows.comdlg32
|
||||
|
||||
<< "comdlg32" "comdlg32.dll" stdcall add-library >>
|
||||
|
||||
LIBRARY: comdlg32
|
||||
|
||||
CONSTANT: OFN_OVERWRITEPROMPT 2
|
||||
|
||||
STRUCT: OPENFILENAME
|
||||
{ lStructSize DWORD }
|
||||
{ hwndOwner HWND }
|
||||
{ hInstance HINSTANCE }
|
||||
{ lpstrFilter LPCTSTR }
|
||||
{ lpstrCustomFilter LPTSTR }
|
||||
{ nMaxCustFilter DWORD }
|
||||
{ nFilterIndex DWORD }
|
||||
{ lpstrFile LPTSTR }
|
||||
{ nMaxFile DWORD }
|
||||
{ lpstrFileTitle LPTSTR }
|
||||
{ nMaxFileTitle DWORD }
|
||||
{ lpstrInitialDir LPCTSTR }
|
||||
{ lpstrTitle LPCTSTR }
|
||||
{ Flags DWORD }
|
||||
{ nFileOffset WORD }
|
||||
{ nFileExtension WORD }
|
||||
{ lpstrDefExt LPCTSTR }
|
||||
{ lCustData LPARAM }
|
||||
{ lpfnHook PVOID }
|
||||
{ lpTemplateName LPCTSTR } ;
|
||||
|
||||
TYPEDEF: OPENFILENAME* LPOPENFILENAME
|
||||
|
||||
FUNCTION: BOOL GetSaveFileNameW ( LPOPENFILENAME lpofn )
|
||||
ALIAS: GetSaveFileName GetSaveFileNameW
|
|
@ -0,0 +1 @@
|
|||
windows
|
Loading…
Reference in New Issue