diff --git a/src/dlangui/dialogs/dialog.d b/src/dlangui/dialogs/dialog.d index 263aef37..894ba2df 100644 --- a/src/dlangui/dialogs/dialog.d +++ b/src/dlangui/dialogs/dialog.d @@ -64,6 +64,17 @@ class Dialog : VerticalLayout { _icon = "dlangui-logo1"; } + /** + Measure widget according to desired width and height constraints. (Step 1 of two phase layout). + */ + void measure(int parentWidth, int parentHeight) { + super.measure(parentWidth, parentHeight); + if ((_flags & DialogFlag.Resizable) && (_flags & DialogFlag.Popup)) { + Point sz = Point(_parentWindow.width * 4 / 5, _parentWindow.height * 4 / 5); + measuredContent(parentWidth, parentHeight, sz.x, sz.y); + } + } + /// get icon resource id @property string windowIcon() { return _icon; @@ -204,6 +215,7 @@ class DialogFrame : WindowFrame { protected Dialog _dialog; this(Dialog dialog, bool enableCloseButton) { super(dialog.id ~ "_frame", enableCloseButton); + styleId = STYLE_FLOATING_WINDOW; _dialog = dialog; _caption.text = _dialog.windowCaption.value; bodyWidget = _dialog; diff --git a/src/dlangui/dialogs/filedlg.d b/src/dlangui/dialogs/filedlg.d index 2e61ec0e..0b541eb5 100644 --- a/src/dlangui/dialogs/filedlg.d +++ b/src/dlangui/dialogs/filedlg.d @@ -69,6 +69,8 @@ struct FileFilterEntry { } } +__gshared bool SHOW_FILE_DIALOG_IN_POPUP = true; + /// File open / save dialog class FileDialog : Dialog, CustomGridCellAdapter { protected FilePathPanel _edPath; @@ -90,7 +92,7 @@ class FileDialog : Dialog, CustomGridCellAdapter { protected bool _isOpenDialog; this(UIString caption, Window parent, Action action = null, uint fileDialogFlags = DialogFlag.Modal | DialogFlag.Resizable | FileDialogFlag.FileMustExist) { - super(caption, parent, fileDialogFlags); + super(caption, parent, fileDialogFlags | (SHOW_FILE_DIALOG_IN_POPUP ? DialogFlag.Popup : 0)); _isOpenDialog = !(_flags & FileDialogFlag.ConfirmOverwrite); if (action is null) { if (_isOpenDialog) diff --git a/src/dlangui/widgets/styles.d b/src/dlangui/widgets/styles.d index cdcde587..997e0282 100644 --- a/src/dlangui/widgets/styles.d +++ b/src/dlangui/widgets/styles.d @@ -134,6 +134,8 @@ immutable string STYLE_DOCK_WINDOW = "DOCK_WINDOW"; immutable string STYLE_DOCK_WINDOW_CAPTION_LABEL = "DOCK_WINDOW_CAPTION_LABEL"; /// standard style id for dock window body immutable string STYLE_DOCK_WINDOW_BODY = "DOCK_WINDOW_BODY"; +/// standard style id for toolbar separator +immutable string STYLE_FLOATING_WINDOW = "FLOATING_WINDOW"; /// standard style id for tab control in dock frame immutable string STYLE_TAB_UP_DARK = "TAB_UP_DARK"; diff --git a/views/res/mdpi/popup_window_background.9.png b/views/res/mdpi/popup_window_background.9.png new file mode 100644 index 00000000..14d80259 Binary files /dev/null and b/views/res/mdpi/popup_window_background.9.png differ diff --git a/views/res/theme_default.xml b/views/res/theme_default.xml index b7460ee0..7f890da2 100644 --- a/views/res/theme_default.xml +++ b/views/res/theme_default.xml @@ -263,6 +263,13 @@ padding="1,1,1,1" margins="4,4,4,4" /> +