Files
mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormCollection.cs
T
Rolf Bjarne Kvinge d1d2a642c3 * Control.cs: Only raise OnVisibleChanged if we're not recreating the
handle.
* FormCollection.cs: Don't add a form if it's already in the
  collection.
* Form.cs: Change ShowDialog () to call ShowDialog (owner) with a null
  according to behaviour and MSDN. The ownerWin32 is the active
  window at the moment when we call ShowDialog, not the context's
  main form (the context's main form may open another form that opens
  a form with ShowDialog, the win32 owner is the second form). Add
  and remove forms to the Application.OpenForms in other places to
  better match MS behaviour. Add an IsActive property that raises
  On(de)Activated only if the active state has changed (we were
  raising OnDeactivated before OnActivated while creating forms).
* Application.cs: Refactor Enabling/Disabling of windows for modal
  dialog loops out to separate methods, and restore the thread
  context when we quit the method. Fixes #81407.

svn path=/trunk/mcs/; revision=76242
2007-04-25 10:37:01 +00:00

77 lines
1.9 KiB
C#

//
// FormCollection.cs
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Jonathan Pobst
//
// Authors:
// Jonathan Pobst ([email protected])
//
using System;
using System.Collections;
using System.Text;
namespace System.Windows.Forms
{
#if NET_2_0
public
#endif
class FormCollection : ReadOnlyCollectionBase
{
public FormCollection () : base ()
{
}
#region Public Properties
public virtual Form this[int index] {
get {
return (Form)base.InnerList[index];
}
}
public virtual Form this[string name] {
get {
foreach (Form f in base.InnerList)
if (f.Name == name)
return f;
return null;
}
}
#endregion
#region Internal Add/Remove Methods
internal void Add (Form form)
{
if (base.InnerList.Contains (form))
return;
base.InnerList.Add (form);
}
internal void Remove (Form form)
{
base.InnerList.Remove (form);
}
#endregion
}
}