clj-commons / seesaw

Seesaw turns the Horror of Swing into a friendly, well-documented, Clojure library
https://groups.google.com/group/seesaw-clj
1.47k stars 149 forks source link

Implement window state management #88

Open daveray opened 12 years ago

daveray commented 12 years ago

minimize, maximize, etc.

stevenarnold commented 10 years ago

Dave, this works for me for max!. It's possible that there are any number of problems with this code; I am new to both Swing and Seesaw. Note the code is almost entirely lifted from the original Google Groups question. As far as min!, it seems pack! would do about the same thing, unless we're looking for some kind of minimization to the dock or process bar or something.

(defn max! [frame](let [ge %28java.awt.GraphicsEnvironment/getLocalGraphicsEnvironment%29] %28. frame setExtendedState %28bit-or %28. frame getExtendedState%29 java.awt.Frame/MAXIMIZED_BOTH%29%29 %28. frame setSize %28. %28. ge getMaximumWindowBounds%29 getSize%29%29))

daveray commented 10 years ago

Hey. Sorry I haven't responded sooner. It's been a bit hectic.

This is a start. It's a bit tricky because it really bumps up against platform-specific issues like what "maximized" or "minimized" really means. I'd also want an API for serializing the current window state and restoring it. That's a pretty common thing to do when starting apps, i.e. put them back the way they were before.

So, if you'd like to pursue it more, go for it.