Exemplo n.º 1
0
		internal Component (Application app, object backend, string name, ComponentType type)
		{
			this.app = app;
			this.backend = backend;
			this.name = name;
			this.type = type;
		}
		public static List<ComponentType> GetComponentTypes (Application app, string filename)
		{
			List<ComponentType> list = new List<ComponentType> ();

			LibraryCache.LibraryInfo info = cache.Refresh (new AssemblyResolver (app.Backend), filename);
			if (info.ObjectsDocument == null)
				return list;

			string defTargetGtkVersion = info.ObjectsDocument.DocumentElement.GetAttribute ("gtk-version");
			if (defTargetGtkVersion.Length == 0)
				defTargetGtkVersion = "2.4";
			
			AssemblyDefinition adef = AssemblyFactory.GetAssembly (filename);
			
			foreach (XmlElement elem in info.ObjectsDocument.SelectNodes ("objects/object")) {
				if (elem.GetAttribute ("internal") == "true" || elem.HasAttribute ("deprecated") || !elem.HasAttribute ("palette-category"))
					continue;
					
				string iconname = elem.GetAttribute ("icon");
				Gdk.Pixbuf icon = GetEmbeddedIcon (adef, iconname);
				
				string targetGtkVersion = elem.GetAttribute ("gtk-version");
				if (targetGtkVersion.Length == 0)
					targetGtkVersion = defTargetGtkVersion;
				
				ComponentType ct = new ComponentType (app,
					elem.GetAttribute ("type"),
					elem.GetAttribute ("label"), 
					elem.GetAttribute ("type"),
					elem.GetAttribute ("palette-category"), 
					targetGtkVersion,
					filename,
					icon);
					
				list.Add (ct);
			}
			
			return list;
		}
Exemplo n.º 3
0
		public WidgetInfo AddNewComponent (ComponentType type, string name)
		{
			object ob = ProjectBackend.AddNewWidget (type.Name, name);
			WidgetComponent wc = (WidgetComponent) App.GetComponent (ob, null, null);
			WidgetInfo wi = GetWidget (wc.Name);
			if (wi == null) {
				wi = new WidgetInfo (this, wc);
				widgets.Add (wi);
			} 
			return wi;
		}
Exemplo n.º 4
0
		internal ComponentType GetComponentType (string typeName)
		{
			lock (types) {
				ComponentType t = (ComponentType) types [typeName];
				if (t != null) return t;
				
				if (typeName == "Gtk.Action" || typeName == "Gtk.ActionGroup") {
					t = new ComponentType (this, typeName, "", typeName, "Actions", "2.4", null, ComponentType.Unknown.Icon);
					types [typeName] = t;
					return t;
				}
				
				t = CreateComponentType (typeName);
				types [typeName] = t;
				return t;
			}
		}
Exemplo n.º 5
0
		public void BeginComponentDrag (ComponentType type, Gtk.Widget source, Gdk.DragContext ctx)
		{
			Stetic.ObjectWrapper wrapper = type.Action != null ? (Stetic.ObjectWrapper) type.Action.Backend : null;
			app.Backend.BeginComponentDrag (editedProject.ProjectBackend, type.Description, type.ClassName, wrapper, source, ctx, null);
		}
Exemplo n.º 6
0
		public ComponentToolboxNode (ComponentType type)
		{
			if (type.Description.Length > 0)
				Name = type.Description;
			else {
				int i = type.Name.LastIndexOf ('.');
				if (i == -1)
					Name = type.Name;
				else
					Name = type.Name.Substring (i+1);
			}
			
			componentType = type;
			className = type.ClassName;
			Category = GetCategoryName (type.Category);
			Icon = type.Icon;
			gtkVersion = type.TargetGtkVersion;
		}
Exemplo n.º 7
0
		public WidgetComponent (Application app, object backend, string name, ComponentType type): base (app, backend, name, type)
		{
		}