Files
mono/mcs/class/System.Windows.Forms/Gtk/Button.cs
T
Joel Basson d6a820caf1 Tue Dec 16 12:15:00 GMT+2 2003 Joel Basson <[email protected]>
* Applied patch from Alberto Fernandez with the following changes...
	* Added Shorcut to MenuItem.
	* Changed demo.cs to work with new FileDialog.
	* Created dialogs (Basic funcionality).
	* Added new:
		Timer.cs (?)
	* Removed function ControlLocationChanged
		(the code has been moved to Control.OnLocationChanged, and now works from
		child Control, instead from parent.)
	* MenuItem
	* Menu
	* ContextMenu
	* MainMenu
	* Fixed Control.Size bug
	* New Samples:
		ButtonEvents2.cs
		ChangeParentDemo.cs (works with Gtk-Warnings)
		LabelClickDemo.cs (doesn't work for now)
		Menu.cs
	* Added new:
		CommonDialog.cs
		OpenFileDialog.cs
		SaveFileDialog.cs
		FolderBrowserDialog.cs
		PageSetupDialog.cs
		PrintDialog.cs
	* Changed:
		FileDialog.cs (now Inherits from CommonDialog, and is an abstract class).
	* Control.Parent works now.
	* Added - copied from current System.Windows.Forms (wine based):

		ApplicationContext.cs
		BindingContext.cs
		BoundsSpecified.cs
		ComVisible.cs
		ControlBindingsCollection.cs
		ControlStyles.cs
		CreateParams.cs
		DragAction.cs
		DragDropEffects.cs
		DragEventArgs.cs
		DragEventHandler.cs
		DrawItemEventHandler.cs
		FlatStyle.cs
		FormBorderStyle.cs
		FormStartPosition.cs
		FormWindowState.cs
		GiveFeedbackEventArgs.cs
		GiveFeedbackEventHandler.cs
		HelpEventArgs.cs
		HelpEventHandler.cs
		IDataObject.cs
		ImageList.cs
		ImeMode.cs
		IMessageFilter.cs
		IWin32Window.cs
		InputLanguageChangedEventArgs.cs
		InputLanguageChangedEventHandler.cs
		InputLanguageChangingEventArgs.cs
		InputLanguageChangingEventHandler.cs
		InputLanguageCollection.cs
		InputLanguage.cs
		InvalidateEventArgs.cs
		InvalidateEventHandler.cs
		LayoutEventHandler.cs
		LeftRightAlignment.cs
		MdiLayout.cs
		MeasureItemEventArgs.cs
		MeasureItemEventHandler.cs
		MenuMerge.cs
		Message.cs
		MouseEventHandler.cs
		QueryAccessibilityHelpEventArgs.cs
		QueryAccessibilityHelpEventHandler.cs
		QueryContinueDragEventArgs.cs
		QueryContinueDragEventHandler.cs
		SizeGripStyle.cs
		UICues.cs
		UICuesEventArgs.cs
		UICuesEventHandler.cs

	* Added (new, incomplete):
		Cursor.cs
		Menu.cs
		ContextMenu.cs

	* Changed (to be compatible, now have empty methods):
		MainMenu.cs
		MenuItem.cs

	* Added (provides static conversion methods):
		SWFGtkConv.cs
	* Work on:
		Control.cs - Completed stub, connected some events.
		Forms.cs - Completed stub.
		Button.cs - Some methos overriden, some property changes have
		to be aplied to the contained Gtk.Label (instead to the Gtk.Button)

	* Others minor changes...

svn path=/trunk/mcs/; revision=21206
2003-12-15 23:20:41 +00:00

101 lines
2.3 KiB
C#

//
// System.Windows.Forms.Button.cs
//
// Author:
// stubbed out by Jaak Simm ([email protected])
// implemented for Gtk+ by Rachel Hestilow ([email protected])
//
// (C) Ximian, Inc., 2002
//
namespace System.Windows.Forms
{
using System.Drawing;
/// <summary>
/// Represents a Windows button control.
/// </summary>
public class Button : ButtonBase, IButtonControl{
// private fields
DialogResult dialogResult;
// --- Constructor ---
public Button() : base(){
dialogResult = DialogResult.None;
SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
//this.
}
// --- IButtonControl property ---
public virtual DialogResult DialogResult {
get { return dialogResult; }
set {
if ( !Enum.IsDefined ( typeof(DialogResult), value ) )
throw new System.ComponentModel.InvalidEnumArgumentException( "DialogResult",
(int)value,
typeof(DialogResult));
dialogResult = value;
}
}
// --- IButtonControl method ---
public virtual void NotifyDefault(bool value){
}
public void PerformClick(){
EventArgs e = new EventArgs();
OnClick(e);
}
// --- Button methods for events ---
protected override void OnClick(EventArgs e) {
/*if ( DialogResult != DialogResult.None ) {
Form parent = Parent as Form;
if ( parent != null )
parent.DialogResult = this.DialogResult;
}
base.OnClick (e);*/
base.OnClick (e);
}
/*protected override void OnMouseUp(MouseEventArgs mevent){
base.OnMouseUp (mevent);
}*/
// --- Button methods ---
/*protected override bool ProcessMnemonic (char charCode) {
return base.ProcessMnemonic (charCode);
}*/
//[MonoTODO]
//public override string ToString (){
// return base.ToString();
//}
//protected override void WndProc (ref Message m) {
// base.WndProc (ref m);
//}
internal override Gtk.Widget CreateWidget () {
Gtk.Button button = new Gtk.Button ();
button.Add (label.Widget);
return button;
}
internal override void ConnectEvents(){
base.ConnectEvents();
Gtk.Button btn = (Gtk.Button) Widget;
btn.Clicked += new EventHandler (GtkButtonClicked);
}
internal void GtkButtonClicked(object sender, EventArgs args){
OnClick (args);
}
}
}