Moved element core to new package
This commit is contained in:
		
							parent
							
								
									bbdc5a0162
								
							
						
					
					
						commit
						34848f616b
					
				| @ -4,10 +4,11 @@ import "image" | |||||||
| import "git.tebibyte.media/sashakoshka/tomo" | import "git.tebibyte.media/sashakoshka/tomo" | ||||||
| import "git.tebibyte.media/sashakoshka/tomo/theme" | import "git.tebibyte.media/sashakoshka/tomo/theme" | ||||||
| import "git.tebibyte.media/sashakoshka/tomo/artist" | import "git.tebibyte.media/sashakoshka/tomo/artist" | ||||||
|  | import "git.tebibyte.media/sashakoshka/tomo/elements/core" | ||||||
| 
 | 
 | ||||||
| type Button struct { | type Button struct { | ||||||
| 	*Core | 	*core.Core | ||||||
| 	core CoreControl | 	core core.CoreControl | ||||||
| 	 | 	 | ||||||
| 	pressed  bool | 	pressed  bool | ||||||
| 	enabled  bool | 	enabled  bool | ||||||
| @ -20,7 +21,7 @@ type Button struct { | |||||||
| 
 | 
 | ||||||
| func NewButton (text string) (element *Button) { | func NewButton (text string) (element *Button) { | ||||||
| 	element = &Button { enabled: true } | 	element = &Button { enabled: true } | ||||||
| 	element.Core, element.core = NewCore(element) | 	element.Core, element.core = core.NewCore(element) | ||||||
| 	element.drawer.SetFace(theme.FontFaceRegular()) | 	element.drawer.SetFace(theme.FontFaceRegular()) | ||||||
| 	element.SetText(text) | 	element.SetText(text) | ||||||
| 	return | 	return | ||||||
|  | |||||||
| @ -4,10 +4,11 @@ import "image" | |||||||
| import "git.tebibyte.media/sashakoshka/tomo" | import "git.tebibyte.media/sashakoshka/tomo" | ||||||
| import "git.tebibyte.media/sashakoshka/tomo/theme" | import "git.tebibyte.media/sashakoshka/tomo/theme" | ||||||
| import "git.tebibyte.media/sashakoshka/tomo/artist" | import "git.tebibyte.media/sashakoshka/tomo/artist" | ||||||
|  | import "git.tebibyte.media/sashakoshka/tomo/elements/core" | ||||||
| 
 | 
 | ||||||
| type Label struct { | type Label struct { | ||||||
| 	*Core | 	*core.Core | ||||||
| 	core CoreControl | 	core core.CoreControl | ||||||
| 	 | 	 | ||||||
| 	text   string | 	text   string | ||||||
| 	drawer artist.TextDrawer | 	drawer artist.TextDrawer | ||||||
| @ -15,7 +16,7 @@ type Label struct { | |||||||
| 
 | 
 | ||||||
| func NewLabel (text string) (element *Label) { | func NewLabel (text string) (element *Label) { | ||||||
| 	element = &Label {  } | 	element = &Label {  } | ||||||
| 	element.Core, element.core = NewCore(element) | 	element.Core, element.core = core.NewCore(element) | ||||||
| 	face := theme.FontFaceRegular() | 	face := theme.FontFaceRegular() | ||||||
| 	element.drawer.SetFace(face) | 	element.drawer.SetFace(face) | ||||||
| 	element.SetText(text) | 	element.SetText(text) | ||||||
|  | |||||||
| @ -4,17 +4,18 @@ import "image" | |||||||
| import "image/color" | import "image/color" | ||||||
| import "git.tebibyte.media/sashakoshka/tomo" | import "git.tebibyte.media/sashakoshka/tomo" | ||||||
| import "git.tebibyte.media/sashakoshka/tomo/artist" | import "git.tebibyte.media/sashakoshka/tomo/artist" | ||||||
|  | import "git.tebibyte.media/sashakoshka/tomo/elements/core" | ||||||
| 
 | 
 | ||||||
| // Test is a simple element that can be used as a placeholder. | // Test is a simple element that can be used as a placeholder. | ||||||
| type Test struct { | type Test struct { | ||||||
| 	*Core | 	*core.Core | ||||||
| 	core CoreControl | 	core core.CoreControl | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // NewTest creates a new test element. | // NewTest creates a new test element. | ||||||
| func NewTest () (element *Test) { | func NewTest () (element *Test) { | ||||||
| 	element = &Test { } | 	element = &Test { } | ||||||
| 	element.Core, element.core = NewCore(element) | 	element.Core, element.core = core.NewCore(element) | ||||||
| 	element.core.SetMinimumSize(32, 32) | 	element.core.SetMinimumSize(32, 32) | ||||||
| 	return | 	return | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| package basic | package core | ||||||
| 
 | 
 | ||||||
| import "image" | import "image" | ||||||
| import "image/color" | import "image/color" | ||||||
| @ -2,6 +2,7 @@ package layouts | |||||||
| 
 | 
 | ||||||
| import "git.tebibyte.media/sashakoshka/tomo" | import "git.tebibyte.media/sashakoshka/tomo" | ||||||
| import "git.tebibyte.media/sashakoshka/tomo/artist" | import "git.tebibyte.media/sashakoshka/tomo/artist" | ||||||
|  | import "git.tebibyte.media/sashakoshka/tomo/elements/core" | ||||||
| 
 | 
 | ||||||
| // Vertical lays its children out vertically. It can contain any number of | // Vertical lays its children out vertically. It can contain any number of | ||||||
| // children. When an child is added to the layout, it can either be set to | // children. When an child is added to the layout, it can either be set to | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user