/*
* Copyright (C) 2006 Eskil Bylund
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
using System;
using Gtk;
using Glade;
namespace DCSharp.GUI{
public abstract class Page : VBox
{
public event EventHandler PageChanged;
public event EventHandler StatusChanged;
private Glade.XML xml;
[Widget]
private Widget page;
#region Constructors
public Page(string resource) : base()
{
xml = new Glade.XML (null, resource, "page", null);
xml.BindFields (this);
BorderWidth = 6;
Spacing = 6;
PackEnd(page);
}
#endregion
#region Properties
public abstract string Title
{
get;
}
public abstract Gdk.Pixbuf Icon
{
get;
}
public abstract string Tooltip
{
get;
}
private string status = String.Empty;
public virtual string Status
{
get
{
return status;
}
protected set
{
status = value;
OnStatusChanged();
}
}
private bool isWorking;
public virtual bool IsWorking
{
get
{
return isWorking;
}
protected set
{
if (value != isWorking)
{
isWorking = value;
OnStatusChanged();
OnPageChanged();
}
}
}
public virtual ActionGroup Actions
{
get
{
return null;
}
}
public virtual string UI
{
get
{
return null;
}
}
#endregion
#region Methods
protected void Add(MessageArea dialog)
{
PackStart(dialog, false, false, 0);
}
protected void OnPageChanged()
{
if (PageChanged != null)
{
PageChanged(this, EventArgs.Empty);
}
}
protected void OnStatusChanged()
{
if (StatusChanged != null)
{
StatusChanged(this, EventArgs.Empty);
}
}
#endregion
}
}
|