diff --git a/lib/monomac b/lib/monomac index d3a6207a6b..ad69c30a7e 160000 --- a/lib/monomac +++ b/lib/monomac @@ -1 +1 @@ -Subproject commit d3a6207a6b13990dcaac7e99a559de47a3d051b3 +Subproject commit ad69c30a7e6cafebe07a305ccdd322125e9cdf5d diff --git a/src/Eto.Mac/Forms/FloatingFormHandler.cs b/src/Eto.Mac/Forms/FloatingFormHandler.cs index a19bebf48a..172549fbce 100644 --- a/src/Eto.Mac/Forms/FloatingFormHandler.cs +++ b/src/Eto.Mac/Forms/FloatingFormHandler.cs @@ -37,7 +37,7 @@ void SetLevelAdjustment() // only need to adjust level when window style is not utility and we actually want it to be topmost (default for FloatingForm). var wantsTopmost = WantsTopmost; var owner = Widget.Owner; - var needsLevelAdjust = wantsTopmost && WindowStyle != WindowStyle.Utility && owner != null; + var needsLevelAdjust = wantsTopmost && owner != null; var lastOwner = Widget.Properties.Get(LastOwner_Key); diff --git a/src/Eto.Mac/Forms/MacWindow.cs b/src/Eto.Mac/Forms/MacWindow.cs index 82c3458dca..7af5b9a51b 100644 --- a/src/Eto.Mac/Forms/MacWindow.cs +++ b/src/Eto.Mac/Forms/MacWindow.cs @@ -556,7 +556,7 @@ void SetButtonStates() button.Hidden = hideButtons; button.Enabled = Minimizable; } - + button = Control.StandardWindowButton(NSWindowButton.CloseButton); if (button != null) { @@ -615,7 +615,7 @@ public bool ShowInTaskbar get; set; } - + public bool Closeable { get { return Control.StyleMask.HasFlag(NSWindowStyle.Closable); } @@ -647,9 +647,9 @@ public virtual bool Topmost } } } - + internal virtual bool DefaultTopmost => false; - + internal bool WantsTopmost { get => Widget.Properties.Get(MacWindow.Topmost_Key, DefaultTopmost); @@ -1272,16 +1272,16 @@ public virtual void SetOwner(Window owner) } } } - + void HandleGotFocusAsChild(object sender, EventArgs e) { // When there are multiple modeless child windows, clicking on one doesn't bring it to front // so, we remove then re-add the child window to get it to come above again. var parentWindow = Control.ParentWindow; var childWindows = parentWindow?.ChildWindows; - + // .. only if it isn't already the last child window - if (parentWindow != null && childWindows?.Length > 1 && !Equals(Control.Handle, childWindows[childWindows.Length -1].Handle)) + if (parentWindow != null && childWindows?.Length > 1 && !Equals(Control.Handle, childWindows[childWindows.Length - 1].Handle)) { parentWindow.RemoveChildWindow(Control); parentWindow.AddChildWindow(Control, NSWindowOrderingMode.Above); @@ -1295,5 +1295,35 @@ internal virtual void OnSetAsChildWindow() } public float LogicalPixelSize => Screen?.LogicalPixelSize ?? 1f; + + public bool FullSizeContentView + { + get => Control.StyleMask.HasFlag(NSWindowStyle.FullSizeContentView); + set + { + if (value) + { + Control.TitleVisibility = NSWindowTitleVisibility.Hidden; + Control.TitlebarAppearsTransparent = true; + Control.StyleMask |= NSWindowStyle.FullSizeContentView; + } + else + { + Control.TitleVisibility = NSWindowTitleVisibility.Visible; + Control.TitlebarAppearsTransparent = false; + Control.StyleMask &= ~NSWindowStyle.FullSizeContentView; + } + } + } + + protected override void Dispose(bool disposing) + { + if (disposing && Widget.Loaded) + { + // we can't cancel closing in this case, so don't bother firing the closing event + Control.Close(); + } + base.Dispose(disposing); + } } } diff --git a/test/Eto.Test/Sections/Behaviors/WindowsSection.cs b/test/Eto.Test/Sections/Behaviors/WindowsSection.cs index db7e3b0170..81aa67f987 100644 --- a/test/Eto.Test/Sections/Behaviors/WindowsSection.cs +++ b/test/Eto.Test/Sections/Behaviors/WindowsSection.cs @@ -15,17 +15,7 @@ public class WindowsSection : Panel, INotifyPropertyChanged EnumRadioButtonList styleCombo; EnumRadioButtonList stateCombo; EnumRadioButtonList typeRadio; - CheckBox resizableCheckBox; - CheckBox maximizableCheckBox; - CheckBox minimizableCheckBox; - CheckBox movableByWindowBackgroundCheckBox; - CheckBox showInTaskBarCheckBox; - CheckBox closeableCheckBox; - CheckBox topMostCheckBox; CheckBox setOwnerCheckBox; - CheckBox visibleCheckBox; - CheckBox showActivatedCheckBox; - CheckBox canFocusCheckBox; CheckBox createMenuBar; EnumCheckBoxList systemMenuItems; EnumDropDown dialogDisplayModeDropDown; @@ -223,7 +213,7 @@ Control WindowState() Control Resizable() { - resizableCheckBox = new CheckBox { Text = "Resizable" }; + var resizableCheckBox = new CheckBox { Text = "Resizable" }; resizableCheckBox.BindDataContext(c => c.ThreeState, (SettingsWindow w) => w.ThreeState); resizableCheckBox.CheckedBinding.BindDataContext((Window w) => w.Resizable); return resizableCheckBox; @@ -231,7 +221,7 @@ Control Resizable() Control Maximizable() { - maximizableCheckBox = new CheckBox { Text = "Maximizable" }; + var maximizableCheckBox = new CheckBox { Text = "Maximizable" }; maximizableCheckBox.BindDataContext(c => c.ThreeState, (SettingsWindow w) => w.ThreeState); maximizableCheckBox.CheckedBinding.BindDataContext((Window w) => w.Maximizable); return maximizableCheckBox; @@ -239,15 +229,15 @@ Control Maximizable() Control MovableByWindowBackground() { - movableByWindowBackgroundCheckBox = new CheckBox { Text = "MovableByWindowBackground" }; + var movableByWindowBackgroundCheckBox = new CheckBox { Text = "MovableByWindowBackground" }; movableByWindowBackgroundCheckBox.BindDataContext(c => c.ThreeState, (SettingsWindow w) => w.ThreeState); movableByWindowBackgroundCheckBox.CheckedBinding.BindDataContext((Window w) => w.MovableByWindowBackground); return movableByWindowBackgroundCheckBox; } - + Control Minimizable() { - minimizableCheckBox = new CheckBox { Text = "Minimizable" }; + var minimizableCheckBox = new CheckBox { Text = "Minimizable" }; minimizableCheckBox.BindDataContext(c => c.ThreeState, (SettingsWindow w) => w.ThreeState); minimizableCheckBox.CheckedBinding.BindDataContext((Window w) => w.Minimizable); return minimizableCheckBox; @@ -255,7 +245,7 @@ Control Minimizable() Control ShowInTaskBar() { - showInTaskBarCheckBox = new CheckBox { Text = "Show In TaskBar" }; + var showInTaskBarCheckBox = new CheckBox { Text = "Show In TaskBar" }; showInTaskBarCheckBox.BindDataContext(c => c.ThreeState, (SettingsWindow w) => w.ThreeState); showInTaskBarCheckBox.CheckedBinding.BindDataContext((Window w) => w.ShowInTaskbar); return showInTaskBarCheckBox; @@ -263,7 +253,7 @@ Control ShowInTaskBar() Control CloseableCheckBox() { - closeableCheckBox = new CheckBox { Text = "Closeable" }; + var closeableCheckBox = new CheckBox { Text = "Closeable" }; closeableCheckBox.BindDataContext(c => c.ThreeState, (SettingsWindow w) => w.ThreeState); closeableCheckBox.CheckedBinding.BindDataContext((Window w) => w.Closeable); return closeableCheckBox; @@ -271,7 +261,7 @@ Control CloseableCheckBox() Control CreateCanFocus() { - canFocusCheckBox = new CheckBox { Text = "CanFocus" }; + var canFocusCheckBox = new CheckBox { Text = "CanFocus" }; canFocusCheckBox.BindDataContext(c => c.ThreeState, (SettingsWindow w) => w.ThreeState); canFocusCheckBox.CheckedBinding.BindDataContext((Form w) => w.CanFocus); return canFocusCheckBox; @@ -279,7 +269,7 @@ Control CreateCanFocus() Control TopMost() { - topMostCheckBox = new CheckBox { Text = "Top Most" }; + var topMostCheckBox = new CheckBox { Text = "Top Most" }; topMostCheckBox.BindDataContext(c => c.ThreeState, (SettingsWindow w) => w.ThreeState); topMostCheckBox.CheckedBinding.BindDataContext((Window w) => w.Topmost); return topMostCheckBox; @@ -287,7 +277,7 @@ Control TopMost() Control VisibleCheckbox() { - visibleCheckBox = new CheckBox { Text = "Visible" }; + var visibleCheckBox = new CheckBox { Text = "Visible" }; visibleCheckBox.BindDataContext(c => c.ThreeState, (SettingsWindow w) => w.ThreeState); visibleCheckBox.CheckedBinding.BindDataContext((Window w) => w.Visible); return visibleCheckBox; @@ -295,7 +285,7 @@ Control VisibleCheckbox() Control CreateShowActivatedCheckbox() { - showActivatedCheckBox = new CheckBox { Text = "ShowActivated" }; + var showActivatedCheckBox = new CheckBox { Text = "ShowActivated" }; showActivatedCheckBox.BindDataContext(c => c.ThreeState, (SettingsWindow s) => s.ThreeState); showActivatedCheckBox.CheckedBinding.BindDataContext((Form w) => w.ShowActivated); showActivatedCheckBox.Bind(c => c.Enabled, typeRadio, Binding.Property((RadioButtonList t) => t.SelectedKey).ToBool("dialog").Convert(v => !v)); @@ -457,10 +447,10 @@ void CreateChild() var form = new Form(); child = form; show = form.Show; - if (showActivatedCheckBox.Checked != null) - form.ShowActivated = showActivatedCheckBox.Checked == true; - if (canFocusCheckBox.Checked != null) - form.CanFocus = canFocusCheckBox.Checked == true; + if (settings.ShowActivated != null) + form.ShowActivated = settings.ShowActivated == true; + if (settings.CanFocus != null) + form.CanFocus = settings.CanFocus == true; } break; case WindowType.FloatingForm: @@ -468,10 +458,10 @@ void CreateChild() var form = new FloatingForm(); child = form; show = form.Show; - if (showActivatedCheckBox.Checked != null) - form.ShowActivated = showActivatedCheckBox.Checked == true; - if (canFocusCheckBox.Checked != null) - form.CanFocus = canFocusCheckBox.Checked == true; + if (settings.ShowActivated != null) + form.ShowActivated = settings.ShowActivated == true; + if (settings.CanFocus != null) + form.CanFocus = settings.CanFocus == true; } break; case WindowType.Dialog: @@ -513,20 +503,20 @@ void CreateChild() if (styleCombo.Enabled) child.WindowStyle = styleCombo.SelectedValue; child.WindowState = stateCombo.SelectedValue; - if (topMostCheckBox.Checked != null) - child.Topmost = topMostCheckBox.Checked ?? false; - if (resizableCheckBox.Checked != null) - child.Resizable = resizableCheckBox.Checked ?? false; - if (maximizableCheckBox.Checked != null) - child.Maximizable = maximizableCheckBox.Checked ?? false; - if (minimizableCheckBox.Checked != null) - child.Minimizable = minimizableCheckBox.Checked ?? false; - if (showInTaskBarCheckBox.Checked != null) - child.ShowInTaskbar = showInTaskBarCheckBox.Checked ?? false; - if (closeableCheckBox.Checked != null) - child.Closeable = closeableCheckBox.Checked ?? false; - if (movableByWindowBackgroundCheckBox.Checked != null) - child.MovableByWindowBackground = movableByWindowBackgroundCheckBox.Checked ?? false; + if (settings.Topmost != null) + child.Topmost = settings.Topmost ?? false; + if (settings.Resizable != null) + child.Resizable = settings.Resizable ?? false; + if (settings.Maximizable != null) + child.Maximizable = settings.Maximizable ?? false; + if (settings.Minimizable != null) + child.Minimizable = settings.Minimizable ?? false; + if (settings.ShowInTaskbar != null) + child.ShowInTaskbar = settings.ShowInTaskbar ?? false; + if (settings.Closeable != null) + child.Closeable = settings.Closeable ?? false; + if (settings.MovableByWindowBackground != null) + child.MovableByWindowBackground = settings.MovableByWindowBackground ?? false; if (setInitialLocation) child.Location = initialLocation; if (setInitialClientSize)