mirror of https://github.com/buggins/dlangui.git
fixes
This commit is contained in:
parent
67ff73e84a
commit
1ce0d9c9b5
|
@ -200,6 +200,7 @@ class Dialog : VerticalLayout {
|
||||||
_window = Platform.instance.createWindow(_caption, _parentWindow, wflags, _initialWidth, _initialHeight);
|
_window = Platform.instance.createWindow(_caption, _parentWindow, wflags, _initialWidth, _initialHeight);
|
||||||
if (_window && _icon)
|
if (_window && _icon)
|
||||||
_window.windowIcon = drawableCache.getImage(_icon);
|
_window.windowIcon = drawableCache.getImage(_icon);
|
||||||
|
_window.backgroundColor = currentTheme.customColor("dialog_background");
|
||||||
_window.mainWidget = this;
|
_window.mainWidget = this;
|
||||||
_window.show();
|
_window.show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,10 +56,12 @@ enum FileDialogFlag : uint {
|
||||||
ConfirmOverwrite = 0x200,
|
ConfirmOverwrite = 0x200,
|
||||||
/// select directory, not file
|
/// select directory, not file
|
||||||
SelectDirectory = 0x400,
|
SelectDirectory = 0x400,
|
||||||
|
/// show Create Directory button
|
||||||
|
EnableCreateDirectory = 0x800,
|
||||||
/// flags for Open dialog
|
/// flags for Open dialog
|
||||||
Open = FileMustExist,
|
Open = FileMustExist | EnableCreateDirectory,
|
||||||
/// flags for Save dialog
|
/// flags for Save dialog
|
||||||
Save = ConfirmOverwrite,
|
Save = ConfirmOverwrite | EnableCreateDirectory,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,9 +321,12 @@ class FileDialog : Dialog, CustomGridCellAdapter {
|
||||||
super.handleAction(action);
|
super.handleAction(action);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (action.id == StandardAction.Open || action.id == StandardAction.Save) {
|
if (action.id == StandardAction.Open || action.id == StandardAction.OpenDirectory || action.id == StandardAction.Save) {
|
||||||
if (_filename.length > 0) {
|
if (_filename.length > 0 || action.id == StandardAction.OpenDirectory) {
|
||||||
Action result = _action;
|
Action result = _action;
|
||||||
|
if (action.id == StandardAction.OpenDirectory)
|
||||||
|
result.stringParam = _path;
|
||||||
|
else
|
||||||
result.stringParam = _filename;
|
result.stringParam = _filename;
|
||||||
close(result);
|
close(result);
|
||||||
return true;
|
return true;
|
||||||
|
@ -701,7 +706,7 @@ class FileNameEditLine : HorizontalLayout {
|
||||||
protected Button _btn;
|
protected Button _btn;
|
||||||
protected string[string] _filetypeIcons;
|
protected string[string] _filetypeIcons;
|
||||||
protected dstring _caption = "Open File"d;
|
protected dstring _caption = "Open File"d;
|
||||||
protected uint _fileDialogFlags = DialogFlag.Modal | DialogFlag.Resizable | FileDialogFlag.FileMustExist;
|
protected uint _fileDialogFlags = DialogFlag.Modal | DialogFlag.Resizable | FileDialogFlag.FileMustExist | FileDialogFlag.EnableCreateDirectory;
|
||||||
protected FileFilterEntry[] _filters;
|
protected FileFilterEntry[] _filters;
|
||||||
protected int _filterIndex;
|
protected int _filterIndex;
|
||||||
|
|
||||||
|
@ -715,13 +720,14 @@ class FileNameEditLine : HorizontalLayout {
|
||||||
_edFileName = new EditLine("edFileName");
|
_edFileName = new EditLine("edFileName");
|
||||||
_edFileName.minWidth(200);
|
_edFileName.minWidth(200);
|
||||||
_btn = new Button("btnFile", "..."d);
|
_btn = new Button("btnFile", "..."d);
|
||||||
|
_btn.styleId = STYLE_BUTTON_NOMARGINS;
|
||||||
_btn.click = delegate(Widget src) {
|
_btn.click = delegate(Widget src) {
|
||||||
FileDialog dlg = new FileDialog(UIString(_caption), window, null, _fileDialogFlags);
|
FileDialog dlg = new FileDialog(UIString(_caption), window, null, _fileDialogFlags);
|
||||||
foreach(key, value; _filetypeIcons)
|
foreach(key, value; _filetypeIcons)
|
||||||
dlg.filetypeIcons[key] = value;
|
dlg.filetypeIcons[key] = value;
|
||||||
dlg.filters = _filters;
|
dlg.filters = _filters;
|
||||||
dlg.dialogResult = delegate(Dialog dlg, const Action result) {
|
dlg.dialogResult = delegate(Dialog dlg, const Action result) {
|
||||||
if (result.id == ACTION_OPEN.id) {
|
if (result.id == ACTION_OPEN.id || result.id == ACTION_OPEN_DIRECTORY.id) {
|
||||||
_edFileName.text = toUTF32(result.stringParam);
|
_edFileName.text = toUTF32(result.stringParam);
|
||||||
if (contentChange.assigned)
|
if (contentChange.assigned)
|
||||||
contentChange(_edFileName.content);
|
contentChange(_edFileName.content);
|
||||||
|
@ -800,7 +806,8 @@ class FileNameEditLine : HorizontalLayout {
|
||||||
class DirEditLine : FileNameEditLine {
|
class DirEditLine : FileNameEditLine {
|
||||||
this(string ID = null) {
|
this(string ID = null) {
|
||||||
super(ID);
|
super(ID);
|
||||||
_fileDialogFlags = DialogFlag.Modal | DialogFlag.Resizable | FileDialogFlag.FileMustExist | FileDialogFlag.SelectDirectory;
|
_fileDialogFlags = DialogFlag.Modal | DialogFlag.Resizable
|
||||||
|
| FileDialogFlag.FileMustExist | FileDialogFlag.SelectDirectory | FileDialogFlag.EnableCreateDirectory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -671,9 +671,9 @@ class MLParser {
|
||||||
setBoolProperty(propName, true);
|
setBoolProperty(propName, true);
|
||||||
else if (value.equal("false"))
|
else if (value.equal("false"))
|
||||||
setBoolProperty(propName, false);
|
setBoolProperty(propName, false);
|
||||||
else if (value.equal("FILL") || value.equal("FILL_PARENT"))
|
else if (value.equal("fill") || value.equal("FILL") || value.equal("FILL_PARENT"))
|
||||||
setIntProperty(propName, FILL_PARENT);
|
setIntProperty(propName, FILL_PARENT);
|
||||||
else if (value.equal("WRAP") || value.equal("WRAP_CONTENT"))
|
else if (value.equal("wrap") || value.equal("WRAP") || value.equal("WRAP_CONTENT"))
|
||||||
setIntProperty(propName, WRAP_CONTENT);
|
setIntProperty(propName, WRAP_CONTENT);
|
||||||
else if (!_currentWidget.setStringProperty(propName, value))
|
else if (!_currentWidget.setStringProperty(propName, value))
|
||||||
error("unknown ident property " ~ propName);
|
error("unknown ident property " ~ propName);
|
||||||
|
|
Loading…
Reference in New Issue