You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.6 KiB
71 lines
1.6 KiB
package ui |
|
|
|
import "github.com/rivo/tview" |
|
|
|
type StatusBar struct { |
|
tutView *TutView |
|
View *tview.TextView |
|
} |
|
|
|
func NewStatusBar(tv *TutView) *StatusBar { |
|
sb := &StatusBar{ |
|
tutView: tv, |
|
View: NewTextView(tv.tut.Config), |
|
} |
|
sb.View.SetBackgroundColor(tv.tut.Config.Style.StatusBarBackground) |
|
sb.View.SetTextColor(tv.tut.Config.Style.StatusBarText) |
|
return sb |
|
} |
|
|
|
type ViewMode uint |
|
|
|
const ( |
|
CmdMode ViewMode = iota |
|
ComposeMode |
|
HelpMode |
|
EditorMode |
|
LinkMode |
|
ListMode |
|
MediaMode |
|
NotificationsMode |
|
ScrollMode |
|
UserMode |
|
VoteMode |
|
PollMode |
|
PreferenceMode |
|
) |
|
|
|
func (sb *StatusBar) SetMode(m ViewMode) { |
|
sb.View.SetBackgroundColor(sb.tutView.tut.Config.Style.StatusBarBackground) |
|
sb.View.SetTextColor(sb.tutView.tut.Config.Style.StatusBarText) |
|
switch m { |
|
case CmdMode: |
|
sb.View.SetText("-- CMD --") |
|
case ComposeMode: |
|
sb.View.SetText("-- COMPOSE --") |
|
case HelpMode: |
|
sb.View.SetText("-- HELP --") |
|
case LinkMode: |
|
sb.View.SetText("-- LINK --") |
|
case ListMode: |
|
sb.View.SetText("-- LIST --") |
|
case EditorMode: |
|
sb.View.SetText("-- EDITOR --") |
|
case MediaMode: |
|
sb.View.SetText("-- MEDIA --") |
|
case NotificationsMode: |
|
sb.View.SetText("-- NOTIFICATIONS --") |
|
case VoteMode: |
|
sb.View.SetText("-- VOTE --") |
|
case ScrollMode: |
|
sb.View.SetBackgroundColor(sb.tutView.tut.Config.Style.StatusBarViewBackground) |
|
sb.View.SetTextColor(sb.tutView.tut.Config.Style.StatusBarViewText) |
|
sb.View.SetText("-- VIEW --") |
|
case UserMode: |
|
sb.View.SetText("-- SELECT USER --") |
|
case PollMode: |
|
sb.View.SetText("-- CREATE POLL --") |
|
case PreferenceMode: |
|
sb.View.SetText("-- PREFERENCES --") |
|
} |
|
}
|
|
|