Files
mono/mcs/class/System.Windows.Forms/Gtk/SWFGtkConv.cs
T
Joel Basson 802417f479 Thu Jan 16 19:20:00 GMT+2 2003 Joel Basson <[email protected]>
* Applied patch from Alberto Fernandez with the following changes...
	Finished ProgressBar (Events?)
	Finished HScrollBar VScrollBar and ScrollBar
	Finished FolderBrowserDialog
	Base ComboBox
	Added DrawMode.cs
	Added ComboBoxStyle.cs
	Added Appearance.cs
	Added CheckState.cs
	Added TabAlignment
	Added TabAppearance.cs
	Added TabDrawMode.cs
	Added TabSizeMode.cs
	Added Panel.cs
	Added TabPage.cs
	Added TabControl.cs
	Added Cursors.cs
	Added MessageBoxDefaultButton.cs
	Added MessageBoxIcon.cs
	Added MessageBoxOptions.cs
	Changes in MessageBoxButtons.cs (Added values)
	Changes in MessageBox (Completed all functions, added return values).
	"Finished" CheckBox.cs
	"Finished" ComboBox.cs
	"Finished" RadioButton
	"Finished" GroupBox
	"Finished" Panel
	Changes in Form to work with new RadioButton.
	Fix double Click reported on MenuItems.
	"Finished" Application

svn path=/trunk/mcs/; revision=22123
2004-01-15 17:19:30 +00:00

88 lines
1.8 KiB
C#

namespace System.Windows.Forms{
using Pango;
using System.Drawing;
internal class SWFGtkConv{
private SWFGtkConv(){}
public static MouseEventArgs MouseUpDownArgs (Gdk.EventButton ev){
uint boton = ev.button;
MouseButtons btn;
switch (boton){
case 1: btn = MouseButtons.Left;
break;
case 2: btn = MouseButtons.Middle;
break;
case 3: btn = MouseButtons.Right;
break;
//FIXME : Does it work? I've a typical wheelmouse.
case 4: btn = MouseButtons.XButton1;
break;
case 5: btn = MouseButtons.XButton2;
break;
default:
btn = MouseButtons.None;
break;
}
int clicks = 0;
switch (ev.type){
case Gdk.EventType.ButtonRelease:
case Gdk.EventType.ButtonPress: clicks = 1;
break;
case Gdk.EventType.TwoButtonPress:
case Gdk.EventType.ThreeButtonPress: clicks = 2;
break;
default:
clicks = 1;
break;
}
MouseEventArgs ret = new MouseEventArgs
(btn, clicks, (int)ev.x, (int)ev.y, 0);
return ret;
}
// TODO: && is a literal &
public static string AccelString (string st){
//return st.Replace("_", "__").Replace ("&", "_");
String s = st.Replace ("_", "__");
String ret = "";
int i=0;
while (i < s.Length){
if (s[i] == '&'){
if ((i < (s.Length -1)) && (s[i+1] == '&')){
i+=2;
ret +="&";
}
else{
i++;
ret += "_";
}
}
else{
ret += s[i++];
}
}
return ret;
}
// Font not implemented.
[MonoTODO]
public static Pango.FontDescription Font (System.Drawing.Font f){
FontDescription ret = new FontDescription();
//ret.Weight = (f.Bold) ? Pango.Weight.Bold : Pango.Weight.Normal;
//ret.Family = f.FontFamily.Name;
//ret.Style = (f.Italic) ? Pango.Style.Italic : Pango.Style.Normal;
return ret;
}
}
}