Added a little clipboard interface
This commit is contained in:
		
							parent
							
								
									93019b1b38
								
							
						
					
					
						commit
						14adaa4552
					
				@ -20,6 +20,13 @@ type Backend interface {
 | 
			
		||||
	// and returns a struct representing it that fulfills the Window
 | 
			
		||||
	// interface.
 | 
			
		||||
	NewWindow (width, height int) (window Window, err error)
 | 
			
		||||
 | 
			
		||||
	// Copy puts data in the clipboard.
 | 
			
		||||
	Copy (data Data)
 | 
			
		||||
 | 
			
		||||
	// Paste returns the data currently in the clipboard. This method may
 | 
			
		||||
	// return nil.
 | 
			
		||||
	Paste () (data Data)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// BackendFactory represents a function capable of constructing a backend
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										25
									
								
								data.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								data.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,25 @@
 | 
			
		||||
package tomo
 | 
			
		||||
 | 
			
		||||
import "io"
 | 
			
		||||
 | 
			
		||||
// Data represents drag-and-drop, selection, or clipboard data.
 | 
			
		||||
type Data interface {
 | 
			
		||||
	io.Reader
 | 
			
		||||
 | 
			
		||||
	// Mime returns the MIME type of the data, such as text/plain,
 | 
			
		||||
	// text/html, image/png, etc.
 | 
			
		||||
	Mime () (mimeType Mime)
 | 
			
		||||
 | 
			
		||||
	// Convert attempts to convert the data to another MIME type. If the
 | 
			
		||||
	// data could not be converted, it should return an error.
 | 
			
		||||
	Convert (to Mime) (converted Data, err error)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Mime represents a MIME type.
 | 
			
		||||
type Mime struct {
 | 
			
		||||
	// Type is the first half of the MIME type, and Subtype is the second
 | 
			
		||||
	// half. The separating slash is not included in either. For example,
 | 
			
		||||
	// text/html becomes:
 | 
			
		||||
	// Mime { Type: "text", Subtype: "html" }
 | 
			
		||||
	Type, Subtype string
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user