My mirror of the Barnard terminal client for Mumble.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

52 lignes
795 B

  1. package uiterm
  2. import (
  3. "strings"
  4. "github.com/nsf/termbox-go"
  5. )
  6. type Label struct {
  7. Text string
  8. Fg Attribute
  9. Bg Attribute
  10. ui *Ui
  11. x0, y0, x1, y1 int
  12. }
  13. func (l *Label) uiInitialize(ui *Ui) {
  14. l.ui = ui
  15. }
  16. func (l *Label) uiSetActive(active bool) {
  17. }
  18. func (l *Label) uiSetBounds(x0, y0, x1, y1 int) {
  19. l.x0 = x0
  20. l.y0 = y0
  21. l.x1 = x1
  22. l.y1 = y1
  23. }
  24. func (l *Label) uiDraw() {
  25. reader := strings.NewReader(l.Text)
  26. for y := l.y0; y < l.y1; y++ {
  27. for x := l.x0; x < l.x1; x++ {
  28. var chr rune
  29. if ch, _, err := reader.ReadRune(); err != nil {
  30. chr = ' '
  31. } else {
  32. chr = ch
  33. }
  34. termbox.SetCell(x, y, chr, termbox.Attribute(l.Fg), termbox.Attribute(l.Bg))
  35. }
  36. }
  37. }
  38. func (l *Label) uiKeyEvent(mod Modifier, key Key) {
  39. }
  40. func (l *Label) uiCharacterEvent(chr rune) {
  41. }