add restore command

This commit is contained in:
ShuheiKubota 2019-11-09 17:19:38 +09:00
parent 99e9a1c279
commit 56bef848e0

18
vvin.go
View file

@ -31,6 +31,7 @@ type globalCmd struct {
Minimize minCmd `cli:"minimize,min"` Minimize minCmd `cli:"minimize,min"`
Maximize maxCmd `cli:"maximize,max"` Maximize maxCmd `cli:"maximize,max"`
Restore restoreCmd `cli:"restore"`
Resize resizeCmd `cli:"resize"` Resize resizeCmd `cli:"resize"`
Move moveCmd `cli:"move,mv"` Move moveCmd `cli:"move,mv"`
@ -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_RESTORE)
} else {
showWindow.Call(uintptr(g.targetHandle), SW_MINIMIZE) 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_RESTORE)
} else {
showWindow.Call(uintptr(g.targetHandle), SW_MAXIMIZE) 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 {