mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
Support all dialog properties
This commit is contained in:
@@ -29,6 +29,5 @@ extern void Fullscreen(void *app);
|
|||||||
extern void UnFullscreen(void *app);
|
extern void UnFullscreen(void *app);
|
||||||
extern void ToggleFullscreen(void *app);
|
extern void ToggleFullscreen(void *app);
|
||||||
extern void DisableFrame(void *app);
|
extern void DisableFrame(void *app);
|
||||||
extern void OpenDialog(void *appPointer, char *callbackID, char *title, char *filter, int allowFiles, int allowDirs );
|
extern void OpenDialog(void *appPointer, char *callbackID, char *title, char *filter, int allowFiles, int allowDirs, int allowMultiple, int showHiddenFiles, int canCreateDirectories, int resolveAliases, int treatPackagesAsDirectories);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -127,5 +127,10 @@ func (c *Client) OpenDialog(dialogOptions *options.OpenDialog, callbackID string
|
|||||||
c.app.string2CString(dialogOptions.Filter),
|
c.app.string2CString(dialogOptions.Filter),
|
||||||
c.app.bool2Cint(dialogOptions.AllowFiles),
|
c.app.bool2Cint(dialogOptions.AllowFiles),
|
||||||
c.app.bool2Cint(dialogOptions.AllowDirectories),
|
c.app.bool2Cint(dialogOptions.AllowDirectories),
|
||||||
|
c.app.bool2Cint(dialogOptions.AllowMultiple),
|
||||||
|
c.app.bool2Cint(dialogOptions.ShowHiddenFiles),
|
||||||
|
c.app.bool2Cint(dialogOptions.CanCreateDirectories),
|
||||||
|
c.app.bool2Cint(dialogOptions.ResolveAliases),
|
||||||
|
c.app.bool2Cint(dialogOptions.TreatPackagesAsDirectories),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ char* OpenFileDialog(struct Application *app, char *title, char *filter) {
|
|||||||
|
|
||||||
// OpenDialog opens a dialog to select files/directories
|
// OpenDialog opens a dialog to select files/directories
|
||||||
// NOTE: The result is a string that will need to be freed!
|
// NOTE: The result is a string that will need to be freed!
|
||||||
void OpenDialog(struct Application *app, char* callbackID, char *title, char *filter, int allowFiles, int allowDirs, int allowMultiple) {
|
void OpenDialog(struct Application *app, char *callbackID, char *title, char *filter, int allowFiles, int allowDirs, int allowMultiple, int showHiddenFiles, int canCreateDirectories, int resolveAliases, int treatPackagesAsDirectories) {
|
||||||
Debug("OpenDialog Called with callback id: %s", callbackID);
|
Debug("OpenDialog Called with callback id: %s", callbackID);
|
||||||
|
|
||||||
// Create an open panel
|
// Create an open panel
|
||||||
@@ -427,11 +427,15 @@ void OpenDialog(struct Application *app, char* callbackID, char *title, char *fi
|
|||||||
// TODO: Filters
|
// TODO: Filters
|
||||||
// No filters: [dialog setAllowsOtherFileTypes:YES];
|
// No filters: [dialog setAllowsOtherFileTypes:YES];
|
||||||
|
|
||||||
// TODO: Other options
|
|
||||||
msg(dialog, s("setCanChooseFiles:"), allowFiles);
|
msg(dialog, s("setCanChooseFiles:"), allowFiles);
|
||||||
msg(dialog, s("setCanChooseDirectories:"), allowDirs);
|
msg(dialog, s("setCanChooseDirectories:"), allowDirs);
|
||||||
msg(dialog, s("setAllowsMultipleSelection:"), allowMultiple);
|
msg(dialog, s("setAllowsMultipleSelection:"), allowMultiple);
|
||||||
|
msg(dialog, s("setShowsHiddenFiles:"), showHiddenFiles);
|
||||||
|
msg(dialog, s("setCanCreateDirectories:"), canCreateDirectories);
|
||||||
|
msg(dialog, s("setResolvesAliases:"), resolveAliases);
|
||||||
|
msg(dialog, s("setTreatsFilePackagesAsDirectories:"), treatPackagesAsDirectories);
|
||||||
|
|
||||||
|
// Setup callback handler
|
||||||
msg(dialog, s("beginSheetModalForWindow:completionHandler:"), app->mainWindow, ^(id result) {
|
msg(dialog, s("beginSheetModalForWindow:completionHandler:"), app->mainWindow, ^(id result) {
|
||||||
|
|
||||||
JsonNode *response = json_mkarray();
|
JsonNode *response = json_mkarray();
|
||||||
|
|||||||
@@ -2,9 +2,13 @@ package options
|
|||||||
|
|
||||||
// OpenDialog contains the options for the OpenDialog runtime method
|
// OpenDialog contains the options for the OpenDialog runtime method
|
||||||
type OpenDialog struct {
|
type OpenDialog struct {
|
||||||
Title string
|
Title string
|
||||||
Filter string
|
Filter string
|
||||||
AllowFiles bool
|
AllowFiles bool
|
||||||
AllowDirectories bool
|
AllowDirectories bool
|
||||||
AllowMultiple bool
|
AllowMultiple bool
|
||||||
|
ShowHiddenFiles bool
|
||||||
|
CanCreateDirectories bool
|
||||||
|
ResolveAliases bool
|
||||||
|
TreatPackagesAsDirectories bool
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,6 +110,19 @@ func (r *RuntimeTest) OpenDialogMultiple(title string, filter string) []string {
|
|||||||
return r.runtime.Dialog.Open(dialogOptions)
|
return r.runtime.Dialog.Open(dialogOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OpenDialogAllOptions will call the Runtime.Dialog.OpenDialog method allowing multiple selection
|
||||||
|
func (r *RuntimeTest) OpenDialogAllOptions() []string {
|
||||||
|
dialogOptions := &options.OpenDialog{
|
||||||
|
AllowFiles: true,
|
||||||
|
AllowDirectories: true,
|
||||||
|
ShowHiddenFiles: true,
|
||||||
|
CanCreateDirectories: true,
|
||||||
|
TreatPackagesAsDirectories: true,
|
||||||
|
ResolveAliases: true,
|
||||||
|
}
|
||||||
|
return r.runtime.Dialog.Open(dialogOptions)
|
||||||
|
}
|
||||||
|
|
||||||
// HideWindow will call the Runtime.Window.Hide method and then call
|
// HideWindow will call the Runtime.Window.Hide method and then call
|
||||||
// Runtime.Window.Show 3 seconds later.
|
// Runtime.Window.Show 3 seconds later.
|
||||||
func (r *RuntimeTest) HideWindow() {
|
func (r *RuntimeTest) HideWindow() {
|
||||||
|
|||||||
Reference in New Issue
Block a user