[Pharo-project] Tiling windows

laurent laffont laurent.laffont at gmail.com
Sun May 22 21:13:54 CEST 2011


On Sun, May 22, 2011 at 8:25 PM, laurent laffont
<laurent.laffont at gmail.com>wrote:

> Hi,
>
> what do you think of adding this in Pharo ?
>


(I forgot I've hacked TaskBarMorph to make it working well but the idea is
here :)



>
> |taskbar tileWindowsBlock|
>
> tileWindowsBlock := [
>   |windows numberOfColumns numberOfRows windowWidth windowHeight|
>   windows := (World submorphs select: [:m| m isSystemWindow and: [m
> isNotMinimized]]) asOrderedCollection.
>   numberOfColumns := windows size sqrtFloor.
>   numberOfRows := (windows size / numberOfColumns) rounded.
>   windowWidth := World width // numberOfColumns..
>   windowHeight := World height  - taskbar height // numberOfRows.
>
>   Matrix
>     rows: numberOfRows
>     columns: numberOfColumns
>     tabulate: [:row :column|  |window|
>           windows ifNotEmpty: [
>               window := windows remove: windows first.
>               window
>               bounds: (
>                   ((column - 1 * windowWidth) @ (row - 1 * windowHeight))
>                   extent: (windowWidth) @  windowHeight)
>           ]
>     ]
> ].
>
>
> taskbar := (World submorphs detect: [:m| m isTaskbar]).
>
> taskbar
>   addMorph: (IconicButton new
>             target: tileWindowsBlock;
>             actionSelector: #value;
>             labelGraphic: taskbar theme smallWindowIcon;
>             color: Color transparent;
>             yourself).
>
>
> Laurent Laffont - @lolgzs <http://twitter.com/#!/lolgzs>
>
> Pharo Smalltalk Screencasts: http://www.pharocasts.com/
> Blog: http://magaloma.blogspot.com/
> Developer group: http://cara74.seasidehosting.st
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20110522/de7e1051/attachment.htm>


More information about the Pharo-project mailing list