diff options
| author | Jeff Carr <[email protected]> | 2024-02-02 14:49:17 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-02-02 14:49:17 -0600 |
| commit | ee0f84fd8ef5993a6c374c8ee4e22c837ca39d97 (patch) | |
| tree | 6b3f2800ddeb92c32d08c537cf1b0c1692b4a166 /place.go | |
| parent | 4800fe662002c1e0192614f60c179b6d46c43cae (diff) | |
finds the item chosen from the dropdown list
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'place.go')
| -rw-r--r-- | place.go | 50 |
1 files changed, 50 insertions, 0 deletions
@@ -214,3 +214,53 @@ func textSize(n *tree.Node) (int, int) { } return width, height } + +// moves the gocui view the W and H offset on the screen +/* + gocui defines the offset like this: + + width -> increases to the right + ---------------------------------- hieght + | H = 1 | increases + | | | + | W = 1 W = 18 | | + | | v + | H = 5 | downwards + ------------------------------------- +*/ +// change over to this name +func (tk *guiWidget) MoveToOffset(W, H int) { + tk.gocuiSetWH(W, H) +} + +// returns where the corner of widget starts (upper left) +func (tk *guiWidget) Position() (int, int) { + return tk.gocuiSize.w0, tk.gocuiSize.h0 +} + +func (tk *guiWidget) gocuiSetWH(sizeW, sizeH int) { + w := len(widget.GetString(tk.value)) + lines := strings.Split(widget.GetString(tk.value), "\n") + h := len(lines) + + // tk := n.tk + if tk.isFake { + tk.gocuiSize.w0 = sizeW + tk.gocuiSize.h0 = sizeH + tk.gocuiSize.w1 = tk.gocuiSize.w0 + w + me.FramePadW + tk.gocuiSize.h1 = tk.gocuiSize.h0 + h + me.FramePadH + return + } + + if tk.frame { + tk.gocuiSize.w0 = sizeW + tk.gocuiSize.h0 = sizeH + tk.gocuiSize.w1 = tk.gocuiSize.w0 + w + me.FramePadW + tk.gocuiSize.h1 = tk.gocuiSize.h0 + h + me.FramePadH + } else { + tk.gocuiSize.w0 = sizeW - 1 + tk.gocuiSize.h0 = sizeH - 1 + tk.gocuiSize.w1 = tk.gocuiSize.w0 + w + 1 + tk.gocuiSize.h1 = tk.gocuiSize.h0 + h + 1 + } +} |
