mirror of
				https://github.com/chibicitiberiu/rainmeter-studio.git
				synced 2024-02-24 04:33:31 +00:00 
			
		
		
		
	Added ToolboxItem class and dummy view model
This commit is contained in:
		@@ -2,14 +2,29 @@
 | 
				
			|||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
using System.Text;
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Windows;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace RainmeterStudio.Core.Editor.Features
 | 
					namespace RainmeterStudio.Core.Editor.Features
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// Editor provides toolbox items
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
    public interface IToolboxProvider
 | 
					    public interface IToolboxProvider
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        bool SupportsToolboxDrop { get; }
 | 
					        /// <summary>
 | 
				
			||||||
        IEnumerable<string> ToolboxItems { get; }
 | 
					        /// Gets a list of toolbox items
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        IEnumerable<ToolboxItem> ToolboxItems { get; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Triggered if the toolbox items change
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
        event EventHandler ToolboxItemsChanged;
 | 
					        event EventHandler ToolboxItemsChanged;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Called when a toolbar item is dropped by double-click
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="item">Toolbox item dropped</param>
 | 
				
			||||||
 | 
					        void ToolboxItemDrop(ToolboxItem item);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										18
									
								
								RainmeterStudio.Core/Editor/Features/ToolboxItem.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								RainmeterStudio.Core/Editor/Features/ToolboxItem.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace RainmeterStudio.Core.Editor.Features
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class ToolboxItem
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public string Name { get; private set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public ToolboxItem(string name)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Name = name;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										60
									
								
								RainmeterStudio/UI/ViewModel/ToolboxItemViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								RainmeterStudio/UI/ViewModel/ToolboxItemViewModel.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
				
			|||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using System.Windows.Media;
 | 
				
			||||||
 | 
					using RainmeterStudio.Core.Editor.Features;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace RainmeterStudio.UI.ViewModel
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class ToolboxItemViewModel
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets the toolbox item
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        public ToolboxItem Item { get; private set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets the display text of the toolbox item
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        public string DisplayText
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return Item.Name;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets the tooltip text of the toolbox item
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        public string ToolTip
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return "Placeholder tooltip for " + Item.Name;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets the icon
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        public ImageSource Icon
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return null;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Initializes the toolbox item view model
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="item"></param>
 | 
				
			||||||
 | 
					        public ToolboxItemViewModel(ToolboxItem item)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Item = item;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user