[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnetlib/System.Windows.Forms SaveFileDialog.cs, NO
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnetlib/System.Windows.Forms SaveFileDialog.cs, NONE, 1.1 CommonDialog.cs, 1.2, 1.3 FileDialog.cs, 1.1, 1.2 OpenFileDialog.cs, 1.1, 1.2 |
Date: |
Fri, 14 Nov 2003 03:47:23 +0000 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms
In directory subversions:/tmp/cvs-serv12758/System.Windows.Forms
Modified Files:
CommonDialog.cs FileDialog.cs OpenFileDialog.cs
Added Files:
SaveFileDialog.cs
Log Message:
Flesh out some of the file dialog classes (not finished yet).
Index: FileDialog.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/FileDialog.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** FileDialog.cs 6 Jul 2003 05:57:31 -0000 1.1
--- FileDialog.cs 14 Nov 2003 03:47:21 -0000 1.2
***************
*** 1,7 ****
/*
! * FileDialog.cs - Implementation of the "System.Windows.Forms.FileDialog"
class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
- * Copyright (C) 2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
--- 1,7 ----
/*
! * FileDialog.cs - Implementation of the
! * "System.Windows.Forms.FileDialog" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
***************
*** 25,273 ****
using System.ComponentModel;
- [TODO]
public abstract class FileDialog : CommonDialog
{
! [TODO]
! protected static readonly object EventFileOk = null;
! [TODO]
! public bool AddExtension
! {
! get
! {
! throw new NotImplementedException("AddExtension");
! }
! set
! {
! throw new NotImplementedException("AddExtension");
! }
! }
! [TODO]
public virtual bool CheckFileExists
! {
! get
! {
! throw new NotImplementedException("CheckFileExists");
! }
! set
! {
! throw new NotImplementedException("CheckFileExists");
! }
! }
!
! [TODO]
public bool CheckPathExists
! {
! get
! {
! throw new NotImplementedException("CheckPathExists");
! }
! set
! {
! throw new NotImplementedException("CheckPathExists");
! }
! }
!
! [TODO]
! public string DefaultExt
! {
! get
! {
! throw new NotImplementedException("DefaultExt");
! }
! set
! {
! throw new NotImplementedException("DefaultExt");
! }
! }
!
! [TODO]
public bool DereferenceLinks
! {
! get
! {
! throw new NotImplementedException("DereferenceLinks");
! }
! set
! {
! throw new NotImplementedException("DereferenceLinks");
! }
! }
!
! [TODO]
! public string FileName
! {
! get
! {
! throw new NotImplementedException("FileName");
! }
! set
! {
! throw new NotImplementedException("FileName");
! }
! }
!
[TODO]
! public string[] FileNames
! {
! get
! {
! throw new NotImplementedException("FileNames");
! }
! }
!
[TODO]
! public string Filter
! {
! get
! {
! throw new NotImplementedException("Filter");
! }
! set
! {
! throw new NotImplementedException("Filter");
! }
! }
!
[TODO]
public int FilterIndex
! {
! get
! {
! throw new NotImplementedException("FilterIndex");
! }
! set
! {
! throw new NotImplementedException("FilterIndex");
! }
! }
!
! [TODO]
! public string InitialDirectory
! {
! get
! {
! throw new NotImplementedException("InitialDirectory");
! }
! set
! {
! throw new NotImplementedException("InitialDirectory");
! }
! }
!
! [TODO]
protected virtual IntPtr Instance
! {
! get
! {
! throw new NotImplementedException("Instance");
! }
! }
!
! [TODO]
protected int Options
! {
! get
! {
! throw new NotImplementedException("Options");
! }
! }
!
! [TODO]
public bool RestoreDirectory
! {
! get
! {
! throw new NotImplementedException("RestoreDirectory");
! }
! set
! {
! throw new NotImplementedException("RestoreDirectory");
! }
! }
!
! [TODO]
public bool ShowHelp
! {
! get
! {
! throw new NotImplementedException("ShowHelp");
! }
! set
! {
! throw new NotImplementedException("ShowHelp");
! }
! }
!
! [TODO]
! public string Title
! {
! get
! {
! throw new NotImplementedException("Title");
! }
! set
! {
! throw new NotImplementedException("Title");
! }
! }
!
[TODO]
public bool ValidateNames
! {
! get
! {
! throw new NotImplementedException("ValidateNames");
! }
! set
! {
! throw new NotImplementedException("ValidateNames");
! }
! }
! [TODO]
! protected override IntPtr HookProc(IntPtr hWnd, int msg, IntPtr wparam,
IntPtr lparam)
! {
! throw new NotImplementedException("HookProc");
! }
! [TODO]
protected void OnFileOk(CancelEventArgs e)
! {
! throw new NotImplementedException("OnFileOk");
! }
[TODO]
public override void Reset()
! {
! throw new NotImplementedException("Reset");
! }
! [TODO]
protected override bool RunDialog(IntPtr hWndOwner)
! {
! throw new NotImplementedException("RunDialog");
! }
!
[TODO]
public override string ToString()
! {
! throw new NotImplementedException("ToString");
! }
! [TODO]
! public event CancelEventHandler FileOk
! {
! add
! {
! throw new NotImplementedException("FileOk");
! }
! remove
! {
! throw new NotImplementedException("FileOk");
! }
! }
}; // class FileDialog
--- 25,321 ----
using System.ComponentModel;
public abstract class FileDialog : CommonDialog
{
+ // Internal state.
+ private bool addExtension;
+ internal bool checkFileExists;
+ private bool checkPathExists;
+ private bool dereferenceLinks;
+ private String defaultExt;
+ private String fileName;
+ private String[] fileNames;
+ private String filter;
+ private int filterIndex;
+ private String initialDirectory;
+ private bool restoreDirectory;
+ private bool showHelp;
+ private bool validateNames;
+ private String title;
! // Event identifier for the "FileOk" event.
! protected static readonly object EventFileOk = new Object();
! // Constructor.
! internal FileDialog()
! {
! // Make sure that the dialog fields have their
default values.
! Reset();
! }
! // Get or set this object's properties.
! public bool AddExtension
! {
! get
! {
! return addExtension;
! }
! set
! {
! addExtension = value;
! }
! }
public virtual bool CheckFileExists
! {
! get
! {
! return checkFileExists;
! }
! set
! {
! checkFileExists = value;
! }
! }
public bool CheckPathExists
! {
! get
! {
! return checkPathExists;
! }
! set
! {
! checkPathExists = value;
! }
! }
! public String DefaultExt
! {
! get
! {
! return defaultExt;
! }
! set
! {
! defaultExt = value;
! }
! }
public bool DereferenceLinks
! {
! get
! {
! return dereferenceLinks;
! }
! set
! {
! dereferenceLinks = value;
! }
! }
[TODO]
! public String FileName
! {
! get
! {
! return fileName;
! }
! set
! {
! // TODO: update the dialog box to match.
! fileName = value;
! fileNames = null;
! }
! }
! public String[] FileNames
! {
! get
! {
! if(fileNames == null)
! {
! if(fileName != null &&
fileName.Length > 0)
! {
! fileNames = new String
[] {fileName};
! return fileNames;
! }
! else
! {
! return new String [0];
! }
! }
! else
! {
! return fileNames;
! }
! }
! }
[TODO]
! public String Filter
! {
! get
! {
! return filter;
! }
! set
! {
! // TODO: validate the filter string.
! // TODO: update the dialog box to match.
! filter = value;
! }
! }
[TODO]
public int FilterIndex
! {
! get
! {
! return filterIndex;
! }
! set
! {
! // TODO: validate the filter index.
! // TODO: update the dialog box to match.
! filterIndex = value;
! }
! }
! public String InitialDirectory
! {
! get
! {
! return initialDirectory;
! }
! set
! {
! initialDirectory = value;
! }
! }
protected virtual IntPtr Instance
! {
! get
! {
! // Not used in this implementation.
! return IntPtr.Zero;
! }
! }
protected int Options
! {
! get
! {
! // Not used in this implementation.
! return 0;
! }
! }
public bool RestoreDirectory
! {
! get
! {
! return restoreDirectory;
! }
! set
! {
! restoreDirectory = value;
! }
! }
public bool ShowHelp
! {
! get
! {
! return showHelp;
! }
! set
! {
! showHelp = value;
! }
! }
[TODO]
+ public String Title
+ {
+ get
+ {
+ if(title == null || title ==
String.Empty)
+ {
+ return DefaultTitle;
+ }
+ return title;
+ }
+ set
+ {
+ // TODO: update the dialog box to match.
+ title = value;
+ }
+ }
+ internal virtual String DefaultTitle
+ {
+ get
+ {
+ // Overridden by subclasses to supply
"Open" or "Save As".
+ return String.Empty;
+ }
+ }
public bool ValidateNames
! {
! get
! {
! return validateNames;
! }
! set
! {
! validateNames = value;
! }
! }
! // Hook procedure - not used in this implementation.
! protected override IntPtr HookProc(IntPtr hWnd, int msg,
!
IntPtr wparam, IntPtr lparam)
! {
! return IntPtr.Zero;
! }
! // Raise the "FileOk" event.
protected void OnFileOk(CancelEventArgs e)
! {
! if(FileOk != null)
! {
! FileOk(this, e);
! }
! }
+ // Reset the dialog box controls to their default values.
[TODO]
public override void Reset()
! {
! addExtension = true;
! checkFileExists = false;
! checkPathExists = true;
! dereferenceLinks = true;
! defaultExt = String.Empty;
! fileName = String.Empty;
! fileNames = null;
! filter = "All files (*.*)|*.*";
! filterIndex = 1;
! initialDirectory = String.Empty;
! restoreDirectory = false;
! showHelp = false;
! validateNames = true;
! title = String.Empty;
! // TODO: update an active dialog box form to
match.
! }
! // Run the dialog box.
protected override bool RunDialog(IntPtr hWndOwner)
! {
! // This version is not used in this
implementation.
! return false;
! }
[TODO]
+ internal override DialogResult RunDialog(IWin32Window owner)
+ {
+ // TODO
+ return DialogResult.None;
+ }
+
+ // Convert this object into a string.
public override string ToString()
! {
! return base.ToString() + ": Title: " + Title +
! ", FileName: " + FileName;
! }
! // Event that is raised to check that a file is OK.
! public event CancelEventHandler FileOk;
}; // class FileDialog
Index: OpenFileDialog.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/OpenFileDialog.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** OpenFileDialog.cs 6 Jul 2003 05:57:31 -0000 1.1
--- OpenFileDialog.cs 14 Nov 2003 03:47:21 -0000 1.2
***************
*** 1,8 ****
/*
* OpenFileDialog.cs - Implementation of the
! * "System.Windows.Forms.OpenFileDialog" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
- * Copyright (C) 2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
--- 1,7 ----
/*
* OpenFileDialog.cs - Implementation of the
! * "System.Windows.Forms.OpenFileDialog" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
***************
*** 26,101 ****
using System.IO;
- [TODO]
public sealed class OpenFileDialog : FileDialog
{
! [TODO]
! public OpenFileDialog()
! {
! throw new NotImplementedException(".ctor");
! }
! [TODO]
! public override bool CheckFileExists
! {
! get
! {
! throw new NotImplementedException("CheckFileExists");
! }
! set
! {
! throw new NotImplementedException("CheckFileExists");
! }
! }
! [TODO]
public bool Multiselect
! {
! get
! {
! throw new NotImplementedException("Multiselect");
! }
! set
! {
! throw new NotImplementedException("Multiselect");
! }
! }
!
[TODO]
public bool ReadOnlyChecked
! {
! get
! {
! throw new NotImplementedException("ReadOnlyChecked");
! }
! set
! {
! throw new NotImplementedException("ReadOnlyChecked");
! }
! }
!
! [TODO]
public bool ShowReadOnly
! {
! get
! {
! throw new NotImplementedException("ShowReadOnly");
! }
! set
! {
! throw new NotImplementedException("ShowReadOnly");
! }
! }
!
[TODO]
public Stream OpenFile()
! {
! throw new NotImplementedException("OpenFile");
! }
! [TODO]
public override void Reset()
! {
! throw new NotImplementedException("Reset");
! }
}; // class OpenFileDialog
--- 25,116 ----
using System.IO;
public sealed class OpenFileDialog : FileDialog
{
! // Internal state.
! private bool multiselect;
! private bool readOnlyChecked;
! private bool showReadOnly;
! // Constructor
! public OpenFileDialog() {}
! // Get or set this object's properties.
! public override bool CheckFileExists
! {
! get
! {
! return base.CheckFileExists;
! }
! set
! {
! base.CheckFileExists = value;
! }
! }
public bool Multiselect
! {
! get
! {
! return multiselect;
! }
! set
! {
! multiselect = value;
! }
! }
[TODO]
public bool ReadOnlyChecked
! {
! get
! {
! return readOnlyChecked;
! }
! set
! {
! // TODO: update the dialog box to match.
! readOnlyChecked = value;
! }
! }
public bool ShowReadOnly
! {
! get
! {
! return showReadOnly;
! }
! set
! {
! showReadOnly = value;
! }
! }
[TODO]
+ internal override String DefaultTitle
+ {
+ get
+ {
+ // TODO: make this translatable.
+ return "Open";
+ }
+ }
+
+ // Open the file specified by this dialog box.
public Stream OpenFile()
! {
! String filename = FileName;
! if(filename == null || filename.Length == 0)
! {
! throw new
ArgumentNullException("FileName");
! }
! return new FileStream(filename, FileMode.Open,
!
FileAccess.Read, FileShare.Read);
! }
! // Reset the contents of the dialog box.
public override void Reset()
! {
! base.Reset();
! checkFileExists = true;
! multiselect = false;
! readOnlyChecked = false;
! showReadOnly = false;
! }
}; // class OpenFileDialog
--- NEW FILE: SaveFileDialog.cs ---
/*
* SaveFileDialog.cs - Implementation of the
* "System.Windows.Forms.SaveFileDialog" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Windows.Forms
{
using System.IO;
public sealed class SaveFileDialog : FileDialog
{
// Internal state.
private bool createPrompt;
private bool overwritePrompt;
// Constructor
public SaveFileDialog() {}
// Get or set this object's properties.
public bool CreatePrompt
{
get
{
return createPrompt;
}
set
{
createPrompt = value;
}
}
public bool OverwritePrompt
{
get
{
return overwritePrompt;
}
set
{
overwritePrompt = value;
}
}
[TODO]
internal override String DefaultTitle
{
get
{
// TODO: make this translatable.
return "Save As";
}
}
// Open the file specified by this dialog box.
public Stream OpenFile()
{
String filename = FileName;
if(filename == null || filename.Length == 0)
{
throw new
ArgumentNullException("FileName");
}
return new FileStream(filename, FileMode.Create,
FileAccess.ReadWrite);
}
// Reset the contents of the dialog box.
public override void Reset()
{
base.Reset();
createPrompt = false;
overwritePrompt = true;
}
}; // class SaveFileDialog
}; // namespace System.Windows.Forms
Index: CommonDialog.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/CommonDialog.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CommonDialog.cs 13 Aug 2003 01:21:41 -0000 1.2
--- CommonDialog.cs 14 Nov 2003 03:47:21 -0000 1.3
***************
*** 1,7 ****
/*
! * CommonDialog.cs - Implementation of the
"System.Windows.Forms.CommonDialog" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
- * Copyright (C) 2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
--- 1,7 ----
/*
! * CommonDialog.cs - Implementation of the
! * "System.Windows.Forms.CommonDialog" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
***************
*** 25,29 ****
using System.ComponentModel;
- [TODO]
public abstract class CommonDialog
#if CONFIG_COMPONENT_MODEL
--- 25,28 ----
***************
*** 31,85 ****
#endif
{
! [TODO]
! public CommonDialog()
! {
! throw new NotImplementedException(".ctor");
! }
!
! [TODO]
! protected virtual IntPtr HookProc(IntPtr hWnd, int msg, IntPtr wparam,
IntPtr lparam)
! {
! throw new NotImplementedException("HookProc");
! }
!
! [TODO]
! protected virtual void OnHelpRequest(EventArgs e)
! {
! throw new NotImplementedException("OnHelpRequest");
! }
!
! [TODO]
! protected virtual IntPtr OwnerWndProc(IntPtr hWnd, int msg, IntPtr
wparam, IntPtr lparam)
! {
! throw new NotImplementedException("OwnerWndProc");
! }
public abstract void Reset();
protected abstract bool RunDialog(IntPtr hwndOwner);
! [TODO]
! public DialogResult ShowDialog()
! {
! throw new NotImplementedException("ShowDialog");
! }
! [TODO]
public DialogResult ShowDialog(IWin32Window owner)
! {
! throw new NotImplementedException("ShowDialog");
! }
! [TODO]
! public event EventHandler HelpRequest
! {
! add
! {
! throw new NotImplementedException("HelpRequest");
! }
! remove
! {
! throw new NotImplementedException("HelpRequest");
! }
! }
}; // class CommonDialog
--- 30,84 ----
#endif
{
! // Constructor.
! public CommonDialog() {}
+ // Reset the dialog box controls to their default values.
public abstract void Reset();
+
+ // Run the dialog box, with a particular parent owner.
+ // This method is not used in this implementation.
protected abstract bool RunDialog(IntPtr hwndOwner);
! // Run the dialog box - internal version.
! internal virtual DialogResult RunDialog(IWin32Window owner)
! {
! return DialogResult.Cancel;
! }
! // Show the dialog box and wait for the answer.
! public DialogResult ShowDialog()
! {
! return RunDialog((IWin32Window)null);
! }
public DialogResult ShowDialog(IWin32Window owner)
! {
! return RunDialog(owner);
! }
! // Emit the help request event.
! protected virtual void OnHelpRequest(EventArgs e)
! {
! if(HelpRequest != null)
! {
! HelpRequest(this, e);
! }
! }
!
! // Event that is emitted when the help button is pressed in the dialog.
! public event EventHandler HelpRequest;
!
! // Hook procedure - not used in this implementation.
! protected virtual IntPtr HookProc(IntPtr hWnd, int msg,
!
IntPtr wparam, IntPtr lparam)
! {
! return IntPtr.Zero;
! }
!
! // Owner window procedure - not used in this implementation.
! protected virtual IntPtr OwnerWndProc(IntPtr hWnd, int msg,
!
IntPtr wparam, IntPtr lparam)
! {
! return IntPtr.Zero;
! }
}; // class CommonDialog
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnetlib/System.Windows.Forms SaveFileDialog.cs, NONE, 1.1 CommonDialog.cs, 1.2, 1.3 FileDialog.cs, 1.1, 1.2 OpenFileDialog.cs, 1.1, 1.2,
Rhys Weatherley <address@hidden> <=