Exporting the damn thing
This commit is contained in:
parent
20d8a06508
commit
0de42ad991
|
@ -12,9 +12,9 @@ import (
|
|||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
var _ fyne.Focusable = (*profileBtn)(nil)
|
||||
var _ fyne.Focusable = (*ProfileBtn)(nil)
|
||||
|
||||
type profileBtn struct {
|
||||
type ProfileBtn struct {
|
||||
widget.DisableableWidget
|
||||
|
||||
OutlineWidth int
|
||||
|
@ -28,37 +28,37 @@ type profileBtn struct {
|
|||
}
|
||||
|
||||
// FocusGained is a hook called by the focus handling logic after this object gained the focus.
|
||||
func (b *profileBtn) FocusGained() {
|
||||
func (b *ProfileBtn) FocusGained() {
|
||||
// b.focused = true
|
||||
b.Refresh()
|
||||
}
|
||||
|
||||
// FocusLost is a hook called by the focus handling logic after this object lost the focus.
|
||||
func (b *profileBtn) FocusLost() {
|
||||
func (b *ProfileBtn) FocusLost() {
|
||||
// b.focused = false
|
||||
b.Refresh()
|
||||
}
|
||||
|
||||
// TypedRune is a hook called by the input handling logic on text input events if this object is focused.
|
||||
func (b *profileBtn) TypedRune(rune) {
|
||||
func (b *ProfileBtn) TypedRune(rune) {
|
||||
}
|
||||
|
||||
// TypedKey is a hook called by the input handling logic on key events if this object is focused.
|
||||
func (b *profileBtn) TypedKey(ev *fyne.KeyEvent) {
|
||||
func (b *ProfileBtn) TypedKey(ev *fyne.KeyEvent) {
|
||||
if ev.Name == fyne.KeySpace {
|
||||
b.Tapped(nil)
|
||||
}
|
||||
}
|
||||
|
||||
func (b *profileBtn) Resize(s fyne.Size) {
|
||||
func (b *ProfileBtn) Resize(s fyne.Size) {
|
||||
b.BaseWidget.Resize(s)
|
||||
}
|
||||
|
||||
func (b *profileBtn) Disabled() bool {
|
||||
func (b *ProfileBtn) Disabled() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (b *profileBtn) Tapped(*fyne.PointEvent) {
|
||||
func (b *ProfileBtn) Tapped(*fyne.PointEvent) {
|
||||
if b.Disabled() {
|
||||
return
|
||||
}
|
||||
|
@ -71,11 +71,11 @@ func (b *profileBtn) Tapped(*fyne.PointEvent) {
|
|||
}
|
||||
}
|
||||
|
||||
func (b *profileBtn) CreateRenderer() fyne.WidgetRenderer {
|
||||
func (b *ProfileBtn) CreateRenderer() fyne.WidgetRenderer {
|
||||
return NewProfileBtnRenderer(b)
|
||||
}
|
||||
|
||||
func NewProfileBtnRenderer(b *profileBtn) *profileBtnRenderer {
|
||||
func NewProfileBtnRenderer(b *ProfileBtn) *profileBtnRenderer {
|
||||
r := &profileBtnRenderer{
|
||||
canvas.NewRasterFromImage(image.NewRGBA(image.Rect(0, 0, 10, 10))),
|
||||
b,
|
||||
|
@ -84,8 +84,8 @@ func NewProfileBtnRenderer(b *profileBtn) *profileBtnRenderer {
|
|||
return r
|
||||
}
|
||||
|
||||
func NewProfileBtn() *profileBtn {
|
||||
w := &profileBtn{}
|
||||
func NewProfileBtn() *ProfileBtn {
|
||||
w := &ProfileBtn{}
|
||||
w.ExtendBaseWidget(w)
|
||||
w.OutlineWidth = 0
|
||||
w.OutlineColor = color.White
|
||||
|
@ -94,7 +94,7 @@ func NewProfileBtn() *profileBtn {
|
|||
return w
|
||||
}
|
||||
|
||||
func (b *profileBtn) SetProfileResource(r fyne.Resource) {
|
||||
func (b *ProfileBtn) SetProfileResource(r fyne.Resource) {
|
||||
if r != nil {
|
||||
i, _, err := image.Decode(bytes.NewReader(r.Content()))
|
||||
if err == nil {
|
||||
|
@ -107,7 +107,7 @@ func (b *profileBtn) SetProfileResource(r fyne.Resource) {
|
|||
|
||||
}
|
||||
|
||||
func (b *profileBtn) SetMinSize(s fyne.Size) {
|
||||
func (b *ProfileBtn) SetMinSize(s fyne.Size) {
|
||||
if s.Height > 0 && s.Width > 0 {
|
||||
b.minSizeRequested = s
|
||||
b.minSizeOverridden = true
|
||||
|
@ -116,13 +116,13 @@ func (b *profileBtn) SetMinSize(s fyne.Size) {
|
|||
b.minSizeOverridden = false
|
||||
}
|
||||
|
||||
func (b *profileBtn) SetProfileImage(i image.Image) {
|
||||
func (b *ProfileBtn) SetProfileImage(i image.Image) {
|
||||
b.profileImage = i
|
||||
}
|
||||
|
||||
type profileBtnRenderer struct {
|
||||
rast *canvas.Raster
|
||||
w *profileBtn
|
||||
w *ProfileBtn
|
||||
}
|
||||
|
||||
func min(x, y int) int {
|
||||
|
|
Loading…
Reference in New Issue