mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-21 17:11:29 +01:00
Converted the StatusStrip of the MainWindow to a clickthrough StatusStrip.
So the user can click it immediately without having to bring the window into focus first. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>
This commit is contained in:
parent
451afe6d93
commit
56628d4b83
63
XenAdmin/Controls/StatusStripEx.cs
Normal file
63
XenAdmin/Controls/StatusStripEx.cs
Normal file
@ -0,0 +1,63 @@
|
||||
/* Copyright (c) Cloud Software Group, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace XenAdmin.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// A System.Windows.Forms.StatusStrip with the option of click-through
|
||||
/// (see https://learn.microsoft.com/en-us/archive/blogs/rickbrew/how-to-enable-click-through-for-net-2-0-toolstrip-and-menustrip)
|
||||
/// </summary>
|
||||
public class StatusStripEx : StatusStrip
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets whether the StatusStripEx honors item clicks when its containing form does
|
||||
/// not have input focus.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default value is false, which is the same behavior provided by the base StatusStrip class.
|
||||
/// </remarks>
|
||||
public bool ClickThrough { get; set; }
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
base.WndProc(ref m);
|
||||
|
||||
if (ClickThrough &&
|
||||
m.Msg == NativeConstants.WM_MOUSEACTIVATE &&
|
||||
m.Result == (IntPtr)NativeConstants.MA_ACTIVATEANDEAT)
|
||||
{
|
||||
m.Result = (IntPtr)NativeConstants.MA_ACTIVATE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -35,12 +35,10 @@ namespace XenAdmin.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// A System.Windows.Forms.ToolStrip with the option of click-through
|
||||
/// (see http://blogs.msdn.com/rickbrew/archive/2006/01/09/511003.aspx)
|
||||
/// (see https://learn.microsoft.com/en-us/archive/blogs/rickbrew/how-to-enable-click-through-for-net-2-0-toolstrip-and-menustrip)
|
||||
/// </summary>
|
||||
public class ToolStripEx : ToolStrip
|
||||
{
|
||||
private bool clickThrough = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the ToolStripEx honors item clicks when its containing form does
|
||||
/// not have input focus.
|
||||
@ -48,22 +46,13 @@ namespace XenAdmin.Controls
|
||||
/// <remarks>
|
||||
/// Default value is false, which is the same behavior provided by the base ToolStrip class.
|
||||
/// </remarks>
|
||||
public bool ClickThrough
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.clickThrough;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.clickThrough = value;
|
||||
}
|
||||
}
|
||||
public bool ClickThrough { get; set; }
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
base.WndProc(ref m);
|
||||
if (this.clickThrough &&
|
||||
|
||||
if (ClickThrough &&
|
||||
m.Msg == NativeConstants.WM_MOUSEACTIVATE &&
|
||||
m.Result == (IntPtr)NativeConstants.MA_ACTIVATEANDEAT)
|
||||
{
|
||||
|
25
XenAdmin/MainWindow.Designer.cs
generated
25
XenAdmin/MainWindow.Designer.cs
generated
@ -287,13 +287,13 @@ namespace XenAdmin
|
||||
this.relNotesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.securityGroupsToolStripMenuItem = new XenAdmin.Commands.CommandToolStripMenuItem();
|
||||
this.MenuPanel = new System.Windows.Forms.Panel();
|
||||
this.StatusStrip = new System.Windows.Forms.StatusStrip();
|
||||
this.StatusStrip = new XenAdmin.Controls.StatusStripEx();
|
||||
this.statusProgressBar = new System.Windows.Forms.ToolStripProgressBar();
|
||||
this.statusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.statusButtonProgress = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.statusButtonErrors = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.statusButtonCdnUpdates = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.statusButtonUpdates = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.statusButtonCdnUpdates = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.statusButtonAlerts = new System.Windows.Forms.ToolStripSplitButton();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
@ -2002,6 +2002,7 @@ namespace XenAdmin
|
||||
// StatusStrip
|
||||
//
|
||||
resources.ApplyResources(this.StatusStrip, "StatusStrip");
|
||||
this.StatusStrip.ClickThrough = true;
|
||||
this.StatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.statusProgressBar,
|
||||
this.statusLabel,
|
||||
@ -2046,15 +2047,6 @@ namespace XenAdmin
|
||||
this.statusButtonErrors.Name = "statusButtonErrors";
|
||||
this.statusButtonErrors.Click += new System.EventHandler(this.statusButtonErrors_Click);
|
||||
//
|
||||
// statusButtonCdnUpdates
|
||||
//
|
||||
this.statusButtonCdnUpdates.DropDownButtonWidth = 0;
|
||||
this.statusButtonCdnUpdates.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
|
||||
this.statusButtonCdnUpdates.Image = global::XenAdmin.Properties.Resources.notif_updates_16;
|
||||
resources.ApplyResources(this.statusButtonCdnUpdates, "statusButtonCdnUpdates");
|
||||
this.statusButtonCdnUpdates.Name = "statusButtonCdnUpdates";
|
||||
this.statusButtonCdnUpdates.Click += new System.EventHandler(this.statusButtonCdnUpdates_Click);
|
||||
//
|
||||
// statusButtonUpdates
|
||||
//
|
||||
this.statusButtonUpdates.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
|
||||
@ -2065,6 +2057,15 @@ namespace XenAdmin
|
||||
this.statusButtonUpdates.Name = "statusButtonUpdates";
|
||||
this.statusButtonUpdates.Click += new System.EventHandler(this.statusButtonUpdates_Click);
|
||||
//
|
||||
// statusButtonCdnUpdates
|
||||
//
|
||||
this.statusButtonCdnUpdates.DropDownButtonWidth = 0;
|
||||
this.statusButtonCdnUpdates.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
|
||||
this.statusButtonCdnUpdates.Image = global::XenAdmin.Properties.Resources.notif_updates_16;
|
||||
resources.ApplyResources(this.statusButtonCdnUpdates, "statusButtonCdnUpdates");
|
||||
this.statusButtonCdnUpdates.Name = "statusButtonCdnUpdates";
|
||||
this.statusButtonCdnUpdates.Click += new System.EventHandler(this.statusButtonCdnUpdates_Click);
|
||||
//
|
||||
// statusButtonAlerts
|
||||
//
|
||||
this.statusButtonAlerts.DropDownButtonWidth = 0;
|
||||
@ -2318,7 +2319,7 @@ namespace XenAdmin
|
||||
private System.Windows.Forms.ToolStripMenuItem customTemplatesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem templatesToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem localStorageToolStripMenuItem;
|
||||
private System.Windows.Forms.StatusStrip StatusStrip;
|
||||
private XenAdmin.Controls.StatusStripEx StatusStrip;
|
||||
private System.Windows.Forms.ToolStripStatusLabel statusLabel;
|
||||
private System.Windows.Forms.ToolStripProgressBar statusProgressBar;
|
||||
private XenAdmin.Commands.CommandToolStripMenuItem reclaimFreedSpacetripMenuItem;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -199,6 +199,9 @@
|
||||
<Compile Include="Controls\DiskSpinner.Designer.cs">
|
||||
<DependentUpon>DiskSpinner.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\StatusStripEx.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\TreeViews\FolderChangeDialogTreeView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
Loading…
Reference in New Issue
Block a user