Input Widget - add in FlagDuplicate() and UnflagDuplicate() in preparations for a "Show duplicates" option in input config & map hotkeys

This commit is contained in:
andres.delikat 2011-07-09 23:03:42 +00:00
parent 521b2ccfd6
commit 1e59c2f530
1 changed files with 32 additions and 10 deletions

View File

@ -16,7 +16,11 @@ namespace BizHawk.MultiClient
public bool AutoTab = true; public bool AutoTab = true;
string[] Bindings = new string[4]; string[] Bindings = new string[4];
string wasPressed = ""; string wasPressed = "";
ToolTip tooltip1 = new ToolTip();
public string ButtonName;
Color HighlightedColor = Color.Pink;
Color RegularColor = SystemColors.Window;
[DllImport("user32")] [DllImport("user32")]
private static extern bool HideCaret(IntPtr hWnd); private static extern bool HideCaret(IntPtr hWnd);
@ -25,13 +29,8 @@ namespace BizHawk.MultiClient
this.ContextMenu = new ContextMenu(); this.ContextMenu = new ContextMenu();
this.timer.Tick += new System.EventHandler(this.Timer_Tick); this.timer.Tick += new System.EventHandler(this.Timer_Tick);
InitializeBindings(); InitializeBindings();
// this.OnGotFocus tooltip1.AutoPopDelay = 2000;
} FlagDuplicate("Ur mom's button");
protected override void OnMouseClick(MouseEventArgs e)
{
HideCaret(this.Handle);
base.OnMouseClick(e);
} }
public InputWidget(int maxBindings) public InputWidget(int maxBindings)
@ -41,6 +40,28 @@ namespace BizHawk.MultiClient
MaxBind = maxBindings; MaxBind = maxBindings;
Bindings = new string[MaxBind]; Bindings = new string[MaxBind];
InitializeBindings(); InitializeBindings();
tooltip1.AutoPopDelay = 2000;
}
public void FlagDuplicate(string duplicateName)
{
RegularColor = Color.Cyan;
HighlightedColor = Color.Violet;
BackColor = RegularColor;
tooltip1.SetToolTip(this, "same mapping as " + duplicateName);
}
public void UnflagDuplicate()
{
HighlightedColor = Color.Pink;
RegularColor = SystemColors.Window;
tooltip1.SetToolTip(this, "");
}
protected override void OnMouseClick(MouseEventArgs e)
{
HideCaret(this.Handle);
base.OnMouseClick(e);
} }
private void InitializeBindings() private void InitializeBindings()
@ -252,13 +273,14 @@ namespace BizHawk.MultiClient
{ {
//base.OnGotFocus(e); //base.OnGotFocus(e);
HideCaret(this.Handle); HideCaret(this.Handle);
BackColor = Color.Pink; BackColor = HighlightedColor;
} }
protected override void OnLostFocus(EventArgs e) protected override void OnLostFocus(EventArgs e)
{ {
UnflagDuplicate();
BackColor = RegularColor;
base.OnLostFocus(e); base.OnLostFocus(e);
BackColor = SystemColors.Window;
} }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) protected override bool ProcessCmdKey(ref Message msg, Keys keyData)