|
using System;
using System.Collections.Generic;
using System.Text;
using Fluid.Controls;
using System.Drawing;
using PasswordSafe.Templates;
using PasswordSafe.Classes;
namespace PasswordSafe
{
public class DetailListBox:ListBoxBase
{
protected override void InitControl()
{
base.InitControl();
//ShowHeader = false;
detail = new DetailTemplate();
Template = detail;
ItemHeight = Template.Height;
}
private DetailTemplate detail;
private NotifyList details;
public NotifyList Details
{
get { return details; }
set
{
if (details != value)
{
details = value;
//ShowHeader = value != null && value.Count > 3 && value[0] is IGroupHeader;
DataSource = value;
}
}
}
public override void OnKeyDown(System.Windows.Forms.KeyEventArgs e)
{
switch (e.KeyCode)
{
case System.Windows.Forms.Keys.Enter:
detail.Bind(SelectedItemIndex);
detail.Focus();
e.Handled = true;
break;
}
base.OnKeyDown(e);
}
public override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e)
{
switch (e.KeyChar)
{
case '\r': break;
case '\t': SelectNextItem(); break;
default: detail.InsertKey(e); break;
}
base.OnKeyPress(e);
}
public DetailTemplate DetailTemplate { get { return Template as DetailTemplate; } }
protected override void OnItemClick(int index)
{
base.OnItemClick(index);
DetailTemplate.Focus();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.