file dialogs in popup by default; update style for floating windows

This commit is contained in:
Vadim Lopatin 2015-01-27 15:47:52 +03:00
parent cf75dd3496
commit 90cf7253ca
6 changed files with 25 additions and 1 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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";

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

View File

@ -263,6 +263,13 @@
padding="1,1,1,1"
margins="4,4,4,4"
/>
<style id="FLOATING_WINDOW"
backgroundImageId="popup_window_background"
layoutWidth="FILL_PARENT"
layoutHeight="FILL_PARENT"
padding="1,1,1,1"
margins="4,4,4,4"
/>
<style id="DOCK_WINDOW_CAPTION"
backgroundColor="#4d6082"
layoutWidth="FILL_PARENT"

View File

@ -66,6 +66,7 @@ res/mdpi/folder-bookmark.png
res/mdpi/folder-network.png
res/mdpi/folder.png
res/mdpi/media-flash-sd-mmc.png
res/mdpi/popup_window_background.9.png
res/mdpi/tab_btn_dark_up_focused.9.png
res/mdpi/tab_btn_dark_up_focused_selected.9.png
res/mdpi/tab_btn_dark_up_hover.9.png