2
* DefaultPropertyTab.cs - The default PropertyTab
4
* Part of PropertyGrid - A Gtk# widget that displays and allows
5
* editing of all of an object's public properties
8
* Michael Hutchinson <m.j.hutchinson@gmail.com>
10
* Copyright (C) 2005 Michael Hutchinson
12
* This sourcecode is licenced under The MIT License:
14
* Permission is hereby granted, free of charge, to any person obtaining
15
* a copy of this software and associated documentation files (the
16
* "Software"), to deal in the Software without restriction, including
17
* without limitation the rights to use, copy, modify, merge, publish,
18
* distribute, sublicense, and/or sell copies of the Software, and to permit
19
* persons to whom the Software is furnished to do so, subject to the
20
* following conditions:
22
* The above copyright notice and this permission notice shall be included in
23
* all copies or substantial portions of the Software.
25
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
28
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
29
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
30
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
31
* USE OR OTHER DEALINGS IN THE SOFTWARE.
36
using System.ComponentModel;
37
using MonoDevelop.Core;
39
namespace MonoDevelop.Components.PropertyGrid
41
public class DefaultPropertyTab : PropertyTab
43
public DefaultPropertyTab ()
48
public override string TabName {
49
get {return GettextCatalog.GetString ("Properties"); }
52
public override bool CanExtend (object extendee)
57
public override PropertyDescriptor GetDefaultProperty (object component)
59
if (component == null)
61
return TypeDescriptor.GetDefaultProperty (component);
64
public override PropertyDescriptorCollection GetProperties (object component, Attribute[] attributes)
66
if (component == null)
67
return new PropertyDescriptorCollection (new PropertyDescriptor[] {});
68
return TypeDescriptor.GetProperties (component);
72
public abstract class PropertyTab
74
public abstract string TabName { get; }
75
public abstract bool CanExtend (object extendee);
76
public abstract PropertyDescriptor GetDefaultProperty (object component);
77
public abstract PropertyDescriptorCollection GetProperties (object component, Attribute[] attributes);
79
public PropertyDescriptorCollection GetProperties (object component)
81
return GetProperties (component, null);
84
public Gdk.Pixbuf GetIcon ()
86
using (var stream = GetType ().Assembly.GetManifestResourceStream (GetType ().FullName + ".bmp")) {
89
return new Gdk.Pixbuf (stream);
90
} catch (Exception e) {
91
LoggingService.LogError ("Can't create pixbuf from resource:" + GetType ().FullName + ".bmp", e);