Added code to save and restore the plot sensor selection.
3 Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 The contents of this file are subject to the Mozilla Public License Version
6 1.1 (the "License"); you may not use this file except in compliance with
7 the License. You may obtain a copy of the License at
9 http://www.mozilla.org/MPL/
11 Software distributed under the License is distributed on an "AS IS" basis,
12 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 for the specific language governing rights and limitations under the License.
15 The Original Code is the Open Hardware Monitor code.
17 The Initial Developer of the Original Code is
18 Michael Möller <m.moeller@gmx.ch>.
19 Portions created by the Initial Developer are Copyright (C) 2010-2011
20 the Initial Developer. All Rights Reserved.
24 Alternatively, the contents of this file may be used under the terms of
25 either the GNU General Public License Version 2 or later (the "GPL"), or
26 the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 in which case the provisions of the GPL or the LGPL are applicable instead
28 of those above. If you wish to allow use of your version of this file only
29 under the terms of either the GPL or the LGPL, and not to allow others to
30 use your version of this file under the terms of the MPL, indicate your
31 decision by deleting the provisions above and replace them with the notice
32 and other provisions required by the GPL or the LGPL. If you do not delete
33 the provisions above, a recipient may use your version of this file under
34 the terms of any one of the MPL, the GPL or the LGPL.
40 using System.Windows.Forms;
42 namespace OpenHardwareMonitor.GUI {
43 public abstract class Gadget : IDisposable {
45 private GadgetWindow window;
48 this.window = new GadgetWindow();
49 this.window.Paint += delegate(object sender, PaintEventArgs e) {
54 public virtual void Dispose() {
58 public Point Location {
60 return window.Location;
63 window.Location = value;
67 public event EventHandler LocationChanged {
69 window.LocationChanged += value;
72 window.LocationChanged -= value;
76 public virtual Size Size {
81 this.window.Size = value;
85 public event EventHandler SizeChanged {
87 window.SizeChanged += value;
90 window.SizeChanged -= value;
96 return window.Opacity;
99 window.Opacity = value;
103 public bool LockPositionAndSize {
105 return window.LockPositionAndSize;
108 window.LockPositionAndSize = value;
112 public bool AlwaysOnTop {
114 return window.AlwaysOnTop;
117 window.AlwaysOnTop = value;
121 public ContextMenu ContextMenu {
123 return window.ContextMenu;
126 window.ContextMenu = value;
130 public event HitTestEventHandler HitTest {
132 window.HitTest += value;
135 window.HitTest -= value;
139 public event MouseEventHandler MouseDoubleClick {
141 window.MouseDoubleClick += value;
144 window.MouseDoubleClick -= value;
148 public bool Visible {
150 return window.Visible;
153 if (value != window.Visible) {
154 window.Visible = value;
155 if (VisibleChanged != null)
156 VisibleChanged(this, EventArgs.Empty);
163 public event EventHandler VisibleChanged;
165 public void Redraw() {
169 protected abstract void OnPaint(PaintEventArgs e);