mit hyphen
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
/***********************************************************************\
|
||||
* Virtuoso.Miranda.Plugins (Hyphen) *
|
||||
* Provides a managed wrapper for API of IM client Miranda. *
|
||||
* Copyright (C) 2006-2009 virtuoso *
|
||||
* deml.tomas@seznam.cz *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2.1 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
\***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace Virtuoso.Miranda.Plugins.Forms.Controls
|
||||
{
|
||||
public class CommandButton : Button
|
||||
{
|
||||
public CommandButton()
|
||||
{
|
||||
FlatStyle = FlatStyle.Standard;
|
||||
ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
TextAlign = ContentAlignment.MiddleLeft;
|
||||
TextImageRelation = TextImageRelation.ImageBeforeText;
|
||||
FlatAppearance.BorderSize = 3;
|
||||
FlatAppearance.BorderColor = SystemColors.GradientActiveCaption;
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// CommandButton
|
||||
//
|
||||
this.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control;
|
||||
this.FlatAppearance.BorderSize = 2;
|
||||
this.FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.ButtonShadow;
|
||||
this.FlatAppearance.MouseOverBackColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,197 @@
|
||||
/***********************************************************************\
|
||||
* Virtuoso.Miranda.Plugins (Hyphen) *
|
||||
* Provides a managed wrapper for API of IM client Miranda. *
|
||||
* Copyright (C) 2006-2009 virtuoso *
|
||||
* deml.tomas@seznam.cz *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2.1 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
\***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Collections.ObjectModel;
|
||||
using Virtuoso.Miranda.Plugins.Infrastructure;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Virtuoso.Miranda.Plugins.Forms.Controls
|
||||
{
|
||||
public class ContactListView : ListView
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private ImageList ContactImages;
|
||||
private System.ComponentModel.IContainer components;
|
||||
|
||||
#endregion
|
||||
|
||||
#region .ctors
|
||||
|
||||
public ContactListView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ContactListView));
|
||||
this.ContactImages = new System.Windows.Forms.ImageList(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ContactImages
|
||||
//
|
||||
this.ContactImages.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ContactImages.ImageStream")));
|
||||
this.ContactImages.TransparentColor = System.Drawing.Color.Transparent;
|
||||
this.ContactImages.Images.SetKeyName(0, "Contact");
|
||||
//
|
||||
// ContactListView
|
||||
//
|
||||
this.SmallImageList = this.ContactImages;
|
||||
this.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
||||
this.View = System.Windows.Forms.View.List;
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
public event EventHandler<ContactFilterEventArgs> FilterContact;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Handlers
|
||||
|
||||
protected virtual object CreateItemTag(ContactInfo contact)
|
||||
{
|
||||
return contact;
|
||||
}
|
||||
|
||||
protected virtual string CreateItemText(ContactInfo contact, object tag)
|
||||
{
|
||||
return contact.ToString();
|
||||
}
|
||||
|
||||
protected virtual int GetImageIndex(ContactInfo contact, object tag)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public virtual void LoadContacts()
|
||||
{
|
||||
ReadOnlyCollection<ContactInfo> contacts = MirandaContext.Current.MirandaDatabase.GetContacts(false);
|
||||
Items.Clear();
|
||||
|
||||
ContactFilterEventArgs e = new ContactFilterEventArgs();
|
||||
|
||||
for (int i = 0; i < contacts.Count; i++)
|
||||
InsertContact(contacts[i], e);
|
||||
}
|
||||
|
||||
public virtual void InsertContact(ContactInfo contact)
|
||||
{
|
||||
InsertContact(contact, null);
|
||||
}
|
||||
|
||||
private void InsertContact(ContactInfo contact, ContactFilterEventArgs e)
|
||||
{
|
||||
if (contact == null)
|
||||
throw new ArgumentNullException("contact");
|
||||
|
||||
if (e != null && FilterContact != null)
|
||||
{
|
||||
e.Contact = contact;
|
||||
e.Skip = false;
|
||||
|
||||
FilterContact(this, e);
|
||||
|
||||
if (e.Skip)
|
||||
return;
|
||||
}
|
||||
|
||||
object tag = CreateItemTag(contact);
|
||||
|
||||
if (tag != null)
|
||||
{
|
||||
ListViewItem item = new ListViewItem(CreateItemText(contact, tag), GetImageIndex(contact, tag));
|
||||
item.Tag = tag;
|
||||
|
||||
Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool RemoveContact(ContactInfo contact)
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
for (int i = 0; index == -1 && i < Items.Count; i++)
|
||||
if (Items[i].Tag.Equals(CreateItemTag(contact)))
|
||||
index = i;
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
Items.RemoveAt(index);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual ListViewItem FindContactItem(ContactInfo contact)
|
||||
{
|
||||
if (contact == null)
|
||||
throw new ArgumentNullException("contact");
|
||||
|
||||
object tag = CreateItemTag(contact);
|
||||
|
||||
ListViewItem item = null;
|
||||
|
||||
if (Items.Count > 0)
|
||||
item = FindItemWithText(CreateItemText(contact, tag), false, 0, false);
|
||||
|
||||
if (item == null)
|
||||
return null;
|
||||
|
||||
if (object.ReferenceEquals(item.Tag, tag) || (tag != null && tag.Equals(item.Tag)))
|
||||
return item;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class ContactFilterEventArgs : EventArgs
|
||||
{
|
||||
public ContactFilterEventArgs() { }
|
||||
|
||||
private ContactInfo contact;
|
||||
public ContactInfo Contact
|
||||
{
|
||||
get { return contact; }
|
||||
internal set { contact = value; }
|
||||
}
|
||||
|
||||
private bool skip;
|
||||
public bool Skip
|
||||
{
|
||||
get { return skip; }
|
||||
set { skip = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ContactImages.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="ContactImages.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAq
|
||||
BwAAAk1TRnQBSQFMAwEBAAEEAQABBAEAARABAAEQAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABQAMA
|
||||
ARADAAEBAQABIAYAARAaAAEDAgEBAgEYAgEBHwFIAgIBggFVAgIBqgFcAgIBvgFkAQkBCAHWAVYCAgGp
|
||||
ARICAQEX3AABDwIBARIBZQIIAdUBfQEwASoB7gHVAbABjgH/AegBvQGRAf8B7AHAAZcB/wHgAbYBjAH/
|
||||
AdMBqgGBAf8BawEWAREB5AEmAgEBN9QAAQ0CAQEPAXIBHAEUAeQB4AG1AYoB/wHmAcgBtwH/AeMBvgGg
|
||||
Af8B4QG3AY0B/wHlAb4BmQH/AdoBtgGRAf8B2QGwAYgB/wHQAaUBgQH/AUgCAgGB2AABYQIGAc0B4QGx
|
||||
AYgB/wHLAboBrwH/AfIB2QHGAf8B6AG+AZEB/wHsAcgBpAH/AeEBwgGkAf8B2AGyAYsB/wHFAZ0BfwH/
|
||||
AUECAQFw1AABmwGcAZMB/wFwASQBHAHsAfcBvAGVAf8BzQHAAbYB/wL9AfwC/wHQAaAB/wH1AcwBpgH/
|
||||
AeYByQGtAf8B6AG/AZYB/wGPAVcBPQH5AYgBhwGEAf8EAAFeAgYB1wFeAQYBBAHWAV0CBgHZAVUCAgGr
|
||||
wAABbgEgARwB5wHjAe4B5QH/AfMBzwGfAf8BxgGuAZ8B/wFMAXcBmQH/AZcBlQGUAf8B8QHCAZUB/wH3
|
||||
AcwBogH/Ac4BpQGBAf8BigJ/Af4BXAENAQwB5gGCAYUBgQH/AfMB6AHbAf8B7QHiAdQC/wH3AewB/wF1
|
||||
AS0BKAHtwAABbQEaARkB5QT/AesB4AHPAf8BfQF6AYEB/wEoAVYBgQH/ASIBUwGBAf8BlwGMAYEB/wHH
|
||||
AaYBhQH/AdMBxgG8Af8B9wHtAeUB/wH3Ae0B5QH/AfcB7QHlAf8B9wHtAeUB/wH3Ae0B5QH/AfcB7QHl
|
||||
Af8BcQEoASQB7MAAAW0BGgEZAeUE/wG8AbsBvQH/ATMBTwF9Af4BRgFrAYkB/wE4AWMBiAH/AWgBSAFJ
|
||||
AfgB5QHbAdMB/wH3Ae0B5QH/AfcB7QHlAf8B9wHtAeUB/wH3Ae0B5QH/AfcB7QHlAf8B9wHtAeUB/wH3
|
||||
Ae0B5QH/AXEBKAEkAezAAAFtARoBGQHlAfcB9QH2Af8BdQGKAaoB/wFWAX8BoAH/AVoBgQGgAf8BRQFw
|
||||
AZEB/wGlAasBsQH/AdIBvAGwAf8B9wHtAeUB/wH3Ae0B5QH/AfcB7QHlAf8B9wHtAeUB/wH3Ae0B5QH/
|
||||
AfcB7QHlAf8B9wHtAeUB/wFxASgBJAHswAABbQEaARkB5QHqAegB6gH/AXYBlAG6Af8BeAGZAb8B/wFu
|
||||
AY0BswH/AVMBgAGiAf8BRQFeAXQB/wHGAbQBqgH/AfcB7QHlAf8BxgGzAaQB/wHGAbMBpAH/AcYBswGk
|
||||
Af8BxgGzAaQB/wHGAbMBpAH/AfUB6QHgAf8BcQEoASQB7MAAAW0BGgEZAeUC5wHtAf8BjQGyAdcB/wGb
|
||||
Ab8B5QH/AYEBpQHPAf8BWgF+AZkB/wE2AUIBTQH/AaYBmgGTAf8B9wHtAeUB/wHSAcIBtQH/AdQBxgG4
|
||||
Af8B1AHGAbgB/wHUAcYBuAH/AdMBxAG2Af8B9wHtAeUB/wFxASkBJAHswAABbQEaARkB5QH0AfIB8wH/
|
||||
AZEBrgHKAf4BnwHGAe4B/wGBAaoB1wH/AVYBawGBAf8BNwEuAScB/wGSAYcBgQH/AfcB7QHlAf8B0QHB
|
||||
AbIB/wHUAcQBtwH/AdQBxAG3Af8B1AHGAbcB/wHTAcQBtgH/AfoB8QHpAf8BcQEpASQB7MAAAW0BGgEZ
|
||||
AeUB+QH3AfYB/wGdAaIBqQH/AYABgQGLAf8BdQF9AYEB/wJaAVsB/wFFAUMBQQH/AcgBvgG4Af8B9wHt
|
||||
AeUB/wHGAbMBpAH/AcYBswGkAf8BxgGzAaQB/wHGAbMBpAH/AcYBswGkAf8B+wH0Ae0B/wFzASYBIAHr
|
||||
wAABbQEZARcB5QT/AdgBzgHHAf8BpQGfAZoB/wGBAXsBeQH/AXMBcQFuAf8BrQGmAaIB/wHpAdwB1AP/
|
||||
Af4B/wH9AfsB9gH/AfoB9wH0Af8B9wH1AfIB/wH1AfIB7AH/AfMB7AHlAf8B/gH6AfQB/wFtAR0BHAHn
|
||||
wAABaQEXARUB4xz/AYMCQAHvAXQBHwEeAeUBcQEfAR4B5QFxAR8BHgHlAXEBHwEeAeUBcQEfAR4B5QF0
|
||||
ASIBHwHlAVACAgGYwAAB2AHbAdEB/wGRAZMBiAH/AZEBkwGIAf8BkQGTAYgB/wGRAZMBiAH/AZEBkwGI
|
||||
Af8BkQGTAYgB/wGRAZMBiAH/AdgB2wHRAf/cAAFCAU0BPgcAAT4DAAEoAwABQAMAARADAAEBAQABAQUA
|
||||
AYAXAAP/AQABwAE/BgABgAEfBwABHwYAAYABHwcAARBXAAF/BgAL
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,189 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Virtuoso.Miranda.Plugins.Forms.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Draws a textbox with a prompt inside of it, similar to the "Quick Search" box
|
||||
/// in Outlook 2007, IE7 or the Firefox 2.0 search box. The prompt will disappear when
|
||||
/// the focus is placed in the textbox, and will not display again if the Text property
|
||||
/// contains any value. If the Text property is empty, then the prompt will display
|
||||
/// again when the textbox loses the focus.
|
||||
/// </summary>
|
||||
public class CueBannerTextBox : System.Windows.Forms.TextBox
|
||||
{
|
||||
// Windows message constants
|
||||
const int WM_SETFOCUS = 7;
|
||||
const int WM_KILLFOCUS = 8;
|
||||
const int WM_ERASEBKGND = 14;
|
||||
const int WM_PAINT = 15;
|
||||
|
||||
// private internal variables
|
||||
private bool _focusSelect = true;
|
||||
private bool _drawPrompt = true;
|
||||
private string _bannerText = String.Empty;
|
||||
private Color _bannerColor = SystemColors.GrayText;
|
||||
private Font _bannerFont = null;
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor
|
||||
/// </summary>
|
||||
/// <remarks>Uncomment the SetStyle line to activate the OnPaint logic in place of the WndProc logic</remarks>
|
||||
public CueBannerTextBox()
|
||||
{
|
||||
//this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.BannerFont = this.Font;
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
[EditorBrowsable(EditorBrowsableState.Always)]
|
||||
[Category("Appearance")]
|
||||
[Description("The prompt text to display when there is nothing in the Text property.")]
|
||||
public string BannerText
|
||||
{
|
||||
get { return _bannerText; }
|
||||
set { if (value == null) value = String.Empty; _bannerText = value.Trim(); this.Invalidate(); }
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
[EditorBrowsable(EditorBrowsableState.Always)]
|
||||
[Category("Appearance")]
|
||||
[Description("The ForeColor to use when displaying the PromptText.")]
|
||||
public Color BannerForeColor
|
||||
{
|
||||
get { return _bannerColor; }
|
||||
set { _bannerColor = value; this.Invalidate(); }
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
[EditorBrowsable(EditorBrowsableState.Always)]
|
||||
[Category("Appearance")]
|
||||
[Description("The Font to use when displaying the PromptText.")]
|
||||
public Font BannerFont
|
||||
{
|
||||
get { return _bannerFont; }
|
||||
set { _bannerFont = value; this.Invalidate(); }
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
[EditorBrowsable(EditorBrowsableState.Always)]
|
||||
[Category("Behavior")]
|
||||
[Description("Automatically select the text when control receives the focus.")]
|
||||
public bool FocusSelect
|
||||
{
|
||||
get { return _focusSelect; }
|
||||
set { _focusSelect = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When the textbox receives an OnEnter event, select all the text if any text is present
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnEnter(EventArgs e)
|
||||
{
|
||||
if (this.Text.Length > 0 && _focusSelect)
|
||||
this.SelectAll();
|
||||
|
||||
base.OnEnter(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Redraw the control when the text alignment changes
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnTextAlignChanged(EventArgs e)
|
||||
{
|
||||
base.OnTextAlignChanged(e);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Redraw the control with the prompt
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
/// <remarks>This event will only fire if ControlStyles.UserPaint is set to true in the constructor</remarks>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
// Only draw the prompt in the OnPaint event and when the Text property is empty
|
||||
if (_drawPrompt && this.Text.Length == 0)
|
||||
DrawTextPrompt(e.Graphics);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the default WndProc for the control
|
||||
/// </summary>
|
||||
/// <param name="m">The Windows message structure</param>
|
||||
/// <remarks>
|
||||
/// This technique is necessary because the OnPaint event seems to be doing some
|
||||
/// extra processing that I haven't been able to figure out.
|
||||
/// </remarks>
|
||||
protected override void WndProc(ref System.Windows.Forms.Message m)
|
||||
{
|
||||
switch (m.Msg)
|
||||
{
|
||||
case WM_SETFOCUS:
|
||||
_drawPrompt = false;
|
||||
break;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
_drawPrompt = true;
|
||||
break;
|
||||
}
|
||||
|
||||
base.WndProc(ref m);
|
||||
|
||||
// Only draw the prompt on the WM_PAINT event and when the Text property is empty
|
||||
if (m.Msg == WM_PAINT && _drawPrompt && this.Text.Length == 0 && !this.GetStyle(ControlStyles.UserPaint))
|
||||
DrawTextPrompt();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overload to automatically create the Graphics region before drawing the text prompt
|
||||
/// </summary>
|
||||
/// <remarks>The Graphics region is disposed after drawing the prompt.</remarks>
|
||||
protected virtual void DrawTextPrompt()
|
||||
{
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
{
|
||||
DrawTextPrompt(g);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the PromptText in the TextBox.ClientRectangle using the PromptFont and PromptForeColor
|
||||
/// </summary>
|
||||
/// <param name="g">The Graphics region to draw the prompt on</param>
|
||||
protected virtual void DrawTextPrompt(Graphics g)
|
||||
{
|
||||
TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.Top | TextFormatFlags.EndEllipsis;
|
||||
Rectangle rect = this.ClientRectangle;
|
||||
|
||||
// Offset the rectangle based on the HorizontalAlignment,
|
||||
// otherwise the display looks a little strange
|
||||
switch (this.TextAlign)
|
||||
{
|
||||
case HorizontalAlignment.Center:
|
||||
flags = flags | TextFormatFlags.HorizontalCenter;
|
||||
rect.Offset(0, 1);
|
||||
break;
|
||||
case HorizontalAlignment.Left:
|
||||
flags = flags | TextFormatFlags.Left;
|
||||
rect.Offset(1, 1);
|
||||
break;
|
||||
case HorizontalAlignment.Right:
|
||||
flags = flags | TextFormatFlags.Right;
|
||||
rect.Offset(0, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
// Draw the prompt text using TextRenderer
|
||||
TextRenderer.DrawText(g, _bannerText, _bannerFont, rect, _bannerColor, this.BackColor, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) Chili Software. All rights reserved.
|
||||
//
|
||||
// File: CueBannerTextBox.cs
|
||||
//
|
||||
// Description: Text box that allows to display a cue banner.
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Idea from: http://www.delphipraxis.net/topic13132_editgetcuebannertext+win+xp.html
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Virtuoso.Miranda.Plugins.Forms.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents a text box that is enhanced to display a little cue banner, if
|
||||
/// no text has been entered. This could be used to inform the user what should be entered
|
||||
/// in the text box.
|
||||
/// </summary>
|
||||
public class CueBannerTextBox : TextBox
|
||||
{
|
||||
#region NativeMethods
|
||||
|
||||
private const uint ECM_FIRST = 0x1500;
|
||||
private const uint EM_SETCUEBANNER = ECM_FIRST + 1;
|
||||
private const uint WM_SETFONT = 0x30;
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
|
||||
private static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, string lParam);
|
||||
|
||||
#endregion
|
||||
|
||||
private string _bannerText;
|
||||
private Font _bannerFont;
|
||||
|
||||
/// <summary>
|
||||
/// The banner text associated with the control.
|
||||
/// </summary>
|
||||
[Description("The banner text associated with the control.")]
|
||||
[Category("Appearance")]
|
||||
public string BannerText
|
||||
{
|
||||
get { return _bannerText; }
|
||||
set
|
||||
{
|
||||
_bannerText = value;
|
||||
|
||||
// If supported set the value as banner text.
|
||||
if (IsSupported)
|
||||
SendMessage(this.Handle, EM_SETCUEBANNER, IntPtr.Zero, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The banner font used to display the banner text in the control.
|
||||
/// </summary>
|
||||
[Description("The banner font used to display the banner text in the control.")]
|
||||
[Category("Appearance")]
|
||||
public Font BannerFont
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_bannerFont == null && this.Parent != null)
|
||||
return this.Parent.Font;
|
||||
|
||||
return _bannerFont;
|
||||
}
|
||||
set { _bannerFont = value; }
|
||||
}
|
||||
|
||||
#region Overridden Members
|
||||
|
||||
/// <summary>
|
||||
/// Invoked each time the focus is lost.
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnLostFocus(EventArgs e)
|
||||
{
|
||||
base.OnLostFocus(e);
|
||||
|
||||
// Notify the text box to change the font to the banner font.
|
||||
if (this.Text.Length == 0 && IsSupported)
|
||||
{
|
||||
SendMessage(this.Handle, WM_SETFONT, _bannerFont.ToHfont(), null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked each time the focus is gotten.
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnGotFocus(EventArgs e)
|
||||
{
|
||||
base.OnGotFocus(e);
|
||||
|
||||
// Notify the text box to change the font back.
|
||||
if (IsSupported)
|
||||
SendMessage(this.Handle, WM_SETFONT, base.Font.ToHfont(), null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the OS supports banner texts. It is fine if the application
|
||||
/// runs on XP or higher.
|
||||
/// </summary>
|
||||
private bool IsSupported
|
||||
{
|
||||
get
|
||||
{
|
||||
Version v = Environment.OSVersion.Version;
|
||||
return ((v.Major == 5 && v.Minor == 1) || v.Major > 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/***********************************************************************\
|
||||
* Virtuoso.Miranda.Plugins (Hyphen) *
|
||||
* Provides a managed wrapper for API of IM client Miranda. *
|
||||
* Copyright (C) 2006-2009 virtuoso *
|
||||
* deml.tomas@seznam.cz *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2.1 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
\***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace Virtuoso.Miranda.Plugins.Forms.Controls
|
||||
{
|
||||
[ToolboxBitmap(typeof(Panel))]
|
||||
public sealed class GradientPanel : Panel
|
||||
{
|
||||
public GradientPanel() { }
|
||||
|
||||
private Color gradientColor;
|
||||
public Color GradientColor
|
||||
{
|
||||
get { return gradientColor; }
|
||||
set { gradientColor = value; Refresh(); }
|
||||
}
|
||||
|
||||
private float rotation;
|
||||
public float Rotation
|
||||
{
|
||||
get { return rotation; }
|
||||
set { rotation = value; Refresh(); }
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
if (e.ClipRectangle.IsEmpty) return;
|
||||
|
||||
using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, BackColor, GradientColor, Rotation))
|
||||
e.Graphics.FillRectangle(brush, ClientRectangle);
|
||||
|
||||
base.OnPaint(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
/***********************************************************************\
|
||||
* Virtuoso.Miranda.Plugins (Hyphen) *
|
||||
* Provides a managed wrapper for API of IM client Miranda. *
|
||||
* Copyright (C) 2006-2009 virtuoso *
|
||||
* deml.tomas@seznam.cz *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2.1 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
\***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using Virtuoso.Miranda.Plugins.Native;
|
||||
using System.Drawing;
|
||||
using Virtuoso.Miranda.Plugins.Infrastructure;
|
||||
using Virtuoso.Miranda.Plugins.Resources;
|
||||
using Virtuoso.Miranda.Plugins.Forms.Controls;
|
||||
|
||||
namespace Virtuoso.Miranda.Plugins.Forms.Controls
|
||||
{
|
||||
// Impl note: must be public, remoting rejects non-public method calls.
|
||||
public sealed class ManagedMainMenu : ContextMenuStrip
|
||||
{
|
||||
#region Delegates
|
||||
|
||||
private delegate void AddMainMenuItemInvoker(ManagedMainMenu menu, ManagedMainMenuItem item);
|
||||
private delegate void ModifyMenuItemInvoker(ManagedMainMenu menu, ref CLISTMENUITEM itemData, string handle);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
|
||||
private static readonly Random HandleGenerator = new Random();
|
||||
|
||||
private static readonly AddMainMenuItemInvoker AddMainMenuItemDelegate = new AddMainMenuItemInvoker(AddMainMenuItem);
|
||||
private static readonly ModifyMenuItemInvoker ModifyMenuItemDelegate = new ModifyMenuItemInvoker(ModifyMenuItem);
|
||||
|
||||
private static readonly ToolStripMenuItem EmptyItem;
|
||||
private readonly int EmptyItemIndex;
|
||||
|
||||
#endregion
|
||||
|
||||
#region .ctors & .dctors
|
||||
|
||||
static ManagedMainMenu()
|
||||
{
|
||||
EmptyItem = new ToolStripMenuItem(TextResources.UI_Label_Empty);
|
||||
EmptyItem.Visible = false;
|
||||
}
|
||||
|
||||
internal ManagedMainMenu()
|
||||
{
|
||||
RenderMode = ToolStripRenderMode.System;
|
||||
EmptyItemIndex = Items.Add(EmptyItem);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
#region Overrides
|
||||
|
||||
public override object InitializeLifetimeService()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UI
|
||||
|
||||
internal void ShowUnderCursor()
|
||||
{
|
||||
if (Items.Count == 1)
|
||||
Items[EmptyItemIndex].Visible = true;
|
||||
else
|
||||
Items[EmptyItemIndex].Visible = false;
|
||||
|
||||
Show(Cursor.Position);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Interceptors
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="menu"></param>
|
||||
/// <remarks>
|
||||
/// This method is static to not let the execution run in default AppDomain but in a domain of the menu itself.
|
||||
/// </remarks>
|
||||
internal static void RegisterInterceptors(ManagedMainMenu menu)
|
||||
{
|
||||
MirandaContext context = MirandaContext.Current;
|
||||
|
||||
context.ServiceCallInterceptors.Register(MirandaServices.MS_CLIST_ADDMAINMENUITEM, menu.AddMainMenuItemServiceInterceptor);
|
||||
context.ServiceCallInterceptors.Register(MirandaServices.MS_CLIST_MODIFYMENUITEM, menu.ModifyMenuItemInterceptor);
|
||||
}
|
||||
|
||||
internal static void UnregisterInterceptors(ManagedMainMenu menu)
|
||||
{
|
||||
MirandaContext context = MirandaContext.Current;
|
||||
|
||||
context.ServiceCallInterceptors.Unregister(MirandaServices.MS_CLIST_ADDMAINMENUITEM);
|
||||
context.ServiceCallInterceptors.Unregister(MirandaServices.MS_CLIST_MODIFYMENUITEM);
|
||||
}
|
||||
|
||||
private int AddMainMenuItemServiceInterceptor(UIntPtr wParam, IntPtr lParam)
|
||||
{
|
||||
CLISTMENUITEM itemData = (CLISTMENUITEM)Marshal.PtrToStructure(lParam, typeof(CLISTMENUITEM));
|
||||
ManagedMainMenuItem menuItem = null;
|
||||
Image itemImage = null;
|
||||
|
||||
if (itemData.Icon != IntPtr.Zero)
|
||||
itemImage = IconImageCache.Singleton.GetIconImage(itemData.Icon);
|
||||
|
||||
menuItem = new ManagedMainMenuItem(itemData.Text, itemData.PopUpMenu, itemData.Service, itemImage);
|
||||
|
||||
if (InvokeRequired)
|
||||
Invoke(AddMainMenuItemDelegate, this, menuItem);
|
||||
else
|
||||
AddMainMenuItemDelegate(this, menuItem);
|
||||
|
||||
return menuItem.Handle;
|
||||
}
|
||||
|
||||
private static void AddMainMenuItem(ManagedMainMenu menu, ManagedMainMenuItem item)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(item.PopUpMenu))
|
||||
{
|
||||
string popupName = item.PopUpMenu;
|
||||
ToolStripMenuItem popupItem = null;
|
||||
|
||||
ToolStripItem[] popupItems = menu.Items.Find(popupName, false);
|
||||
|
||||
if (popupItems.Length > 0)
|
||||
popupItem = (ToolStripMenuItem)popupItems[0];
|
||||
else
|
||||
{
|
||||
popupItem = new ToolStripMenuItem(popupName);
|
||||
popupItem.Name = popupName;
|
||||
|
||||
menu.Items.Add(popupItem);
|
||||
}
|
||||
|
||||
popupItem.DropDownItems.Add(item);
|
||||
}
|
||||
else
|
||||
menu.Items.Add(item);
|
||||
}
|
||||
|
||||
private int ModifyMenuItemInterceptor(UIntPtr wParam, IntPtr lParam)
|
||||
{
|
||||
try
|
||||
{
|
||||
CLISTMENUITEM itemData = (CLISTMENUITEM)Marshal.PtrToStructure(lParam, typeof(CLISTMENUITEM));
|
||||
string handle = wParam.ToString();
|
||||
|
||||
if (!Items.ContainsKey(handle))
|
||||
{
|
||||
if (String.IsNullOrEmpty(itemData.PopUpMenu) ||
|
||||
!Items.ContainsKey(itemData.PopUpMenu) ||
|
||||
!((ToolStripMenuItem)Items[itemData.PopUpMenu]).DropDownItems.ContainsKey(handle))
|
||||
return MirandaContext.Current.CallService(MirandaServices.MS_CLIST_MODIFYMENUITEM, wParam, lParam, true);
|
||||
}
|
||||
|
||||
if (InvokeRequired)
|
||||
Invoke(ModifyMenuItemDelegate, this, itemData, handle);
|
||||
else
|
||||
ModifyMenuItemDelegate(this, ref itemData, handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
private static void ModifyMenuItem(ManagedMainMenu menu, ref CLISTMENUITEM itemData, string handle)
|
||||
{
|
||||
ManagedMainMenuItem item = (ManagedMainMenuItem)menu.Items.Find(handle, itemData.PopUpMenu != null)[0];
|
||||
MenuItemModifyFlags flags = (MenuItemModifyFlags)itemData.Flags;
|
||||
|
||||
if ((flags & MenuItemModifyFlags.CMIM_NAME) == MenuItemModifyFlags.CMIM_NAME)
|
||||
item.Text = itemData.Text;
|
||||
|
||||
if ((flags & MenuItemModifyFlags.CMIM_ICON) == MenuItemModifyFlags.CMIM_ICON)
|
||||
item.Image = IconImageCache.Singleton.GetIconImage(itemData.Icon);
|
||||
|
||||
if ((flags & MenuItemModifyFlags.CMIM_HOTKEY) == MenuItemModifyFlags.CMIM_HOTKEY)
|
||||
item.ShortcutKeys = (Keys)itemData.HotKey;
|
||||
|
||||
if ((flags & MenuItemModifyFlags.CMIM_FLAGS) == MenuItemModifyFlags.CMIM_FLAGS)
|
||||
{
|
||||
MenuItemProperties itemFlags = (MenuItemProperties)(flags & ~MenuItemModifyFlags.CMIM_ALL);
|
||||
|
||||
switch (itemFlags)
|
||||
{
|
||||
case MenuItemProperties.Grayed:
|
||||
item.Enabled = false;
|
||||
break;
|
||||
case MenuItemProperties.Hidden:
|
||||
if (item.OwnerItem == null)
|
||||
menu.Items.Remove(item);
|
||||
else
|
||||
{
|
||||
ToolStripMenuItem popupItem = (ToolStripMenuItem)item.OwnerItem;
|
||||
popupItem.DropDownItems.Remove(item);
|
||||
|
||||
if (popupItem.DropDownItems.Count == 0)
|
||||
menu.Items.Remove(popupItem);
|
||||
}
|
||||
break;
|
||||
case MenuItemProperties.Checked:
|
||||
item.Checked = true;
|
||||
break;
|
||||
case MenuItemProperties.None:
|
||||
item.Enabled = true;
|
||||
item.Visible = true;
|
||||
item.Checked = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/***********************************************************************\
|
||||
* Virtuoso.Miranda.Plugins (Hyphen) *
|
||||
* Provides a managed wrapper for API of IM client Miranda. *
|
||||
* Copyright (C) 2006-2009 virtuoso *
|
||||
* deml.tomas@seznam.cz *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2.1 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
\***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Virtuoso.Miranda.Plugins.Infrastructure;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Virtuoso.Miranda.Plugins.Forms.Controls
|
||||
{
|
||||
internal class ManagedMainMenuItem : ToolStripMenuItem
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private static readonly Random HandleGenerator = new Random();
|
||||
|
||||
private int handle;
|
||||
private string service, popUpMenu;
|
||||
|
||||
#endregion
|
||||
|
||||
#region .ctors
|
||||
|
||||
public ManagedMainMenuItem(string text, string popUpMenu, string service, Image image)
|
||||
{
|
||||
if (String.IsNullOrEmpty(text)) throw new ArgumentNullException("text");
|
||||
if (String.IsNullOrEmpty(service)) throw new ArgumentNullException("service");
|
||||
|
||||
this.Name = (handle = HandleGenerator.Next()).ToString();
|
||||
|
||||
this.Text = text;
|
||||
this.popUpMenu = popUpMenu;
|
||||
this.service = service;
|
||||
this.Image = image;
|
||||
|
||||
this.Click += new EventHandler(ManagedMainMenuItem_Click);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public string PopUpMenu
|
||||
{
|
||||
get { return popUpMenu; }
|
||||
}
|
||||
|
||||
public string Service
|
||||
{
|
||||
get { return service; }
|
||||
}
|
||||
|
||||
public int Handle
|
||||
{
|
||||
get { return handle; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
private void ManagedMainMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MirandaContext.Current.CallService(service);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/***********************************************************************\
|
||||
* Virtuoso.Miranda.Plugins (Hyphen) *
|
||||
* Provides a managed wrapper for API of IM client Miranda. *
|
||||
* Copyright (C) 2006-2009 virtuoso *
|
||||
* deml.tomas@seznam.cz *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2.1 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
\***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Virtuoso.Miranda.Plugins.Infrastructure;
|
||||
using Virtuoso.Miranda.Plugins.Configuration.Forms;
|
||||
using Virtuoso.Miranda.Plugins.Configuration;
|
||||
using Virtuoso.Miranda.Plugins.Resources;
|
||||
using Virtuoso.Hyphen;
|
||||
|
||||
namespace Virtuoso.Miranda.Plugins.Forms.Controls
|
||||
{
|
||||
internal sealed class TrayContextMenu : ContextMenuStrip
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private ToolStripMenuItem ManagePluginsITEM;
|
||||
|
||||
#endregion
|
||||
|
||||
#region .ctors
|
||||
|
||||
public TrayContextMenu()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Designer
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TrayContextMenu));
|
||||
this.ManagePluginsITEM = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ManagePluginsITEM
|
||||
//
|
||||
this.ManagePluginsITEM.Image = ((System.Drawing.Image)(resources.GetObject("ManagePluginsITEM.Image")));
|
||||
this.ManagePluginsITEM.Name = "ManagePluginsITEM";
|
||||
this.ManagePluginsITEM.Size = new System.Drawing.Size(111, 22);
|
||||
this.ManagePluginsITEM.Text = "Options";
|
||||
this.ManagePluginsITEM.Click += new System.EventHandler(this.ManagePluginsITEM_Click);
|
||||
//
|
||||
// TrayContextMenu
|
||||
//
|
||||
this.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.ManagePluginsITEM});
|
||||
this.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
|
||||
this.Size = new System.Drawing.Size(112, 26);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UI Handlers
|
||||
|
||||
private void ManagePluginsITEM_Click(object sender, EventArgs e)
|
||||
{
|
||||
Loader.GetInstance().ManagePlugins();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="ManagePluginsITEM.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAQCAYAAADJViUEAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEwAA
|
||||
CxMBAJqcGAAAAtdJREFUOE99U0tPE1EUblgQV64MCQv3rtwZE2NMiIkbQzTEldENFmpbWvqkpVT6pC2l
|
||||
7ZS+3/Td6UyH0k6nBUt5yQKNAv4Gg0YXxMQYg6VzvDbBCGm4m3tz73e+853zncvhXLI0YXpTG6Y/X4b5
|
||||
96aJ1oZm4/VDTYR5OB2mB3RR5rsxXoepYOWm0r8imQ5UjiRu8lZPMm2UeWJINMAQr3f0MaZtiDOAdtBF
|
||||
a6wuQrO6KA1SD/X4XLAmUrutjTF3Z6LMiKuw+TtVfwvL2x+B3DwEfH0f8q8/QKD8BuZSa6zcU1aIsdI9
|
||||
kYu4w1GFqld18fqxId4ADN8AYuMACs334CG3wbjU6BgTjVNnoQXB5V0IULtgRGrUvjIoPcttjjJQ6Z+J
|
||||
1BJIIpus70EeBdqyzc50uBZWh+nr6hA9qA5WKX2UaWN4C2ypNVB5y6zIVUx05auC1QFDjGFLW4ewiDKi
|
||||
hkkuNkXpL+uNsRrYs01QeMgOkt3HUYeq5KsI/UmP5BRbB2BIrP3o1U25j7ox5S93TAgnw4ow6SoecZCX
|
||||
X3XoAtmCGrMPuhhz3CtY5qEGFW6irQtXQOIqgtiRhy5O4VsZRtkhvfoO7Lkmq/CVRy8SIH8lKi8JMz4K
|
||||
xPY8K1jAh7oYibs0rAlWOt7SDvipHdCGKqeTbvL+GQE6j8gw4pfaS4Ecw0FozZwK7PkHHKGj2C/3Ukea
|
||||
UBVMyC4fuQVYvgVoKDpyT+mbbJH8MuUmWZWHBIULB5EtAzxzEsbNqZ9d8gkX8VLgILgiZ3F9FtVkTTaQ
|
||||
JatgRtM1G1wBjbcEUlSjcD4D43OpvXFL+jnXnOaeK03gKDxVuEus1EWwUicOk84Cqi8LAmsG+HNJ4JmW
|
||||
YMySHus52xMOXCvFiBO+vWARLOSfTdjzJwJLGoT2nJhny/pe6OMdrjl1PuP/TCjwEX8+d+XvnWA+t8G3
|
||||
ZbpfkmfNXuOakrxR01LfGf4P/J24pw50qlAAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,61 @@
|
||||
/***********************************************************************\
|
||||
* Virtuoso.Miranda.Plugins (Hyphen) *
|
||||
* Provides a managed wrapper for API of IM client Miranda. *
|
||||
* Copyright (C) 2006-2009 virtuoso *
|
||||
* deml.tomas@seznam.cz *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2.1 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
\***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Virtuoso.Miranda.Plugins.Resources;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using Virtuoso.Miranda.Plugins.Infrastructure;
|
||||
|
||||
namespace Virtuoso.Miranda.Plugins.Forms.Controls
|
||||
{
|
||||
internal sealed class TrayMenuManager : IDisposable
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private readonly NotifyIcon TrayIcon;
|
||||
|
||||
#endregion
|
||||
|
||||
#region .ctors
|
||||
|
||||
public TrayMenuManager()
|
||||
{
|
||||
TrayIcon = new NotifyIcon();
|
||||
|
||||
TrayIcon.Text = TextResources.UI_ToolTip_HyphenTrayIcon;
|
||||
TrayIcon.Visible = true;
|
||||
TrayIcon.Icon = VisualResources.Icon_16x16_Hyphen;
|
||||
TrayIcon.ContextMenuStrip = new TrayContextMenu();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (TrayIcon != null)
|
||||
TrayIcon.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user