Added an ISA bus mutex.
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) 2009-2010
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.
39 using System.Collections.Generic;
41 using System.Windows.Forms;
43 namespace OpenHardwareMonitor.GUI {
44 public class SplitContainerAdv : SplitContainer {
46 private int delta = 0;
47 private Border3DStyle border3DStyle = Border3DStyle.Raised;
48 private Color color = SystemColors.Control;
50 public SplitContainerAdv()
52 SetStyle(ControlStyles.ResizeRedraw, true);
53 SetStyle(ControlStyles.AllPaintingInWmPaint, true);
54 SetStyle(ControlStyles.UserPaint, true);
55 SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
56 SetStyle(ControlStyles.ContainerControl, true);
60 protected override void OnPaint(PaintEventArgs e) {
63 Graphics g = e.Graphics;
64 Rectangle r = SplitterRectangle;
65 using (SolidBrush brush = new SolidBrush(color))
66 g.FillRectangle(brush, r);
67 ControlPaint.DrawBorder3D(g, r, border3DStyle);
70 protected override void OnKeyDown(KeyEventArgs e) {
71 if (!base.IsSplitterFixed) {
72 if (e.KeyData == Keys.Right || e.KeyData == Keys.Down) {
73 SplitterDistance += SplitterIncrement;
74 } else if (e.KeyData == Keys.Left || e.KeyData == Keys.Up) {
75 SplitterDistance -= SplitterIncrement;
81 protected override void OnMouseDown(MouseEventArgs e) {
82 if (Orientation == Orientation.Vertical) {
83 delta = this.SplitterDistance - e.X;
84 Cursor.Current = Cursors.VSplit;
86 delta = this.SplitterDistance - e.Y;
87 Cursor.Current = Cursors.HSplit;
89 base.IsSplitterFixed = true;
92 protected override void OnMouseMove(MouseEventArgs e) {
93 if (base.IsSplitterFixed) {
94 if (e.Button == MouseButtons.Left) {
95 if (Orientation == Orientation.Vertical) {
96 if (e.X > 0 && e.X < Width) {
97 SplitterDistance = e.X + delta < 0 ? 0 : e.X + delta;
100 if (e.Y > 0 && e.Y < Height) {
101 SplitterDistance = e.Y + delta < 0 ? 0 : e.Y + delta;
105 base.IsSplitterFixed = false;
109 if (SplitterRectangle.Contains(e.Location)) {
110 Cursor = Orientation == Orientation.Vertical ?
111 Cursors.VSplit : Cursors.HSplit;
116 protected override void OnMouseLeave(EventArgs e) {
117 base.OnMouseLeave(e);
118 Cursor = Cursors.Default;
121 protected override void OnMouseUp(MouseEventArgs e) {
123 base.IsSplitterFixed = false;
124 Cursor.Current = Cursors.Default;
127 public Border3DStyle Border3DStyle {
128 get { return border3DStyle; }
130 border3DStyle = value;
136 get { return color; }
143 public new bool IsSplitterFixed {