Files
mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CommonDialog.cs
T
Peter Dennis Bartok 161defc9bc 2006-01-12 Peter Dennis Bartok <[email protected]
* XplatUI.cs:
	  - Added more granular debug options
	  - Added method to print both window text and id
	  - Switched debug output to use new Window() debug method
	  - Added IsEnabled() driver method
	  - Added EnableWindow() driver method
	* Form.cs:
	  - Removed end_modal; no longer needed, new loop handles termination
	    via 'closing' variable
	  - If form is modal, setting DialogResult will now initiate loop
	    termination via 'closing' variable
	  - Added support for is_enabled/WS_DISABLED to CreateParams
	  - Close() now just send the WM_CLOSE message; the WM_CLOSE handler
	    does all the work
	  - Removed code that's now in RunLoop from ShowDialog()
	  - Added various documented sanity checks to ShowDialog()
	  - Added handling of WM_DESTROY message; we set 'closing' on getting
	    the message to indicate the message pump to terminate
	  - Added handling of new internal WM_CLOSE_INTERNAL message - it's
	    send by the Application.ExitThread method. (We send the message
	    to destroy the window after all other events have been
	    processed through the queue, instead of destroying the handle 
	    directly)
	  - Moved code from Close() method to WM_CLOSE handler; added logic
	    to only send close-related events if the form is not displayed
	    modal
	* Splitter.cs (..ctor): Fixed typo in resource name
	* Control.cs:
	  - DrawBackgroundImage: Explicitly selecting the wrap mode for the
	    brush now
	  - set_Cursor: Now only setting calling into XplatUI if the handle for
	    the control is already created; this avoids implict handle creation
	    or crashes if it's not created
	  - set_Enabled: Now setting the enabled state via the new driver method
	    instead of just tracking it
	  - CreateParams: Added logic to set WS_DISABLED based on enabled state
	  - CreateControl: Reordered event firing and method calls to more
	    closely fire events in the order MS does. Now setting the
	    enabled state in the driver when creating the control.
	  - SetVisibleCore: Moved when the OnVisibleChanged event is fired to
	    match MS order
	* FolderBrowserDialog.cs, MessageBox.cs, ButtonBase.cs, TrackBar.cs,
	  MonthCalendar.cs: get_CreateParams: Added setting of WS_DISABLED 
	* XplatUIStructs.cs: Added internal WM_CLOSE_INTERNAL mesage id
	* Hwnd.cs:
	  - Added tracking of window enabled state (get_Enabled/set_Enabled)
	  - Added EnabledHwnd property to easily allow a driver to find the
	    handle of the first enabled window in the parent chain (this is
	    used by drivers to pass up input events of disabled windows)
	* XplatUIDriver.cs: Added IsEnabled() method
	* Application.cs:
	  - Removed crude and obsolete exiting tracking variable
	  - Removed internal ModalRun(); replaced by RunLoop()
	  - Implemented private CloseForms() method to allow closing all 
	    windows owned by a particular (or all) threads
	  - Exit() now properly closes all windows without forcing the message
	    pump to quit
	  - Removed obsolete InternalExit() method
	  - Changed Run() methods to use new RunLoop() message pump
	  - Implemented new RunLoop() method for both modal and non-modal forms
	* CommonDialog.cs:
	  - get_CreateParams: Added setting of WS_DISABLED
	  - Simplified ShowDialog(); now all the work is done in RunLoop(),
	    invoked via Form.ShowDialog()
	* NativeWindow.cs: We don't remove the window from the collection when
	  the handle is destroyed; there might still be messages for it in the
	  queue (mainly the resulting WM_DESTROY); instead it will be removed
	  when Control calls InvalidateHandle in the WM_DESTROY handler
	* XplatUIX11.cs:
	  - CreateWindow: Added logic to handle the WS_DISABLED window style
	  - EnableWindow: Implemented based on Hwnd.Enabled
	  - GetMessage: Reset PostQuitState so the method can be called again
	  - Implemented support for disabled windows (passing messages to the
	    first enabled parent) in handling all input messages
	  - Added optimizations for handling Expose events
	  - Implemeted new driver method IsEnabled()
	  - Now always resetting paint pending tracking vars when we start paint
	  - Re-implemented UpdateWindow via just sending a WM_PAINT message
	* XplatUIOSX.cs: Added IsEnabled method stub
	* XplatUIWin32.cs: Implemented new IsEnabled() method


svn path=/trunk/mcs/; revision=55421
2006-01-12 07:19:58 +00:00

143 lines
3.9 KiB
C#

// 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) 2004-2006 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Peter Bartok ([email protected])
//
//
// NOT COMPLETE
using System.ComponentModel;
namespace System.Windows.Forms {
[ToolboxItemFilter("System.Windows.Forms")]
public abstract class CommonDialog : System.ComponentModel.Component {
#region DialogForm
internal class DialogForm : Form {
#region DialogForm Local Variables
protected CommonDialog owner;
#endregion DialogForm Local Variables
#region DialogForm Constructors
internal DialogForm(CommonDialog owner) {
this.owner = owner;
}
#endregion DialogForm Constructors
#region Protected Instance Properties
protected override CreateParams CreateParams {
get {
CreateParams cp;
ControlBox = true;
MinimizeBox = false;
MaximizeBox = false;
cp = base.CreateParams;
cp.Style = (int)(WindowStyles.WS_POPUP | WindowStyles.WS_CAPTION | WindowStyles.WS_SYSMENU | WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_CLIPSIBLINGS);
if (!is_enabled) {
cp.Style |= (int)(WindowStyles.WS_DISABLED);
}
return cp;
}
}
#endregion // Protected Instance Properties
#region Internal Methods
internal DialogResult RunDialog () {
this.StartPosition = FormStartPosition.CenterScreen;
owner.InitFormsSize (this);
this.ShowDialog ();
return this.DialogResult;
}
#endregion Internal Methods
}
#endregion DialogForm
#region Local Variables
internal DialogForm form;
#endregion Local Variables
#region Public Constructors
public CommonDialog() {
form = new DialogForm(this);
}
#endregion Public Constructors
#region Internal Methods
internal virtual void InitFormsSize(Form form) {
// Override this to set a default size for the form
form.Width = 200;
form.Height = 200;
}
#endregion Internal Methods
#region Public Instance Methods
public abstract void Reset();
public DialogResult ShowDialog() {
return ShowDialog(null);
}
public DialogResult ShowDialog(IWin32Window ownerWin32) {
DialogResult result;
// Prep the dialog
RunDialog(form.Handle);
// Run
result = form.ShowDialog(ownerWin32);
return form.DialogResult;
}
#endregion // Public Instance Methods
#region Protected Instance Methods
protected virtual IntPtr HookProc(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam) {
return IntPtr.Zero;
}
protected virtual void OnHelpRequest(EventArgs e) {
if (HelpRequest != null) {
HelpRequest(this, e);
}
}
protected virtual IntPtr OwnerWndProc(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam) {
return IntPtr.Zero;
}
protected abstract bool RunDialog(IntPtr hwndOwner);
#endregion // Protected Instance Methods
#region Events
public event EventHandler HelpRequest;
#endregion // Events
}
}