a11y: Make DashItemContainer._label public

https://bugzilla.gnome.org/show_bug.cgi?id=644255
This commit is contained in:
Alejandro Piñeiro 2012-03-15 20:18:53 +01:00
parent 01c66eaf0c
commit c064973c9d

View File

@ -36,7 +36,7 @@ const DashItemContainer = new Lang.Class({
Lang.bind(this, this._allocate)); Lang.bind(this, this._allocate));
this.actor._delegate = this; this.actor._delegate = this;
this._label = null; this.label = null;
this.child = null; this.child = null;
this._childScale = 1; this._childScale = 1;
@ -91,32 +91,32 @@ const DashItemContainer = new Lang.Class({
}, },
showLabel: function() { showLabel: function() {
if (this._label == null) if (this.label == null)
return; return;
this._label.opacity = 0; this.label.opacity = 0;
this._label.show(); this.label.show();
let [stageX, stageY] = this.actor.get_transformed_position(); let [stageX, stageY] = this.actor.get_transformed_position();
let itemHeight = this.actor.allocation.y2 - this.actor.allocation.y1; let itemHeight = this.actor.allocation.y2 - this.actor.allocation.y1;
let labelHeight = this._label.get_height(); let labelHeight = this.label.get_height();
let yOffset = Math.floor((itemHeight - labelHeight) / 2) let yOffset = Math.floor((itemHeight - labelHeight) / 2)
let y = stageY + yOffset; let y = stageY + yOffset;
let node = this._label.get_theme_node(); let node = this.label.get_theme_node();
let xOffset = node.get_length('-x-offset'); let xOffset = node.get_length('-x-offset');
let x; let x;
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
x = stageX - this._label.get_width() - xOffset; x = stageX - this.label.get_width() - xOffset;
else else
x = stageX + this.actor.get_width() + xOffset; x = stageX + this.actor.get_width() + xOffset;
this._label.set_position(x, y); this.label.set_position(x, y);
Tweener.addTween(this._label, Tweener.addTween(this.label,
{ opacity: 255, { opacity: 255,
time: DASH_ITEM_LABEL_SHOW_TIME, time: DASH_ITEM_LABEL_SHOW_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
@ -124,22 +124,22 @@ const DashItemContainer = new Lang.Class({
}, },
setLabelText: function(text) { setLabelText: function(text) {
if (this._label == null) if (this.label == null)
this._label = new St.Label({ style_class: 'dash-label'}); this.label = new St.Label({ style_class: 'dash-label'});
this._label.set_text(text); this.label.set_text(text);
Main.layoutManager.addChrome(this._label); Main.layoutManager.addChrome(this.label);
this._label.hide(); this.label.hide();
}, },
hideLabel: function () { hideLabel: function () {
this._label.opacity = 255; this.label.opacity = 255;
Tweener.addTween(this._label, Tweener.addTween(this.label,
{ opacity: 0, { opacity: 0,
time: DASH_ITEM_LABEL_HIDE_TIME, time: DASH_ITEM_LABEL_HIDE_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() { onComplete: Lang.bind(this, function() {
this._label.hide(); this.label.hide();
}) })
}); });
}, },