diff options
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs index 9f08c97267..50d4f4b082 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs @@ -152,7 +152,7 @@ namespace MonoDevelop.Components.AutoTest.Results return null; } - TreeModel ModelFromWidget (Widget widget) + protected TreeModel ModelFromWidget (Widget widget) { TreeView tv = widget as TreeView; if (tv != null) { @@ -179,25 +179,23 @@ namespace MonoDevelop.Components.AutoTest.Results } // Check if the class has the SemanticModelAttribute + var columnNumber = GetColumnNumber (column, model); + return columnNumber == -1 ? null : new GtkTreeModelResult (resultWidget, model, columnNumber) { SourceQuery = this.SourceQuery }; + } + + protected int GetColumnNumber (string column, TreeModel model) + { Type modelType = model.GetType (); SemanticModelAttribute attr = modelType.GetCustomAttribute<SemanticModelAttribute> (); - if (attr == null) { // Check if the instance has the attributes AttributeCollection attrs = TypeDescriptor.GetAttributes (model); attr = (SemanticModelAttribute)attrs [typeof(SemanticModelAttribute)]; - if (attr == null) { - return null; + return -1; } } - - int columnNumber = Array.IndexOf (attr.ColumnNames, column); - if (columnNumber == -1) { - return null; - } - - return new GtkTreeModelResult (resultWidget, model, columnNumber) { SourceQuery = this.SourceQuery }; + return Array.IndexOf (attr.ColumnNames, column); } public override AppResult Property (string propertyName, object value) @@ -296,7 +294,7 @@ namespace MonoDevelop.Components.AutoTest.Results } } - void RealTypeKey (Gdk.Key key, Gdk.ModifierType state) + internal void RealTypeKey (Gdk.Key key, Gdk.ModifierType state) { SendKeyEvent (resultWidget, (uint)key, state, Gdk.EventType.KeyPress, null); SendKeyEvent (resultWidget, (uint)key, state, Gdk.EventType.KeyRelease, null); @@ -400,6 +398,12 @@ namespace MonoDevelop.Components.AutoTest.Results case "TAB": return Gdk.Key.Tab; + case "BKSP": + return Gdk.Key.BackSpace; + + case "DELETE": + return Gdk.Key.Delete; + default: throw new Exception ("Unknown keystring: " + keyString); } @@ -442,12 +446,13 @@ namespace MonoDevelop.Components.AutoTest.Results return; } - Cairo.Context cr = Gdk.CairoHelper.Create (resultWidget.GdkWindow); - cr.SetSourceRGB (1.0, 0.0, 0.0); + using (var cr = Gdk.CairoHelper.Create (resultWidget.GdkWindow)) { + cr.SetSourceRGB (1.0, 0.0, 0.0); - Gdk.Rectangle allocation = resultWidget.Allocation; - Gdk.CairoHelper.Rectangle (cr, allocation); - cr.Stroke (); + Gdk.Rectangle allocation = resultWidget.Allocation; + Gdk.CairoHelper.Rectangle (cr, allocation); + cr.Stroke (); + } } public override void Flash () |