133 lines
3.8 KiB
C#
133 lines
3.8 KiB
C#
//
|
|
// Copyright © 2006-2010, Intel Corporation. All rights reserved.
|
|
//
|
|
//File: AMT_WideInnerButton.cs
|
|
//
|
|
// Contents: Defintion of logic of a button (GUI componet)
|
|
//
|
|
using System;
|
|
using System.ComponentModel;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
|
|
namespace AMT_SW_GUI
|
|
{
|
|
public partial class AMT_WideInnerButton : Button
|
|
{
|
|
bool enabled = true;
|
|
public AMT_WideInnerButton()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public AMT_WideInnerButton(IContainer container)
|
|
{
|
|
container.Add(this);
|
|
|
|
InitializeComponent();
|
|
AMT_WideInnerButton_EnabledChanged(null, null);
|
|
}
|
|
|
|
private void AMT_WideInnerButton_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
if (this.Enabled)
|
|
this.BackgroundImage = Properties.Resources.W_thin_pressed;
|
|
}
|
|
|
|
private void AMT_WideInnerButton_MouseUp(object sender, MouseEventArgs e)
|
|
{
|
|
if (this.Enabled)
|
|
{
|
|
if (this.Focused)
|
|
this.BackgroundImage = Properties.Resources.W_thin_focus_normal;
|
|
else
|
|
this.BackgroundImage = Properties.Resources.W_thin_normal;
|
|
}
|
|
}
|
|
|
|
private void AMT_WideInnerButton_MouseLeave(object sender, EventArgs e)
|
|
{
|
|
if (this.Enabled)
|
|
{
|
|
if (this.Focused)
|
|
this.BackgroundImage = Properties.Resources.W_thin_focus_normal;
|
|
else
|
|
this.BackgroundImage = Properties.Resources.W_thin_normal;
|
|
}
|
|
}
|
|
|
|
private void AMT_WideInnerButton_MouseEnter(object sender, EventArgs e)
|
|
{
|
|
if (this.Enabled)
|
|
{
|
|
if (this.Focused)
|
|
this.BackgroundImage = Properties.Resources.W_thin_focus_over;
|
|
else
|
|
this.BackgroundImage = Properties.Resources.W_thin_over;
|
|
}
|
|
}
|
|
private void AMT_WideInnerButton_EnabledChanged(object sender, EventArgs e)
|
|
{
|
|
this.TabStop = this.Enabled;
|
|
if (this.Enabled)
|
|
AMT_WideInnerButton_MouseLeave(null, null);
|
|
else
|
|
this.BackgroundImage = Properties.Resources.W_thin_disabled;
|
|
|
|
if (this.Enabled)
|
|
this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(59)))), ((int)(((byte)(108)))));
|
|
else
|
|
this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(158)))), ((int)(((byte)(158)))));
|
|
|
|
}
|
|
protected override bool ShowFocusCues
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
public new bool Enabled
|
|
{
|
|
get { return enabled; }
|
|
set
|
|
{
|
|
base.Enabled = true;
|
|
bool difference = (enabled != value);
|
|
enabled = value;
|
|
if (difference)
|
|
AMT_WideInnerButton_EnabledChanged(null, null);
|
|
}
|
|
}
|
|
|
|
protected override void OnClick(EventArgs e)
|
|
{
|
|
if (Enabled)
|
|
base.OnClick(e);
|
|
}
|
|
private void AMT_WideInnerButton_Enter(object sender, EventArgs e)
|
|
{
|
|
if (this.Enabled)
|
|
{
|
|
this.BackgroundImage = Properties.Resources.W_thin_focus_normal;
|
|
}
|
|
}
|
|
|
|
private void AMT_WideInnerButton_Leave(object sender, EventArgs e)
|
|
{
|
|
if (this.Enabled)
|
|
{
|
|
this.BackgroundImage = Properties.Resources.W_thin_normal;
|
|
}
|
|
}
|
|
|
|
private void AMT_WideInnerButton_TextChanged(object sender, EventArgs e)
|
|
{
|
|
AMT_WideInnerButton_EnabledChanged(null, null);
|
|
}
|
|
}
|
|
}
|