mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-27 06:02:11 +00:00
@ Side panel docker (with auto hide enabled) now stays open when a textbox is focused for input
This commit is contained in:
parent
b68ae937eb
commit
5e53857fa6
2 changed files with 38 additions and 6 deletions
|
@ -77,6 +77,19 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
public bool IsCollpased { get { return iscollapsed; } }
|
||||
|
||||
// This returns true when the focus is here, but not in some special cases
|
||||
public bool IsFocused
|
||||
{
|
||||
get
|
||||
{
|
||||
Control ac = FindActiveControl();
|
||||
|
||||
// We have focus when we need the keyboard for input
|
||||
// Otherwise we don't want the focus and the docker may collapse
|
||||
return (ac is TextBox) || (ac is RichTextBox) || (ac is NumericUpDown);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor
|
||||
|
@ -92,6 +105,23 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
// This returns the active child control
|
||||
private Control FindActiveControl()
|
||||
{
|
||||
Control c = this.ActiveControl;
|
||||
|
||||
while(c is IContainerControl)
|
||||
{
|
||||
IContainerControl cc = (c as IContainerControl);
|
||||
if(cc.ActiveControl != null)
|
||||
c = cc.ActiveControl;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
// This sets up the controls for left or right alignment
|
||||
public void Setup(bool right)
|
||||
{
|
||||
|
@ -299,7 +329,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
private void tabs_Enter(object sender, EventArgs e) { General.MainWindow.FocusDisplay(); }
|
||||
private void tabs_MouseUp(object sender, MouseEventArgs e) { General.MainWindow.FocusDisplay(); }
|
||||
private void tabs_Selected(object sender, TabControlEventArgs e) { General.MainWindow.FocusDisplay(); }
|
||||
protected override void OnEnter(EventArgs e) { General.MainWindow.FocusDisplay(); }
|
||||
|
||||
// Tab selected
|
||||
private void tabs_SelectedIndexChanged(object sender, EventArgs e)
|
||||
|
|
|
@ -2585,12 +2585,15 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
if(General.Settings.CollapseDockers)
|
||||
{
|
||||
Point p = this.PointToClient(Cursor.Position);
|
||||
Rectangle r = new Rectangle(dockerspanel.Location, dockerspanel.Size);
|
||||
if(!r.IntersectsWith(new Rectangle(p, Size.Empty)))
|
||||
if(!dockerspanel.IsFocused)
|
||||
{
|
||||
dockerspanel.Collapse();
|
||||
dockerscollapser.Stop();
|
||||
Point p = this.PointToClient(Cursor.Position);
|
||||
Rectangle r = new Rectangle(dockerspanel.Location, dockerspanel.Size);
|
||||
if(!r.IntersectsWith(new Rectangle(p, Size.Empty)))
|
||||
{
|
||||
dockerspanel.Collapse();
|
||||
dockerscollapser.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue