Quantcast
Channel: User rafalcieslak - Stack Overflow
Viewing all articles
Browse latest Browse all 25

Answer by rafalcieslak for How can I make the icons in an IconView spread out evenly?

$
0
0

We have encountered that problem in Ubuntu Accomplishments Viewer, and as we managed to solve it, I'll present our solution.

The trick is to place the GtkIconView in a GtkScrolledWindow, and set it's hscrollbar_policy to "always". Then, a check-resize signal has to be used, to react when the user resizes the window (note that it must be checked if the size has changed, for the signal is emitted also when e.g. the window is dragged around). When the size changes, the model used by GtkIconView has to be cleared and recreated, as this triggers GtkIconView properly reallocating the newly gained space (or shrinking). Also, as the result the horizontal scrollbar will never be seen, as the GtkIconView uses exactly that much space as the GtkScrolledWindow uses.


Viewing all articles
Browse latest Browse all 25

Trending Articles