mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-12-21 09:30:48 +00:00
110 lines
2.4 KiB
C#
110 lines
2.4 KiB
C#
|
|
||
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
||
|
|
||
|
/*
|
||
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
||
|
* This program is released under GNU General Public License
|
||
|
*
|
||
|
* 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.
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region ================== Namespaces
|
||
|
|
||
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Globalization;
|
||
|
using System.Text;
|
||
|
using System.Windows.Forms;
|
||
|
using System.IO;
|
||
|
using System.Reflection;
|
||
|
using System.Drawing;
|
||
|
using System.ComponentModel;
|
||
|
using CodeImp.DoomBuilder.Map;
|
||
|
using SlimDX.Direct3D9;
|
||
|
using SlimDX;
|
||
|
using CodeImp.DoomBuilder.Geometry;
|
||
|
using System.Drawing.Imaging;
|
||
|
using CodeImp.DoomBuilder.Data;
|
||
|
using CodeImp.DoomBuilder.Editing;
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
namespace CodeImp.DoomBuilder.Windows
|
||
|
{
|
||
|
public class PreferencesController
|
||
|
{
|
||
|
#region ================== Delegates
|
||
|
|
||
|
public delegate void AcceptDelegate(PreferencesController controller);
|
||
|
public delegate void CancelDelegate(PreferencesController controller);
|
||
|
|
||
|
public event AcceptDelegate OnAccept;
|
||
|
public event CancelDelegate OnCancel;
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region ================== Variables
|
||
|
|
||
|
private PreferencesForm form;
|
||
|
private bool allowaddtab;
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region ================== Properties
|
||
|
|
||
|
internal bool AllowAddTab { get { return allowaddtab; } set { allowaddtab = value; } }
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region ================== Constructor / Destructor
|
||
|
|
||
|
// Constructor
|
||
|
internal PreferencesController(PreferencesForm form)
|
||
|
{
|
||
|
// Initialize
|
||
|
this.form = form;
|
||
|
}
|
||
|
|
||
|
// Destructor
|
||
|
~PreferencesController()
|
||
|
{
|
||
|
form = null;
|
||
|
OnAccept = null;
|
||
|
OnCancel = null;
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region ================== Methods
|
||
|
|
||
|
// This adds a preferences tab
|
||
|
public void AddTab(TabPage tab)
|
||
|
{
|
||
|
if(!allowaddtab) throw new InvalidOperationException("Tab pages can only be added when the dialog is being initialized");
|
||
|
|
||
|
form.AddTabPage(tab);
|
||
|
}
|
||
|
|
||
|
// This raises the OnAccept event
|
||
|
public void RaiseAccept()
|
||
|
{
|
||
|
if(OnAccept != null) OnAccept(this);
|
||
|
}
|
||
|
|
||
|
// This raises the OnCancel event
|
||
|
public void RaiseCancel()
|
||
|
{
|
||
|
if(OnCancel != null) OnCancel(this);
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
}
|