components

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channels

type Channels struct {
	List            *termui.List
	SelectedChannel int // index of which channel is selected from the List
	Offset          int // from what offset are channels rendered
	CursorPosition  int // the y position of the 'cursor'
}

Channels is the definition of a Channels component

func CreateChannels

func CreateChannels(svc *service.SlackService, inputHeight int) *Channels

CreateChannels is the constructor for the Channels component

func (*Channels) Buffer

func (c *Channels) Buffer() termui.Buffer

Buffer implements interface termui.Bufferer

func (*Channels) ClearNewMessageIndicator

func (c *Channels) ClearNewMessageIndicator()

ClearNewMessageIndicator will remove the asterisk in front of a channel that received a new message. This will happen as one will move up or down the cursor for Channels

func (*Channels) GetChannels

func (c *Channels) GetChannels(svc *service.SlackService)

GetChannels will get all available channels from the SlackService

func (*Channels) GetHeight

func (c *Channels) GetHeight() int

GetHeight implements interface termui.GridBufferer

func (*Channels) MoveCursorBottom

func (c *Channels) MoveCursorBottom()

MoveCursorBottom will move the cursor to the bottom of the channels

func (*Channels) MoveCursorDown

func (c *Channels) MoveCursorDown()

MoveCursorDown will increase the SelectedChannel by 1

func (*Channels) MoveCursorTop

func (c *Channels) MoveCursorTop()

MoveCursorTop will move the cursor to the top of the channels

func (*Channels) MoveCursorUp

func (c *Channels) MoveCursorUp()

MoveCursorUp will decrease the SelectedChannel by 1

func (*Channels) NewMessage

func (c *Channels) NewMessage(svc *service.SlackService, channelID string)

NewMessage will be called when a new message arrives and will render an asterisk in front of the channel name

func (*Channels) ScrollDown

func (c *Channels) ScrollDown()

ScrollDown enables us to scroll through the channel list when it overflows

func (*Channels) ScrollUp

func (c *Channels) ScrollUp()

ScrollUp enables us to scroll through the channel list when it overflows

func (*Channels) SetReadMark added in v0.2.0

func (c *Channels) SetReadMark(svc *service.SlackService)

func (*Channels) SetSelectedChannel

func (c *Channels) SetSelectedChannel(index int)

SetSelectedChannel sets the SelectedChannel given the index

func (*Channels) SetWidth

func (c *Channels) SetWidth(w int)

SetWidth implements interface termui.GridBufferer

func (*Channels) SetX

func (c *Channels) SetX(x int)

SetX implements interface termui.GridBufferer

func (*Channels) SetY

func (c *Channels) SetY(y int)

SetY implements interface termui.GridBufferer

type Chat

type Chat struct {
	List   *termui.List
	Offset int
}

Chat is the definition of a Chat component

func CreateChat

func CreateChat(svc *service.SlackService, inputHeight int, selectedSlackChannel interface{}, selectedChannel service.Channel) *Chat

CreateChat is the constructor for the Chat struct

func (*Chat) AddMessage

func (c *Chat) AddMessage(message string)

AddMessage adds a single message to List.Items

func (*Chat) Buffer

func (c *Chat) Buffer() termui.Buffer

Buffer implements interface termui.Bufferer

func (*Chat) ClearMessages

func (c *Chat) ClearMessages()

ClearMessages clear the List.Items

func (*Chat) GetHeight

func (c *Chat) GetHeight() int

GetHeight implements interface termui.GridBufferer

func (*Chat) GetMessages

func (c *Chat) GetMessages(svc *service.SlackService, channel interface{})

GetMessages will get an array of strings for a specific channel which will contain messages in turn all these messages will be added to List.Items

func (*Chat) Help added in v0.2.0

func (c *Chat) Help(cfg *config.Config)

Help shows the usage and key bindings in the chat pane

func (*Chat) ScrollDown

func (c *Chat) ScrollDown()

ScrollDown will render the chat messages based on the Offset of the Chat pane.

Offset is 0 when scrolled down. (we loop backwards over the array, so we start with rendering last item in the list at the maximum y of the Chat pane). Increasing the Offset will thus result in substracting the offset from the len(Chat.List.Items).

func (*Chat) ScrollUp

func (c *Chat) ScrollUp()

ScrollUp will render the chat messages based on the Offset of the Chat pane.

Offset is 0 when scrolled down. (we loop backwards over the array, so we start with rendering last item in the list at the maximum y of the Chat pane). Increasing the Offset will thus result in substracting the offset from the len(Chat.List.Items).

func (*Chat) SetBorderLabel

func (c *Chat) SetBorderLabel(channel service.Channel)

SetBorderLabel will set Label of the Chat pane to the specified string

func (*Chat) SetWidth

func (c *Chat) SetWidth(w int)

SetWidth implements interface termui.GridBufferer

func (*Chat) SetX

func (c *Chat) SetX(x int)

SetX implements interface termui.GridBufferer

func (*Chat) SetY

func (c *Chat) SetY(y int)

SetY implements interface termui.GridBufferer

type Input

type Input struct {
	Par            *termui.Par
	Text           []rune
	CursorPosition int
}

Input is the definition of an Input component

func CreateInput

func CreateInput() *Input

CreateInput is the constructor of the Input struct

func (*Input) Backspace

func (i *Input) Backspace()

Backspace will remove a character in front of the CursorPosition

func (*Input) Buffer

func (i *Input) Buffer() termui.Buffer

Buffer implements interface termui.Bufferer

func (*Input) Clear

func (i *Input) Clear()

Clear will empty the input and move the cursor to the start position

func (*Input) Delete

func (i *Input) Delete()

Delete will remove a character at the CursorPosition

func (*Input) GetHeight

func (i *Input) GetHeight() int

GetHeight implements interface termui.GridBufferer

func (*Input) GetText

func (i *Input) GetText() string

GetText returns the text currently in the input

func (*Input) Insert

func (i *Input) Insert(key rune)

Insert will insert a given key at the place of the current CursorPosition

func (*Input) IsEmpty

func (i *Input) IsEmpty() bool

IsEmpty will return true when the input is empty

func (*Input) MoveCursorLeft

func (i *Input) MoveCursorLeft()

MoveCursorLeft will decrease the current CursorPosition with 1

func (*Input) MoveCursorRight

func (i *Input) MoveCursorRight()

MoveCursorRight will increase the current CursorPosition with 1

func (*Input) SendMessage

func (i *Input) SendMessage(svc *service.SlackService, channel string, message string)

SendMessage send the input text through the SlackService

func (*Input) SetWidth

func (i *Input) SetWidth(w int)

SetWidth implements interface termui.GridBufferer

func (*Input) SetX

func (i *Input) SetX(x int)

SetX implements interface termui.GridBufferer

func (*Input) SetY

func (i *Input) SetY(y int)

SetY implements interface termui.GridBufferer

type Mode

type Mode struct {
	Par *termui.Par
}

Mode is the definition of Mode component

func CreateMode

func CreateMode() *Mode

CreateMode is the constructor of the Mode struct

func (*Mode) Buffer

func (m *Mode) Buffer() termui.Buffer

Buffer implements interface termui.Bufferer

func (*Mode) GetHeight

func (m *Mode) GetHeight() int

GetHeight implements interface termui.GridBufferer

func (*Mode) SetWidth

func (m *Mode) SetWidth(w int)

SetWidth implements interface termui.GridBufferer

func (*Mode) SetX

func (m *Mode) SetX(x int)

SetX implements interface termui.GridBufferer

func (*Mode) SetY

func (m *Mode) SetY(y int)

SetY implements interface termui.GridBufferer

Jump to

Keyboard shortcuts

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