mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
[layout] Allow taking a back pointer to the Container
The LayoutManager implementation might opt to take a back pointer to the Container that is using the layout instance; this allows direct access to the container itself from within the implementation.
This commit is contained in:
parent
f58bdbad15
commit
9117ee2056
@ -299,6 +299,34 @@ clutter_layout_manager_layout_changed (ClutterLayoutManager *manager)
|
||||
g_signal_emit (manager, manager_signals[LAYOUT_CHANGED], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_layout_manager_set_container:
|
||||
* @manager: a #ClutterLayoutManager
|
||||
* @container: (allow-none): a #ClutterContainer using @manager
|
||||
*
|
||||
* If the #ClutterLayoutManager sub-class allows it, allow
|
||||
* adding a weak reference of the @container using @manager
|
||||
* from within the layout manager
|
||||
*
|
||||
* The layout manager should not increase the reference
|
||||
* count of the @container
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
clutter_layout_manager_set_container (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container)
|
||||
{
|
||||
ClutterLayoutManagerClass *klass;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
|
||||
g_return_if_fail (container == NULL || CLUTTER_IS_CONTAINER (container));
|
||||
|
||||
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
|
||||
if (klass->set_container)
|
||||
klass->set_container (manager, container);
|
||||
}
|
||||
|
||||
static inline ClutterLayoutMeta *
|
||||
create_child_meta (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
|
@ -57,6 +57,9 @@ struct _ClutterLayoutManager
|
||||
{
|
||||
/*< private >*/
|
||||
GInitiallyUnowned parent_instance;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer dummy;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -70,6 +73,10 @@ struct _ClutterLayoutManager
|
||||
* @allocate: virtual function; override to allocate the children of the
|
||||
* layout manager. See also the allocate() virtual function in
|
||||
* #ClutterActor
|
||||
* @set_container: virtual function; override to set a back pointer
|
||||
* on the #ClutterContainer using the layout manager. The implementation
|
||||
* should not take a reference on the container, but just take a weak
|
||||
* reference, to avoid potential leaks due to reference cycles
|
||||
* @create_child_meta: virtual function; override to create a
|
||||
* #ClutterChildMeta instance associated to a #ClutterContainer and a
|
||||
* child #ClutterActor, used to maintain layout manager specific properties
|
||||
@ -102,6 +109,9 @@ struct _ClutterLayoutManagerClass
|
||||
const ClutterActorBox *allocation,
|
||||
ClutterAllocationFlags flags);
|
||||
|
||||
void (* set_container) (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container);
|
||||
|
||||
ClutterLayoutMeta *(* create_child_meta) (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
@ -137,6 +147,8 @@ void clutter_layout_manager_allocate (ClutterLayoutMan
|
||||
const ClutterActorBox *allocation,
|
||||
ClutterAllocationFlags flags);
|
||||
|
||||
void clutter_layout_manager_set_container (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container);
|
||||
void clutter_layout_manager_layout_changed (ClutterLayoutManager *manager);
|
||||
|
||||
ClutterLayoutMeta *clutter_layout_manager_get_child_meta (ClutterLayoutManager *manager,
|
||||
|
@ -1735,6 +1735,7 @@ clutter_layout_manager_get_preferred_width
|
||||
clutter_layout_manager_get_preferred_height
|
||||
clutter_layout_manager_allocate
|
||||
clutter_layout_manager_layout_changed
|
||||
clutter_layout_manager_set_container
|
||||
|
||||
<SUBSECTION>
|
||||
clutter_layout_manager_add_child_meta
|
||||
|
Loading…
Reference in New Issue
Block a user