st: Remove st-group
Now that ClutterActor/StWidget is concrete, we don't need it. https://bugzilla.gnome.org/show_bug.cgi?id=670034
This commit is contained in:
parent
be3eb308b9
commit
bb862e20c0
@ -35,7 +35,6 @@
|
|||||||
<title>Containers</title>
|
<title>Containers</title>
|
||||||
<xi:include href="xml/st-bin.xml"/>
|
<xi:include href="xml/st-bin.xml"/>
|
||||||
<xi:include href="xml/st-box-layout.xml"/>
|
<xi:include href="xml/st-box-layout.xml"/>
|
||||||
<xi:include href="xml/st-group.xml"/>
|
|
||||||
<xi:include href="xml/st-scroll-view.xml"/>
|
<xi:include href="xml/st-scroll-view.xml"/>
|
||||||
<xi:include href="xml/st-table.xml"/>
|
<xi:include href="xml/st-table.xml"/>
|
||||||
</chapter>
|
</chapter>
|
||||||
|
@ -1348,7 +1348,7 @@ const MessageTray = new Lang.Class({
|
|||||||
this._onStatusChanged(status);
|
this._onStatusChanged(status);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.actor = new St.Group({ name: 'message-tray',
|
this.actor = new St.Widget({ name: 'message-tray',
|
||||||
reactive: true,
|
reactive: true,
|
||||||
track_hover: true });
|
track_hover: true });
|
||||||
this.actor.connect('notify::hover', Lang.bind(this, this._onTrayHoverChanged));
|
this.actor.connect('notify::hover', Lang.bind(this, this._onTrayHoverChanged));
|
||||||
|
@ -40,7 +40,7 @@ const ModalDialog = new Lang.Class({
|
|||||||
this._hasModal = false;
|
this._hasModal = false;
|
||||||
this._shellReactive = params.shellReactive;
|
this._shellReactive = params.shellReactive;
|
||||||
|
|
||||||
this._group = new St.Group({ visible: false,
|
this._group = new St.Widget({ visible: false,
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0 });
|
y: 0 });
|
||||||
Main.uiGroup.add_actor(this._group);
|
Main.uiGroup.add_actor(this._group);
|
||||||
|
@ -126,7 +126,7 @@ const Overview = new Lang.Class({
|
|||||||
|
|
||||||
this._spacing = 0;
|
this._spacing = 0;
|
||||||
|
|
||||||
this._group = new St.Group({ name: 'overview',
|
this._group = new St.Widget({ name: 'overview',
|
||||||
reactive: true });
|
reactive: true });
|
||||||
this._group._delegate = this;
|
this._group._delegate = this;
|
||||||
this._group.connect('style-changed',
|
this._group.connect('style-changed',
|
||||||
|
@ -19,7 +19,7 @@ const WorkspaceSwitcherPopup = new Lang.Class({
|
|||||||
Name: 'WorkspaceSwitcherPopup',
|
Name: 'WorkspaceSwitcherPopup',
|
||||||
|
|
||||||
_init : function() {
|
_init : function() {
|
||||||
this.actor = new St.Group({ reactive: true,
|
this.actor = new St.Widget({ reactive: true,
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: global.screen_width,
|
width: global.screen_width,
|
||||||
|
@ -156,7 +156,7 @@ const WorkspaceThumbnail = new Lang.Class({
|
|||||||
|
|
||||||
this._removed = false;
|
this._removed = false;
|
||||||
|
|
||||||
this.actor = new St.Group({ reactive: true,
|
this.actor = new St.Widget({ reactive: true,
|
||||||
clip_to_allocation: true,
|
clip_to_allocation: true,
|
||||||
style_class: 'workspace-thumbnail' });
|
style_class: 'workspace-thumbnail' });
|
||||||
this.actor._delegate = this;
|
this.actor._delegate = this;
|
||||||
|
@ -29,7 +29,7 @@ const WorkspacesView = new Lang.Class({
|
|||||||
Name: 'WorkspacesView',
|
Name: 'WorkspacesView',
|
||||||
|
|
||||||
_init: function(workspaces) {
|
_init: function(workspaces) {
|
||||||
this.actor = new St.Group({ style_class: 'workspaces-view' });
|
this.actor = new St.Widget({ style_class: 'workspaces-view' });
|
||||||
|
|
||||||
// The actor itself isn't a drop target, so we don't want to pick on its area
|
// The actor itself isn't a drop target, so we don't want to pick on its area
|
||||||
this.actor.set_size(0, 0);
|
this.actor.set_size(0, 0);
|
||||||
|
@ -54,7 +54,6 @@ st_source_h = \
|
|||||||
st/st-drawing-area.h \
|
st/st-drawing-area.h \
|
||||||
st/st-entry.h \
|
st/st-entry.h \
|
||||||
st/st-focus-manager.h \
|
st/st-focus-manager.h \
|
||||||
st/st-group.h \
|
|
||||||
st/st-icon.h \
|
st/st-icon.h \
|
||||||
st/st-icon-colors.h \
|
st/st-icon-colors.h \
|
||||||
st/st-im-text.h \
|
st/st-im-text.h \
|
||||||
@ -109,7 +108,6 @@ st_source_c = \
|
|||||||
st/st-drawing-area.c \
|
st/st-drawing-area.c \
|
||||||
st/st-entry.c \
|
st/st-entry.c \
|
||||||
st/st-focus-manager.c \
|
st/st-focus-manager.c \
|
||||||
st/st-group.c \
|
|
||||||
st/st-icon.c \
|
st/st-icon.c \
|
||||||
st/st-icon-colors.c \
|
st/st-icon-colors.c \
|
||||||
st/st-im-text.c \
|
st/st-im-text.c \
|
||||||
|
@ -1,237 +0,0 @@
|
|||||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
||||||
/*
|
|
||||||
* st-group.c: A fixed layout container based on ClutterGroup
|
|
||||||
*
|
|
||||||
* Copyright 2010 Florian Müllner
|
|
||||||
* Copyright 2010 Intel Corporation
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU Lesser General Public License,
|
|
||||||
* version 2.1, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT ANY
|
|
||||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:st-group
|
|
||||||
* @see_also:#ClutterGroup
|
|
||||||
* @short_description: A fixed layout container
|
|
||||||
*
|
|
||||||
* A #StGroup is an Actor which contains multiple child actors positioned
|
|
||||||
* relative to the #StGroup position. Other operations such as scaling,
|
|
||||||
* rotating and clipping of the group will apply to the child actors.
|
|
||||||
*
|
|
||||||
* A #StGroup's size is defined by the size and position of its children;
|
|
||||||
* it will be the smallest non-negative size that covers the right and bottom
|
|
||||||
* edges of all of its children.
|
|
||||||
*
|
|
||||||
* Setting the size on a Group using #ClutterActor methods like
|
|
||||||
* clutter_actor_set_size() will override the natural size of the Group,
|
|
||||||
* however this will not affect the size of the children and they may still
|
|
||||||
* be painted outside of the allocation of the group. One way to constrain
|
|
||||||
* the visible area of a #StGroup to a specified allocation is to
|
|
||||||
* explicitly set the size of the #StGroup and then use the
|
|
||||||
* #ClutterActor:clip-to-allocation property.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <clutter/clutter.h>
|
|
||||||
|
|
||||||
#include "st-group.h"
|
|
||||||
#include "st-enum-types.h"
|
|
||||||
#include "st-private.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (StGroup, st_group, ST_TYPE_CONTAINER);
|
|
||||||
|
|
||||||
static void
|
|
||||||
st_group_get_preferred_width (ClutterActor *actor,
|
|
||||||
gfloat for_height,
|
|
||||||
gfloat *min_width_p,
|
|
||||||
gfloat *natural_width_p)
|
|
||||||
{
|
|
||||||
StThemeNode *node = st_widget_get_theme_node (ST_WIDGET (actor));
|
|
||||||
gdouble min_width, natural_width;
|
|
||||||
gint css_width, css_min_width, css_max_width;
|
|
||||||
ClutterActor *child;
|
|
||||||
|
|
||||||
css_width = st_theme_node_get_width (node);
|
|
||||||
css_min_width = st_theme_node_get_min_width (node);
|
|
||||||
css_max_width = st_theme_node_get_max_width (node);
|
|
||||||
|
|
||||||
/* We will always be at least 0 sized (ie, if all of the actors are
|
|
||||||
* to the left of the origin we won't return a negative size)
|
|
||||||
*/
|
|
||||||
min_width = 0;
|
|
||||||
natural_width = 0;
|
|
||||||
|
|
||||||
for (child = clutter_actor_get_first_child (actor);
|
|
||||||
child != NULL;
|
|
||||||
child = clutter_actor_get_next_sibling (child))
|
|
||||||
{
|
|
||||||
gfloat child_x, child_min, child_nat;
|
|
||||||
|
|
||||||
child_x = clutter_actor_get_x (child);
|
|
||||||
|
|
||||||
/* for_height is irrelevant to the fixed layout, so it's not used */
|
|
||||||
_st_actor_get_preferred_width (child, -1, FALSE,
|
|
||||||
&child_min, &child_nat);
|
|
||||||
|
|
||||||
/* Track the rightmost edge */
|
|
||||||
if (child_x + child_min > min_width)
|
|
||||||
min_width = child_x + child_min;
|
|
||||||
|
|
||||||
if (child_x + child_nat > natural_width)
|
|
||||||
natural_width = child_x + child_nat;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The size is defined as the distance from the origin to the right-hand
|
|
||||||
* edge of the rightmost actor, unless overridden with min-width
|
|
||||||
*/
|
|
||||||
if (min_width_p)
|
|
||||||
{
|
|
||||||
if (css_min_width != -1)
|
|
||||||
*min_width_p = css_min_width;
|
|
||||||
else
|
|
||||||
*min_width_p = min_width;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (natural_width_p)
|
|
||||||
{
|
|
||||||
if (css_width != -1)
|
|
||||||
natural_width = css_width;
|
|
||||||
*natural_width_p = MIN (natural_width, css_max_width);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
st_group_get_preferred_height (ClutterActor *actor,
|
|
||||||
gfloat for_width,
|
|
||||||
gfloat *min_height_p,
|
|
||||||
gfloat *natural_height_p)
|
|
||||||
{
|
|
||||||
StThemeNode *node = st_widget_get_theme_node (ST_WIDGET (actor));
|
|
||||||
gdouble min_height, natural_height;
|
|
||||||
gint css_height, css_min_height, css_max_height;
|
|
||||||
ClutterActor *child;
|
|
||||||
|
|
||||||
css_height = st_theme_node_get_height (node);
|
|
||||||
css_min_height = st_theme_node_get_min_height (node);
|
|
||||||
css_max_height = st_theme_node_get_max_height (node);
|
|
||||||
|
|
||||||
/* We will always be at least 0 sized (ie, if all of the actors are
|
|
||||||
* above of the origin we won't return a negative size)
|
|
||||||
*/
|
|
||||||
min_height = 0;
|
|
||||||
natural_height = 0;
|
|
||||||
|
|
||||||
for (child = clutter_actor_get_first_child (actor);
|
|
||||||
child != NULL;
|
|
||||||
child = clutter_actor_get_next_sibling (child))
|
|
||||||
{
|
|
||||||
gfloat child_y, child_min, child_nat;
|
|
||||||
|
|
||||||
child_y = clutter_actor_get_y (child);
|
|
||||||
|
|
||||||
/* for_width is irrelevant to the fixed layout, so it's not used */
|
|
||||||
_st_actor_get_preferred_height (child, -1, FALSE,
|
|
||||||
&child_min, &child_nat);
|
|
||||||
|
|
||||||
/* Track the bottommost edge */
|
|
||||||
if (child_y + child_min > min_height)
|
|
||||||
min_height = child_y + child_min;
|
|
||||||
|
|
||||||
if (child_y + child_nat > natural_height)
|
|
||||||
natural_height = child_y + child_nat;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The size is defined as the distance from the origin to the right-hand
|
|
||||||
* edge of the rightmost actor, unless overridden with min-height
|
|
||||||
*/
|
|
||||||
if (min_height_p)
|
|
||||||
{
|
|
||||||
if (css_min_height != -1)
|
|
||||||
*min_height_p = css_min_height;
|
|
||||||
else
|
|
||||||
*min_height_p = min_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (natural_height_p)
|
|
||||||
{
|
|
||||||
if (css_height != -1)
|
|
||||||
natural_height = css_height;
|
|
||||||
*natural_height_p = MIN (natural_height, css_max_height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
st_group_allocate (ClutterActor *actor,
|
|
||||||
const ClutterActorBox *box,
|
|
||||||
ClutterAllocationFlags flags)
|
|
||||||
{
|
|
||||||
ClutterActor *child;
|
|
||||||
|
|
||||||
CLUTTER_ACTOR_CLASS (st_group_parent_class)->allocate (actor, box, flags);
|
|
||||||
|
|
||||||
for (child = clutter_actor_get_first_child (actor);
|
|
||||||
child != NULL;
|
|
||||||
child = clutter_actor_get_next_sibling (child))
|
|
||||||
clutter_actor_allocate_preferred_size (child, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
st_group_show_all (ClutterActor *actor)
|
|
||||||
{
|
|
||||||
clutter_container_foreach (CLUTTER_CONTAINER (actor),
|
|
||||||
CLUTTER_CALLBACK (clutter_actor_show),
|
|
||||||
NULL);
|
|
||||||
clutter_actor_show (actor);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
st_group_hide_all (ClutterActor *actor)
|
|
||||||
{
|
|
||||||
clutter_actor_hide (actor);
|
|
||||||
clutter_container_foreach (CLUTTER_CONTAINER (actor),
|
|
||||||
CLUTTER_CALLBACK (clutter_actor_hide),
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
st_group_class_init (StGroupClass *klass)
|
|
||||||
{
|
|
||||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
|
||||||
|
|
||||||
actor_class->get_preferred_width = st_group_get_preferred_width;
|
|
||||||
actor_class->get_preferred_height = st_group_get_preferred_height;
|
|
||||||
actor_class->allocate = st_group_allocate;
|
|
||||||
actor_class->show_all = st_group_show_all;
|
|
||||||
actor_class->hide_all = st_group_hide_all;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
st_group_init (StGroup *self)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* st_group_new:
|
|
||||||
*
|
|
||||||
* Create a new #StGroup.
|
|
||||||
*
|
|
||||||
* Return value: the newly created #StGroup actor
|
|
||||||
*/
|
|
||||||
StWidget *
|
|
||||||
st_group_new (void)
|
|
||||||
{
|
|
||||||
return g_object_new (ST_TYPE_GROUP, NULL);
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
||||||
/*
|
|
||||||
* st-group.h: A fixed layout container based on ClutterGroup
|
|
||||||
*
|
|
||||||
* Copyright 2010 Florian Müllner
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU Lesser General Public License,
|
|
||||||
* version 2.1, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT ANY
|
|
||||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(ST_H_INSIDE) && !defined(ST_COMPILATION)
|
|
||||||
#error "Only <st/st.h> can be included directly.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __ST_GROUP_H__
|
|
||||||
#define __ST_GROUP_H__
|
|
||||||
|
|
||||||
#include <st/st-types.h>
|
|
||||||
#include <st/st-container.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define ST_TYPE_GROUP (st_group_get_type ())
|
|
||||||
#define ST_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ST_TYPE_GROUP, StGroup))
|
|
||||||
#define ST_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ST_TYPE_GROUP))
|
|
||||||
#define ST_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ST_TYPE_GROUP, StGroupClass))
|
|
||||||
#define ST_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ST_TYPE_GROUP))
|
|
||||||
#define ST_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ST_TYPE_GROUP, StGroupClass))
|
|
||||||
|
|
||||||
typedef struct _StGroup StGroup;
|
|
||||||
typedef struct _StGroupPrivate StGroupPrivate;
|
|
||||||
typedef struct _StGroupClass StGroupClass;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* StGroup:
|
|
||||||
*
|
|
||||||
* The #StGroup struct contains only private data
|
|
||||||
*/
|
|
||||||
struct _StGroup
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
StContainer parent_instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* StGroupClass:
|
|
||||||
*
|
|
||||||
* The #StGroupClass struct contains only private data
|
|
||||||
*/
|
|
||||||
struct _StGroupClass
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
StContainerClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
GType st_group_get_type (void) G_GNUC_CONST;
|
|
||||||
StWidget *st_group_new (void);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __ST_GROUP_H__ */
|
|
Loading…
Reference in New Issue
Block a user