Commit Graph

19 Commits

Author SHA1 Message Date
Dan Winship
5331d3e360 [St] Make allocation handling more consistent
In StBin, StBoxLayout, and StTable, if a child has a potential
allocation that is larger than its preferred size, we give it its
preferred size instead. However, the corresponding
get_preferred_height/width methods were not making the same
assumption, which meant that if we had more width than the widget
wanted, we would allocate it its preferred width, but with the height
that corresponded to the larger width.

Fix this by defining new helpers _st_actor_get_preferred_width() and
_st_actor_get_preferred_height() and using them everywhere. Also, make
StBin and StTable use _st_allocate_fill() rather than having
nearly-identical duplicate copies of the code.

https://bugzilla.gnome.org/show_bug.cgi?id=609848
2010-02-16 14:06:39 -05:00
Marina Zhurakhinskaya
038a32330f [St] Add st_box_layout_move_child and st_box_layout_insert_actor 2010-01-13 15:13:20 -05:00
Abderrahim Kitouni
4e8206d60e [StBoxLayout] now RTL aware
https://bugzilla.gnome.org/show_bug.cgi?id=584662
2009-11-16 11:46:22 -05:00
Colin Walters
8040ad61c6 [StBoxLayout] Add missing _queue_relayout in _add_actor
https://bugzilla.gnome.org/show_bug.cgi?id=600734
2009-11-12 11:42:00 -05:00
Colin Walters
057f0effed [StBoxLayout] Add st_box_layout_get_n_children
https://bugzilla.gnome.org/show_bug.cgi?id=600734
2009-11-12 11:42:00 -05:00
Colin Walters
bf7b166237 [StBoxLayout] Add st_box_layout_remove_all, st_box_layout_destroy_children
In a variety of places we're using boxes as data-modeling displays,
and in doing so we often want to either remove the children or
explictly destroy them.

Now ideally Gjs would support callbacks, and this would make using
the for_each functions possible, but even then these functions
are more efficient and shorter to type, at least.

https://bugzilla.gnome.org/show_bug.cgi?id=600734
2009-11-12 11:42:00 -05:00
Colin Walters
f549269934 [StBoxLayout] Implement raise and lower
Code copied from ClutterGroup.

https://bugzilla.gnome.org/show_bug.cgi?id=599442
2009-11-04 16:47:11 -05:00
Colin Walters
7c954898a2 Support fixed position children
When doing layout, check for whether x/y have been explicitly
specified, and if so honor those positions.

https://bugzilla.gnome.org/show_bug.cgi?id=598462
2009-10-15 17:40:58 -04:00
Colin Walters
497c74f4d8 Minor code cleanup: use child variable consistently
Preparation for a subsequent patch.

https://bugzilla.gnome.org/show_bug.cgi?id=598462
2009-10-15 17:40:58 -04:00
Colin Walters
ab0460ad59 Use clutter_actor_destroy in dispose, add _dispose where needed
ClutterGroup calls _destroy, but most of St was just calling _unparent.
This caused problems because the DESTROY signal was not emitted
for child elements after destroying a toplevel.  Also, in a GC'd
binding it would cause unpredictable lifetime of children.

Some St widgets simply didn't have _dispose at all; implement it.

Note because of the usage of the background_image in StButton,
we can't cleanly destroy it inside the StWidget.

https://bugzilla.gnome.org/show_bug.cgi?id=597845
2009-10-09 16:19:33 -04:00
Owen W. Taylor
91eb613d69 Turn StBoxLayout:spacing into a style property
Remove the StBoxLayout:spacing GObject property, and instead make
BoxLayout look up the spacing from the CSS style. This makes it
consistent with padding and will allow the use of units. (The
removal of the GObject property entirely instead of making it an
override is consistent with how we handle color, font, padding, etc.)

https://bugzilla.gnome.org/show_bug.cgi?id=596803
2009-10-01 14:46:32 -04:00
Owen W. Taylor
a15205e6c4 Fix interaction of borders/background and scrolling
StBoxLayout: Make consistent that the area scrolled and clipped
to is the content area (excluding borders and padding.) Translate
back appropriately when chaining up so that the parent background
is drawn at the right place and picking on the box (if it's reactive)
picks at the right place on the screen.

clip-to-allocation is removed from StScrollView since it's just
not right - if the child has any non-moving elements, like headers or
borders, it will need to set a narrower clip. And even if the entire
child scrolls, we want to clip to an arrow that excludes the scrollbars.

https://bugzilla.gnome.org/show_bug.cgi?id=595997
2009-10-01 14:41:19 -04:00
Owen W. Taylor
28dbf7a06e Allocate children as wide as the scrolled area
When we are scrolling a vertical box horizontally , children should be
allocated horizontally as wide as the full horizontal scrolled area,
not just to the size of the "viewport". Similarly for a horizontal box.

http://bugzilla.moblin.org/show_bug.cgi?id=6312
https://bugzilla.gnome.org/show_bug.cgi?id=595996
2009-10-01 14:41:19 -04:00
Owen W. Taylor
1ec8e9eb6b Allow StBoxLayout to shrink down to its minimum size
When a StBoxLayout is allocated a size less than its natural size,
think "shrink" needs to be divided among the children that have
a smaller minimum size than natural size.

This is done by preferentially shrinking the children that are most
expanded from their minimum size and then increasing that set of
children until we've found enough total shrink.

A new method is used of allocating children at integral sizes - instead
of rounding the per-child extra amount to an integer (which causes
cumulative round-off errors), compute the position as we go along in
floats and round individually for each child widget.

Extend the box-layout test to include of a test of a box being set
to various widths, starting quite narrow.

http://bugzilla.moblin.org/show_bug.cgi?id=6311
https://bugzilla.gnome.org/show_bug.cgi?id=595995
2009-10-01 14:41:19 -04:00
Owen W. Taylor
fa09f7a6da Don't count not-visible children among expand children
When counting how many children we should divide extra space among,
don't count not-visible children.

http://bugzilla.moblin.org/show_bug.cgi?id=6310
https://bugzilla.gnome.org/show_bug.cgi?id=595995
2009-10-01 14:41:19 -04:00
Owen W. Taylor
d67e54d3ee Don't use the default stage when setting up adjustments
If the actor isn't in a stage, then setting up the adjustment
based on the actor's size (which we can't compute) and the
size of the default stage (which isn't relevant), doesn't make
sense. Just use arbitrary default values.

The adjustments will be updated to reasonable values when first
the box is first allocated.

It's not entirely clear to me why we ever want to compute the
adjustment settings this way; perhaps we should always use
default values.

http://bugzilla.moblin.org/show_bug.cgi?id=6307
https://bugzilla.gnome.org/show_bug.cgi?id=595996
2009-10-01 14:41:19 -04:00
Owen W. Taylor
076e902b2c Centralize computations of border and padding into StThemeNode
Rather than repeating the computation of borders in many different
widget subclasses, add helper functions:

 st_theme_node_adjust_for_height()
 st_theme_node_adjust_preferred_width()
 st_theme_node_adjust_for_width()
 st_theme_node_adjust_preferred_height()
 st_theme_node_get_content_box()

That are used in get_preferred_width()/get_preferred_height() and
allocate() methods to consistently apply the necessary adjustments.
This allows removing the StPadding type.

Queueing a relayout when the borders/padding change is moved from
st_widget_real_style_changed() to the invoking code to allow access
to the old StThemeNode for comparison. (Should this be added as
a parameter to the signal?)

Borders are included in the geometry adjustments, but borders
are not yet drawn.

https://bugzilla.gnome.org/show_bug.cgi?id=595993
2009-10-01 14:41:19 -04:00
Owen W. Taylor
e91e8e993d Add emacs mode-lines to ST sources
To each .c and .h file, add:

 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */

'gnu' is the default anyways for Emacs, but indent-tabs-mode is not,
so this sets things up to correspond to the policy of no-tabs.

http://bugzilla.moblin.org/show_bug.cgi?id=6467
2009-10-01 14:41:18 -04:00
Owen W. Taylor
8b6962f3bf Import MxBoxLayout, MxBoxLayoutChild
https://bugzilla.gnome.org/show_bug.cgi?id=591245
2009-10-01 14:41:17 -04:00