Fixed Issue 137.
1.1 --- a/GUI/Gadget.cs Tue Nov 16 21:48:26 2010 +0000
1.2 +++ b/GUI/Gadget.cs Sun Nov 21 12:28:31 2010 +0000
1.3 @@ -137,7 +137,16 @@
1.4 remove {
1.5 window.HitTest -= value;
1.6 }
1.7 - }
1.8 + }
1.9 +
1.10 + public event MouseEventHandler MouseDoubleClick {
1.11 + add {
1.12 + window.MouseDoubleClick += value;
1.13 + }
1.14 + remove {
1.15 + window.MouseDoubleClick -= value;
1.16 + }
1.17 + }
1.18
1.19 private void CreateBuffer() {
1.20 this.buffer = new Bitmap(window.Size.Width, window.Size.Height,
2.1 --- a/GUI/GadgetWindow.cs Tue Nov 16 21:48:26 2010 +0000
2.2 +++ b/GUI/GadgetWindow.cs Sun Nov 21 12:28:31 2010 +0000
2.3 @@ -132,6 +132,11 @@
2.4 }
2.5 } break;
2.6 case WM_NCLBUTTONDBLCLK: {
2.7 + if (MouseDoubleClick != null) {
2.8 + MouseDoubleClick(this, new MouseEventArgs(MouseButtons.Left, 2,
2.9 + Macros.GET_X_LPARAM(message.LParam) - location.X,
2.10 + Macros.GET_Y_LPARAM(message.LParam) - location.Y, 0));
2.11 + }
2.12 message.Result = IntPtr.Zero;
2.13 } break;
2.14 case WM_NCRBUTTONDOWN: {
2.15 @@ -360,6 +365,8 @@
2.16
2.17 public event HitTestEventHandler HitTest;
2.18
2.19 + public event MouseEventHandler MouseDoubleClick;
2.20 +
2.21 [StructLayout(LayoutKind.Sequential, Pack = 1)]
2.22 private struct BlendFunction {
2.23 public byte BlendOp;
3.1 --- a/GUI/MainForm.cs Tue Nov 16 21:48:26 2010 +0000
3.2 +++ b/GUI/MainForm.cs Sun Nov 21 12:28:31 2010 +0000
3.3 @@ -129,6 +129,8 @@
3.4 minCloseMenuItem.Visible = false;
3.5 } else { // Windows
3.6 gadget = new SensorGadget(computer, settings, unitManager);
3.7 + gadget.HideShowCommand += hideShowClick;
3.8 +
3.9 wmiProvider = new WmiProvider(computer);
3.10 }
3.11
4.1 --- a/GUI/SensorGadget.cs Tue Nov 16 21:48:26 2010 +0000
4.2 +++ b/GUI/SensorGadget.cs Sun Nov 21 12:28:31 2010 +0000
4.3 @@ -194,6 +194,10 @@
4.4 settings.SetValue("sensorGadget.Width", Size.Width);
4.5 Redraw();
4.6 };
4.7 +
4.8 + MouseDoubleClick += delegate(object obj, MouseEventArgs args) {
4.9 + SendHideShowCommand();
4.10 + };
4.11 }
4.12
4.13 public override void Dispose() {
4.14 @@ -304,6 +308,13 @@
4.15 Resize();
4.16 }
4.17
4.18 + public event EventHandler HideShowCommand;
4.19 +
4.20 + public void SendHideShowCommand() {
4.21 + if (HideShowCommand != null)
4.22 + HideShowCommand(this, null);
4.23 + }
4.24 +
4.25 private Font CreateFont(float size, FontStyle style) {
4.26 try {
4.27 return new Font(SystemFonts.MessageBoxFont.FontFamily, size, style);