My mirror of the Barnard terminal client for Mumble.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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