90 lines
1.4 KiB
Go
90 lines
1.4 KiB
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"git.yetaga.in/alazyreader/library/book"
|
||
|
"github.com/gdamore/tcell"
|
||
|
)
|
||
|
|
||
|
// save change to book
|
||
|
type EventBookUpdate struct {
|
||
|
tcell.EventTime
|
||
|
book *book.Book
|
||
|
}
|
||
|
|
||
|
func NewEventBookUpdate(b *book.Book) *EventBookUpdate {
|
||
|
e := &EventBookUpdate{book: b}
|
||
|
e.SetEventNow()
|
||
|
return e
|
||
|
}
|
||
|
|
||
|
func (e *EventBookUpdate) Book() *book.Book {
|
||
|
return e.book
|
||
|
}
|
||
|
|
||
|
// open new book in display
|
||
|
type EventLoadBook struct {
|
||
|
tcell.EventTime
|
||
|
ID int
|
||
|
}
|
||
|
|
||
|
func NewEventLoadBook(id int) *EventLoadBook {
|
||
|
e := &EventLoadBook{ID: id}
|
||
|
e.SetEventNow()
|
||
|
return e
|
||
|
}
|
||
|
|
||
|
// open new book in display
|
||
|
type EventEnterBook struct {
|
||
|
tcell.EventTime
|
||
|
}
|
||
|
|
||
|
func NewEventEnterBook() *EventEnterBook {
|
||
|
e := &EventEnterBook{}
|
||
|
e.SetEventNow()
|
||
|
return e
|
||
|
}
|
||
|
|
||
|
// switch back to menu control
|
||
|
type EventExitBook struct {
|
||
|
tcell.EventTime
|
||
|
}
|
||
|
|
||
|
func NewEventExitBook() *EventExitBook {
|
||
|
e := &EventExitBook{}
|
||
|
e.SetEventNow()
|
||
|
return e
|
||
|
}
|
||
|
|
||
|
// open import window
|
||
|
type EventOpenImport struct {
|
||
|
tcell.EventTime
|
||
|
}
|
||
|
|
||
|
func NewEventOpenImport() *EventOpenImport {
|
||
|
e := &EventOpenImport{}
|
||
|
e.SetEventNow()
|
||
|
return e
|
||
|
}
|
||
|
|
||
|
// close import window
|
||
|
type EventCloseImport struct {
|
||
|
tcell.EventTime
|
||
|
}
|
||
|
|
||
|
func NewEventCloseImport() *EventCloseImport {
|
||
|
e := &EventCloseImport{}
|
||
|
e.SetEventNow()
|
||
|
return e
|
||
|
}
|
||
|
|
||
|
// quit
|
||
|
type EventQuit struct {
|
||
|
tcell.EventTime
|
||
|
}
|
||
|
|
||
|
func NewEventQuit() *EventQuit {
|
||
|
e := &EventQuit{}
|
||
|
e.SetEventNow()
|
||
|
return e
|
||
|
}
|