add restore command

This commit is contained in:
ShuheiKubota 2019-11-09 17:19:38 +09:00
parent 99e9a1c279
commit 56bef848e0
1 changed files with 14 additions and 16 deletions

30
vvin.go
View File

@ -29,10 +29,11 @@ type globalCmd struct {
Target string `cli:"target,t=WINDOW_TITLE" help:"default to current window"` Target string `cli:"target,t=WINDOW_TITLE" help:"default to current window"`
Debug bool Debug bool
Minimize minCmd `cli:"minimize,min"` Minimize minCmd `cli:"minimize,min"`
Maximize maxCmd `cli:"maximize,max"` Maximize maxCmd `cli:"maximize,max"`
Resize resizeCmd `cli:"resize"` Restore restoreCmd `cli:"restore"`
Move moveCmd `cli:"move,mv"` Resize resizeCmd `cli:"resize"`
Move moveCmd `cli:"move,mv"`
targetHandle syscall.Handle targetHandle syscall.Handle
@ -87,27 +88,24 @@ func (c *globalCmd) Before() error {
} }
type minCmd struct { type minCmd struct {
Restore bool `cli:"restore,r"`
} }
func (c minCmd) Run(g globalCmd) { func (c minCmd) Run(g globalCmd) {
if c.Restore { showWindow.Call(uintptr(g.targetHandle), SW_MINIMIZE)
showWindow.Call(uintptr(g.targetHandle), SW_RESTORE)
} else {
showWindow.Call(uintptr(g.targetHandle), SW_MINIMIZE)
}
} }
type maxCmd struct { type maxCmd struct {
Restore bool `cli:"restore,r"`
} }
func (c maxCmd) Run(g globalCmd) { func (c maxCmd) Run(g globalCmd) {
if c.Restore { showWindow.Call(uintptr(g.targetHandle), SW_MAXIMIZE)
showWindow.Call(uintptr(g.targetHandle), SW_RESTORE) }
} else {
showWindow.Call(uintptr(g.targetHandle), SW_MAXIMIZE) type restoreCmd struct {
} }
func (c restoreCmd) Run(g globalCmd) {
showWindow.Call(uintptr(g.targetHandle), SW_RESTORE)
} }
type resizeCmd struct { type resizeCmd struct {