Add borders
This commit is contained in:
parent
494a21f75f
commit
c74532ac54
3 changed files with 29 additions and 10 deletions
20
lib/main.rb
20
lib/main.rb
|
@ -538,34 +538,34 @@ private
|
||||||
}.freeze,
|
}.freeze,
|
||||||
|
|
||||||
chat: {
|
chat: {
|
||||||
x: Widgets::Logo::WIDTH,
|
x: Widgets::Logo::WIDTH + 1,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: Curses.stdscr.maxx - Widgets::Logo::WIDTH,
|
width: Curses.stdscr.maxx - Widgets::Logo::WIDTH - 1,
|
||||||
height: Curses.stdscr.maxy,
|
height: Curses.stdscr.maxy,
|
||||||
focus: :new_message,
|
focus: :new_message,
|
||||||
focused: false,
|
focused: false,
|
||||||
|
|
||||||
info: {
|
info: {
|
||||||
x: Widgets::Logo::WIDTH,
|
x: Widgets::Logo::WIDTH + 1,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: Curses.stdscr.maxx - Widgets::Logo::WIDTH,
|
width: Curses.stdscr.maxx - Widgets::Logo::WIDTH - 1,
|
||||||
height: 2,
|
height: 2,
|
||||||
focused: false,
|
focused: false,
|
||||||
}.freeze,
|
}.freeze,
|
||||||
|
|
||||||
new_message: {
|
new_message: {
|
||||||
x: Widgets::Logo::WIDTH,
|
x: Widgets::Logo::WIDTH + 1,
|
||||||
y: Curses.stdscr.maxy - 1,
|
y: Curses.stdscr.maxy - 1,
|
||||||
width: Curses.stdscr.maxx - Widgets::Logo::WIDTH,
|
width: Curses.stdscr.maxx - Widgets::Logo::WIDTH - 1,
|
||||||
height: 1,
|
height: 1,
|
||||||
focused: false,
|
focused: false,
|
||||||
}.freeze,
|
}.freeze,
|
||||||
|
|
||||||
history: {
|
history: {
|
||||||
x: Widgets::Logo::WIDTH,
|
x: Widgets::Logo::WIDTH + 1,
|
||||||
y: 2,
|
y: 3,
|
||||||
width: Curses.stdscr.maxx - Widgets::Logo::WIDTH,
|
width: Curses.stdscr.maxx - Widgets::Logo::WIDTH - 1,
|
||||||
height: Curses.stdscr.maxy - 3,
|
height: Curses.stdscr.maxy - 5,
|
||||||
focused: true,
|
focused: true,
|
||||||
}.freeze,
|
}.freeze,
|
||||||
}.freeze,
|
}.freeze,
|
||||||
|
|
|
@ -48,6 +48,16 @@ module Widgets
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def draw
|
||||||
|
super
|
||||||
|
|
||||||
|
setpos 0, 2
|
||||||
|
addstr '-' * props[:width]
|
||||||
|
|
||||||
|
setpos 0, props[:height] - 2
|
||||||
|
addstr '-' * props[:width]
|
||||||
|
end
|
||||||
|
|
||||||
def focus
|
def focus
|
||||||
case props[:focus]
|
case props[:focus]
|
||||||
when :info then @info
|
when :info then @info
|
||||||
|
|
|
@ -53,6 +53,15 @@ module Widgets
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def draw
|
||||||
|
super
|
||||||
|
|
||||||
|
(0...props[:height]).each do |y|
|
||||||
|
setpos props[:sidebar][:width], y
|
||||||
|
addstr '|'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def focus
|
def focus
|
||||||
case props[:focus]
|
case props[:focus]
|
||||||
when :sidebar then @sidebar
|
when :sidebar then @sidebar
|
||||||
|
|
Reference in a new issue