using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace RainmeterStudio.Rainmeter
{
///
/// Represents a group
///
///
/// Skins, meters, and measures can be categorized into groups to allow
/// easier control with group bangs. For example, the !HideMeterGroup
/// bang may be used to hide multiple meters in a single bang (compared
/// to !HideMeter statements for each meter).
///
public abstract class Group
{
#region Imports
[DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern bool Group_BelongsToGroup(out bool result, Int32 handle, string group);
[DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern bool Group_Destroy(Int32 handle);
#endregion
///
/// Gets or sets the associated handle of this object
///
protected Int32 Handle { get; private set; }
///
/// Tests if belongs to a group
///
/// Group name
/// True if belongs
public bool BelongsToGroup(string group)
{
bool result;
if (!Group_BelongsToGroup(out result, Handle, group))
throw new ExternalException("Belongs to group failed.");
return result;
}
///
/// Initializes this group
///
/// The handle
protected Group(Int32 handle)
{
Handle = handle;
}
///
/// Finalizer
///
~Group()
{
Group_Destroy(Handle);
}
}
}