using System;
namespace JRummell.Web
{
[Serializable]
public class BrowserWindow
{
#region Fields
private string url;
private WindowName name;
private int width;
private int height;
private int left;
private int top;
private bool location;
private bool menubar;
private bool resizable;
private bool scrollbars;
private bool status;
private bool titlebar;
#endregion
#region Constructors
///
/// Initializes a new instance of the class.
///
public BrowserWindow()
: this(null) { }
///
/// Initializes a new instance of the class.
///
/// The target URL.
public BrowserWindow(string url)
: this (url, 0, 0)
{ }
///
/// Initializes a new instance of the class.
///
/// The target URL.
/// The width in pixels.
/// The height in pixels.
public BrowserWindow(string url, int width, int height)
: this (url, WindowName._blank, width, height)
{ }
///
/// Initializes a new instance of the class.
///
/// The target URL.
/// The window name.
/// The width in pixels.
/// The height in pixels.
public BrowserWindow(string url, WindowName name,
int width, int height)
: this (url, name, width, height, 0, 0,
false, false, false, false, false, false)
{ }
///
/// Initializes a new instance of the class.
///
/// The target URL.
/// The window name.
/// The width in pixels.
/// The height in pixels.
/// The left offset in pixels.
/// The top offset in pixels.
/// if set to true shows address bar.
/// if set to true shows menubar.
/// if set to true the window is resizable.
/// if set to true shows scrollbars.
/// if set to true shows status bar.
/// if set to true shows titlebar.
public BrowserWindow(string url, WindowName name,
int width, int height, int left, int top,
bool location, bool menubar, bool resizable,
bool scrollbars, bool status, bool titlebar)
{
this.Url = url;
this.Name = name;
this.Width = width;
this.Height = height;
this.Left = left;
this.Top = top;
this.Location = location;
this.Menubar = menubar;
this.Resizable = resizable;
this.Scrollbars = scrollbars;
this.Status = status;
this.Titlebar = titlebar;
}
#endregion
#region Properties
///
/// Gets or sets the height in pixels.
///
/// The height in pixels.
public int Height
{
get { return this.height; }
set { this.height = value; }
}
///
/// Gets or sets the left offset in pixels.
///
/// The left offset in pixels.
public int Left
{
get { return this.left; }
set { this.left = value; }
}
///
/// Gets or sets a value indicating whether the address bar is visible.
///
/// true if location; otherwise, false.
public bool Location
{
get { return this.location; }
set { this.location = value; }
}
///
/// Gets or sets a value indicating whether the menubar is visible.
///
/// true if menubar; otherwise, false.
public bool Menubar
{
get { return this.menubar; }
set { this.menubar = value; }
}
///
/// Gets or sets the window name.
///
/// The window name.
public WindowName Name
{
get { return this.name; }
set { this.name = value; }
}
///
/// Gets or sets a value indicating whether the window is resizable.
///
/// true if resizable; otherwise, false.
public bool Resizable
{
get { return this.resizable; }
set { this.resizable = value; }
}
///
/// Gets or sets a value indicating whether the scrollbars are visible.
///
/// true if scrollbars; otherwise, false.
public bool Scrollbars
{
get { return this.scrollbars; }
set { this.scrollbars = value; }
}
///
/// Gets or sets a value indicating whether the status bar is visible.
///
/// true if status; otherwise, false.
public bool Status
{
get { return this.status; }
set { this.status = value; }
}
///
/// Gets or sets a value indicating whether the title bar is visible.
///
/// true if titlebar; otherwise, false.
public bool Titlebar
{
get { return this.titlebar; }
set { this.titlebar = value; }
}
///
/// Gets or sets the top offset in pixels.
///
/// The top offset in pixels.
public int Top
{
get { return this.top; }
set { this.top = value; }
}
///
/// Gets or sets the target URL.
///
/// The target URL.
public string Url
{
get { return this.url; }
set { this.url = value; }
}
///
/// Gets or sets the width in pixels.
///
/// The width in pixels.
public int Width
{
get { return this.width; }
set { this.width = value; }
}
#endregion
}
///
/// An enum representing the possible window name options.
///
public enum WindowName
{
_blank,
_parent,
_self,
_top
}
}