ui

package
v0.0.0-...-38a9a3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2019 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SelectedMark   = "(bg:red)"
	UnSelectedMark = "(bg:blue)"
	PageSize       = 45
)

Variables

This section is empty.

Functions

func AddBgColor

func AddBgColor(msg string, color string) string

func AddSelectedBg

func AddSelectedBg(msg string) string

func AddUnSelectedBg

func AddUnSelectedBg(msg string) string

func ConvertToEmoji

func ConvertToEmoji(sentence string) string

func DelBgColor

func DelBgColor(msg string) string

func InitTalkInfo

func InitTalkInfo(w *wechat.Wechat, logger *log.Logger, groups []*Group)

func NewLayout

func NewLayout(
	recentUserList []UserInfo, recentGroupList []*Group, userList []UserInfo,
	groupList []*Group, userChangeEvent chan UserChangeEvent,
	selectEvent chan SelectEvent,
	myName, myID string,
	msgIn chan wechat.Message, msgOut chan wechat.MessageRecord,
	logger *log.Logger, we *wechat.Wechat)

func Open

func Open(uri string) error

Open calls the OS default program for uri

func ShowNotify

func ShowNotify(message string) error

func TranslateEmoji

func TranslateEmoji(sentence string) string

Types

type ChatBox

type ChatBox struct {
	MyId   string
	MyName string

	Id string

	Notify bool
	// contains filtered or unexported fields
}

func NewChatBox

func NewChatBox(myId, myName string, baseX, baseY, width, height int,
	logger *log.Logger,
	msgIn chan wechat.Message, msgOut chan wechat.MessageRecord,
	groupChan chan SelectEvent) *ChatBox

func (*ChatBox) Action

func (l *ChatBox) Action(e termui.Event) bool

func (*ChatBox) NextSelect

func (l *ChatBox) NextSelect()

func (*ChatBox) Pick

func (l *ChatBox) Pick()

func (*ChatBox) PrevSelect

func (l *ChatBox) PrevSelect()

func (*ChatBox) Reset

func (l *ChatBox) Reset()

func (*ChatBox) SendText

func (l *ChatBox) SendText(text string)

func (*ChatBox) Unpick

func (l *ChatBox) Unpick()

type ChatLogRecord

type ChatLogRecord struct {
	// contains filtered or unexported fields
}

type Group

type Group struct {
	UserList     []*UserInfo
	Name         string
	GroupId      string
	LastChatTime time.Time
}

用户群组

func (Group) GetId

func (l Group) GetId() string

func (Group) GetLastChatTime

func (l Group) GetLastChatTime() time.Time

func (Group) GetName

func (l Group) GetName() string

func (Group) GetType

func (l Group) GetType() string

func (Group) GetUserList

func (l Group) GetUserList() []*UserInfo

type Layout

type Layout struct {
	Notify bool
	// contains filtered or unexported fields
}

func (*Layout) SwitchWidget

func (l *Layout) SwitchWidget()

type SelectEvent

type SelectEvent interface {
	GetId() string
	GetName() string
	GetType() string
	GetLastChatTime() time.Time
	GetUserList() []*UserInfo
}

type SortItems

type SortItems []SelectEvent

func (SortItems) Len

func (p SortItems) Len() int

func (SortItems) Less

func (p SortItems) Less(i, j int) bool

type UserChangeEvent

type UserChangeEvent struct {
}

type UserInfo

type UserInfo struct {
	UserId       string
	Nick         string
	DisplayName  string
	LastChatTime time.Time
}

func (UserInfo) GetId

func (l UserInfo) GetId() string

func (UserInfo) GetLastChatTime

func (l UserInfo) GetLastChatTime() time.Time

func (UserInfo) GetName

func (l UserInfo) GetName() string

func (UserInfo) GetType

func (l UserInfo) GetType() string

func (UserInfo) GetUserList

func (l UserInfo) GetUserList() []*UserInfo

type UserList

type UserList struct {
	// contains filtered or unexported fields
}

func NewUserList

func NewUserList(recentUserList []UserInfo, recentGroupList []*Group,
	userList []UserInfo,
	groupList []*Group,
	selectEvent chan SelectEvent, width,
	height,
	baseX, baseY int,
	logger *log.Logger, we *wechat.Wechat) *UserList

func (*UserList) Action

func (this *UserList) Action(e ui.Event) bool

func (*UserList) InvokeSelect

func (l *UserList) InvokeSelect()

func (*UserList) Pick

func (this *UserList) Pick()

func (*UserList) Reset

func (this *UserList) Reset()

func (*UserList) Unpick

func (this *UserList) Unpick()

type WidgetPicker

type WidgetPicker interface {
	Pick()
	Unpick()
	Action(e ui.Event) bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL