2011-09-28 09:16:26 -04:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
2019-01-31 09:07:06 -05:00
|
|
|
/* exported BoxPointer */
|
2010-05-04 14:32:28 -04:00
|
|
|
|
2021-06-28 05:57:05 -04:00
|
|
|
const { Clutter, GObject, Meta, St } = imports.gi;
|
2010-05-04 14:32:28 -04:00
|
|
|
|
2011-06-13 09:54:05 -04:00
|
|
|
const Main = imports.ui.main;
|
2010-10-15 00:53:34 -04:00
|
|
|
|
2017-07-18 13:47:27 -04:00
|
|
|
var PopupAnimation = {
|
2012-06-15 13:16:10 -04:00
|
|
|
NONE: 0,
|
|
|
|
SLIDE: 1 << 0,
|
|
|
|
FADE: 1 << 1,
|
|
|
|
FULL: ~0,
|
|
|
|
};
|
|
|
|
|
2019-08-01 19:13:10 -04:00
|
|
|
var POPUP_ANIMATION_TIME = 150;
|
2010-10-15 00:53:34 -04:00
|
|
|
|
2010-05-04 14:32:28 -04:00
|
|
|
/**
|
|
|
|
* BoxPointer:
|
2010-11-22 14:10:42 -05:00
|
|
|
* @side: side to draw the arrow on
|
2010-05-04 14:32:28 -04:00
|
|
|
* @binProperties: Properties to set on contained bin
|
|
|
|
*
|
|
|
|
* An actor which displays a triangle "arrow" pointing to a given
|
|
|
|
* side. The .bin property is a container in which content can be
|
2012-06-14 13:43:15 -04:00
|
|
|
* placed. The arrow position may be controlled via
|
|
|
|
* setArrowOrigin(). The arrow side might be temporarily flipped
|
|
|
|
* depending on the box size and source position to keep the box
|
2019-03-22 08:31:48 -04:00
|
|
|
* totally inside the monitor workarea if possible.
|
2010-05-04 14:32:28 -04:00
|
|
|
*
|
|
|
|
*/
|
2017-10-30 21:23:39 -04:00
|
|
|
var BoxPointer = GObject.registerClass({
|
2018-08-21 06:38:23 -04:00
|
|
|
Signals: { 'arrow-side-changed': {} },
|
2017-10-30 21:23:39 -04:00
|
|
|
}, class BoxPointer extends St.Widget {
|
2017-10-30 20:03:21 -04:00
|
|
|
_init(arrowSide, binProperties) {
|
2017-10-30 21:23:39 -04:00
|
|
|
super._init();
|
2018-08-21 06:38:23 -04:00
|
|
|
|
2020-02-25 22:53:40 -05:00
|
|
|
this.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS);
|
2018-08-21 06:38:23 -04:00
|
|
|
|
2010-05-04 14:32:28 -04:00
|
|
|
this._arrowSide = arrowSide;
|
2012-06-14 13:43:15 -04:00
|
|
|
this._userArrowSide = arrowSide;
|
2010-05-04 14:32:28 -04:00
|
|
|
this._arrowOrigin = 0;
|
2013-02-20 08:13:46 -05:00
|
|
|
this._arrowActor = null;
|
2010-05-04 14:32:28 -04:00
|
|
|
this.bin = new St.Bin(binProperties);
|
2018-08-21 06:38:23 -04:00
|
|
|
this.add_actor(this.bin);
|
2010-05-04 14:32:28 -04:00
|
|
|
this._border = new St.DrawingArea();
|
2017-12-01 19:27:35 -05:00
|
|
|
this._border.connect('repaint', this._drawBorder.bind(this));
|
2018-08-21 06:38:23 -04:00
|
|
|
this.add_actor(this._border);
|
2019-11-05 14:17:19 -05:00
|
|
|
this.set_child_above_sibling(this.bin, this._border);
|
2011-09-14 18:14:03 -04:00
|
|
|
this._sourceAlignment = 0.5;
|
2019-09-10 01:42:48 -04:00
|
|
|
this._muteInput = true;
|
2019-06-13 12:57:38 -04:00
|
|
|
|
2021-06-28 05:57:05 -04:00
|
|
|
this.connect('notify::visible', () => {
|
|
|
|
if (this.visible)
|
|
|
|
Meta.disable_unredirect_for_display(global.display);
|
|
|
|
else
|
|
|
|
Meta.enable_unredirect_for_display(global.display);
|
|
|
|
});
|
|
|
|
|
2019-06-13 12:57:38 -04:00
|
|
|
this.connect('destroy', this._onDestroy.bind(this));
|
|
|
|
}
|
|
|
|
|
2019-09-10 01:42:48 -04:00
|
|
|
vfunc_captured_event() {
|
|
|
|
if (this._muteInput)
|
|
|
|
return Clutter.EVENT_STOP;
|
|
|
|
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
}
|
|
|
|
|
2019-06-13 12:57:38 -04:00
|
|
|
_onDestroy() {
|
|
|
|
if (this._sourceActorDestroyId) {
|
|
|
|
this._sourceActor.disconnect(this._sourceActorDestroyId);
|
|
|
|
delete this._sourceActorDestroyId;
|
|
|
|
}
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2012-01-17 21:31:03 -05:00
|
|
|
|
2013-09-10 05:48:55 -04:00
|
|
|
get arrowSide() {
|
|
|
|
return this._arrowSide;
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2013-09-10 05:48:55 -04:00
|
|
|
|
2018-08-21 06:29:44 -04:00
|
|
|
open(animate, onComplete) {
|
2018-08-21 06:38:23 -04:00
|
|
|
let themeNode = this.get_theme_node();
|
StThemeNode: simplify use of get_color/get_double/get_length
Although within St itself there are situations where the semantics of
these functions (return TRUE or FALSE and return the actual value in
an out parameter) is useful, it's mostly just annoying at the
application level, where you generally know that the CSS property is
going to specified, and there is no especially sane fallback if it's
not.
So rename the current methods to lookup_color, lookup_double, and
lookup_length, and add new get_color, get_double, and get_length
methods that don't take an "inherit" parameter, and return their
values directly. (Well, except for get_color, due to the lack of (out
caller-allocates) in gjs.)
And update the code to use either the old or new methods as appropriate.
https://bugzilla.gnome.org/show_bug.cgi?id=632590
2010-09-26 17:38:36 -04:00
|
|
|
let rise = themeNode.get_length('-arrow-rise');
|
2019-08-19 15:38:51 -04:00
|
|
|
let animationTime = animate & PopupAnimation.FULL ? POPUP_ANIMATION_TIME : 0;
|
2012-06-15 13:16:10 -04:00
|
|
|
|
|
|
|
if (animate & PopupAnimation.FADE)
|
|
|
|
this.opacity = 0;
|
|
|
|
else
|
|
|
|
this.opacity = 255;
|
2010-10-15 00:53:34 -04:00
|
|
|
|
2018-08-21 06:38:23 -04:00
|
|
|
this.show();
|
2010-10-15 00:53:34 -04:00
|
|
|
|
2012-06-15 13:16:10 -04:00
|
|
|
if (animate & PopupAnimation.SLIDE) {
|
2010-11-18 16:18:54 -05:00
|
|
|
switch (this._arrowSide) {
|
2019-02-01 07:21:00 -05:00
|
|
|
case St.Side.TOP:
|
|
|
|
this.translation_y = -rise;
|
|
|
|
break;
|
|
|
|
case St.Side.BOTTOM:
|
|
|
|
this.translation_y = rise;
|
|
|
|
break;
|
|
|
|
case St.Side.LEFT:
|
|
|
|
this.translation_x = -rise;
|
|
|
|
break;
|
|
|
|
case St.Side.RIGHT:
|
|
|
|
this.translation_x = rise;
|
|
|
|
break;
|
2010-11-18 16:18:54 -05:00
|
|
|
}
|
2010-10-15 00:53:34 -04:00
|
|
|
}
|
|
|
|
|
2018-07-20 15:46:19 -04:00
|
|
|
this.ease({
|
|
|
|
opacity: 255,
|
|
|
|
translation_x: 0,
|
|
|
|
translation_y: 0,
|
|
|
|
duration: animationTime,
|
|
|
|
mode: Clutter.AnimationMode.LINEAR,
|
|
|
|
onComplete: () => {
|
2019-09-10 01:42:48 -04:00
|
|
|
this._muteInput = false;
|
2018-07-20 15:46:19 -04:00
|
|
|
if (onComplete)
|
|
|
|
onComplete();
|
2019-08-20 17:43:54 -04:00
|
|
|
},
|
2018-07-20 15:46:19 -04:00
|
|
|
});
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2010-10-15 00:53:34 -04:00
|
|
|
|
2018-08-21 06:29:44 -04:00
|
|
|
close(animate, onComplete) {
|
2018-08-21 06:38:23 -04:00
|
|
|
if (!this.visible)
|
2013-11-19 22:39:39 -05:00
|
|
|
return;
|
|
|
|
|
2019-03-04 18:38:32 -05:00
|
|
|
let translationX = 0;
|
|
|
|
let translationY = 0;
|
2018-08-21 06:38:23 -04:00
|
|
|
let themeNode = this.get_theme_node();
|
StThemeNode: simplify use of get_color/get_double/get_length
Although within St itself there are situations where the semantics of
these functions (return TRUE or FALSE and return the actual value in
an out parameter) is useful, it's mostly just annoying at the
application level, where you generally know that the CSS property is
going to specified, and there is no especially sane fallback if it's
not.
So rename the current methods to lookup_color, lookup_double, and
lookup_length, and add new get_color, get_double, and get_length
methods that don't take an "inherit" parameter, and return their
values directly. (Well, except for get_color, due to the lack of (out
caller-allocates) in gjs.)
And update the code to use either the old or new methods as appropriate.
https://bugzilla.gnome.org/show_bug.cgi?id=632590
2010-09-26 17:38:36 -04:00
|
|
|
let rise = themeNode.get_length('-arrow-rise');
|
2019-08-19 15:38:51 -04:00
|
|
|
let fade = animate & PopupAnimation.FADE;
|
|
|
|
let animationTime = animate & PopupAnimation.FULL ? POPUP_ANIMATION_TIME : 0;
|
2010-10-15 00:53:34 -04:00
|
|
|
|
2012-06-15 13:16:10 -04:00
|
|
|
if (animate & PopupAnimation.SLIDE) {
|
2010-11-18 16:18:54 -05:00
|
|
|
switch (this._arrowSide) {
|
2019-02-01 07:21:00 -05:00
|
|
|
case St.Side.TOP:
|
|
|
|
translationY = rise;
|
|
|
|
break;
|
|
|
|
case St.Side.BOTTOM:
|
|
|
|
translationY = -rise;
|
|
|
|
break;
|
|
|
|
case St.Side.LEFT:
|
|
|
|
translationX = rise;
|
|
|
|
break;
|
|
|
|
case St.Side.RIGHT:
|
|
|
|
translationX = -rise;
|
|
|
|
break;
|
2010-11-18 16:18:54 -05:00
|
|
|
}
|
2010-10-15 00:53:34 -04:00
|
|
|
}
|
|
|
|
|
2019-09-10 01:42:48 -04:00
|
|
|
this._muteInput = true;
|
2012-01-17 21:31:03 -05:00
|
|
|
|
2018-07-20 15:46:19 -04:00
|
|
|
this.remove_all_transitions();
|
|
|
|
this.ease({
|
|
|
|
opacity: fade ? 0 : 255,
|
|
|
|
translation_x: translationX,
|
|
|
|
translation_y: translationY,
|
|
|
|
duration: animationTime,
|
|
|
|
mode: Clutter.AnimationMode.LINEAR,
|
|
|
|
onComplete: () => {
|
|
|
|
this.hide();
|
|
|
|
this.opacity = 0;
|
|
|
|
this.translation_x = 0;
|
|
|
|
this.translation_y = 0;
|
|
|
|
if (onComplete)
|
|
|
|
onComplete();
|
2019-08-20 17:43:54 -04:00
|
|
|
},
|
2018-07-20 15:46:19 -04:00
|
|
|
});
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2010-10-15 00:53:34 -04:00
|
|
|
|
2018-08-21 06:38:23 -04:00
|
|
|
_adjustAllocationForArrow(isWidth, minSize, natSize) {
|
|
|
|
let themeNode = this.get_theme_node();
|
StThemeNode: simplify use of get_color/get_double/get_length
Although within St itself there are situations where the semantics of
these functions (return TRUE or FALSE and return the actual value in
an out parameter) is useful, it's mostly just annoying at the
application level, where you generally know that the CSS property is
going to specified, and there is no especially sane fallback if it's
not.
So rename the current methods to lookup_color, lookup_double, and
lookup_length, and add new get_color, get_double, and get_length
methods that don't take an "inherit" parameter, and return their
values directly. (Well, except for get_color, due to the lack of (out
caller-allocates) in gjs.)
And update the code to use either the old or new methods as appropriate.
https://bugzilla.gnome.org/show_bug.cgi?id=632590
2010-09-26 17:38:36 -04:00
|
|
|
let borderWidth = themeNode.get_length('-arrow-border-width');
|
2018-08-21 06:38:23 -04:00
|
|
|
minSize += borderWidth * 2;
|
|
|
|
natSize += borderWidth * 2;
|
2019-08-19 15:33:15 -04:00
|
|
|
if ((!isWidth && (this._arrowSide == St.Side.TOP || this._arrowSide == St.Side.BOTTOM)) ||
|
|
|
|
(isWidth && (this._arrowSide == St.Side.LEFT || this._arrowSide == St.Side.RIGHT))) {
|
StThemeNode: simplify use of get_color/get_double/get_length
Although within St itself there are situations where the semantics of
these functions (return TRUE or FALSE and return the actual value in
an out parameter) is useful, it's mostly just annoying at the
application level, where you generally know that the CSS property is
going to specified, and there is no especially sane fallback if it's
not.
So rename the current methods to lookup_color, lookup_double, and
lookup_length, and add new get_color, get_double, and get_length
methods that don't take an "inherit" parameter, and return their
values directly. (Well, except for get_color, due to the lack of (out
caller-allocates) in gjs.)
And update the code to use either the old or new methods as appropriate.
https://bugzilla.gnome.org/show_bug.cgi?id=632590
2010-09-26 17:38:36 -04:00
|
|
|
let rise = themeNode.get_length('-arrow-rise');
|
2018-08-21 06:38:23 -04:00
|
|
|
minSize += rise;
|
|
|
|
natSize += rise;
|
2010-05-04 14:32:28 -04:00
|
|
|
}
|
2018-08-21 06:38:23 -04:00
|
|
|
|
|
|
|
return [minSize, natSize];
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2010-05-04 14:32:28 -04:00
|
|
|
|
2018-08-21 06:38:23 -04:00
|
|
|
vfunc_get_preferred_width(forHeight) {
|
|
|
|
let themeNode = this.get_theme_node();
|
|
|
|
forHeight = themeNode.adjust_for_height(forHeight);
|
|
|
|
|
|
|
|
let width = this.bin.get_preferred_width(forHeight);
|
|
|
|
width = this._adjustAllocationForArrow(true, ...width);
|
|
|
|
|
|
|
|
return themeNode.adjust_preferred_width(...width);
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2010-05-04 14:32:28 -04:00
|
|
|
|
2018-08-21 06:38:23 -04:00
|
|
|
vfunc_get_preferred_height(forWidth) {
|
|
|
|
let themeNode = this.get_theme_node();
|
2013-10-06 17:32:51 -04:00
|
|
|
let borderWidth = themeNode.get_length('-arrow-border-width');
|
2018-08-21 06:38:23 -04:00
|
|
|
forWidth = themeNode.adjust_for_width(forWidth);
|
|
|
|
|
|
|
|
let height = this.bin.get_preferred_height(forWidth - 2 * borderWidth);
|
|
|
|
height = this._adjustAllocationForArrow(false, ...height);
|
|
|
|
|
|
|
|
return themeNode.adjust_preferred_height(...height);
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2010-05-04 14:32:28 -04:00
|
|
|
|
2020-05-09 15:30:26 -04:00
|
|
|
vfunc_allocate(box) {
|
2020-03-10 06:05:13 -04:00
|
|
|
if (this._sourceActor && this._sourceActor.mapped) {
|
|
|
|
this._reposition(box);
|
|
|
|
this._updateFlip(box);
|
|
|
|
}
|
|
|
|
|
2020-05-09 15:30:26 -04:00
|
|
|
this.set_allocation(box);
|
2018-08-21 06:38:23 -04:00
|
|
|
|
|
|
|
let themeNode = this.get_theme_node();
|
StThemeNode: simplify use of get_color/get_double/get_length
Although within St itself there are situations where the semantics of
these functions (return TRUE or FALSE and return the actual value in
an out parameter) is useful, it's mostly just annoying at the
application level, where you generally know that the CSS property is
going to specified, and there is no especially sane fallback if it's
not.
So rename the current methods to lookup_color, lookup_double, and
lookup_length, and add new get_color, get_double, and get_length
methods that don't take an "inherit" parameter, and return their
values directly. (Well, except for get_color, due to the lack of (out
caller-allocates) in gjs.)
And update the code to use either the old or new methods as appropriate.
https://bugzilla.gnome.org/show_bug.cgi?id=632590
2010-09-26 17:38:36 -04:00
|
|
|
let borderWidth = themeNode.get_length('-arrow-border-width');
|
|
|
|
let rise = themeNode.get_length('-arrow-rise');
|
2010-05-04 14:32:28 -04:00
|
|
|
let childBox = new Clutter.ActorBox();
|
2019-06-13 13:24:01 -04:00
|
|
|
let [availWidth, availHeight] = themeNode.get_content_box(box).get_size();
|
2010-05-04 14:32:28 -04:00
|
|
|
|
2010-05-19 13:26:41 -04:00
|
|
|
childBox.x1 = 0;
|
2010-05-04 14:32:28 -04:00
|
|
|
childBox.y1 = 0;
|
|
|
|
childBox.x2 = availWidth;
|
|
|
|
childBox.y2 = availHeight;
|
2020-05-09 15:30:26 -04:00
|
|
|
this._border.allocate(childBox);
|
2010-05-20 11:18:46 -04:00
|
|
|
|
|
|
|
childBox.x1 = borderWidth;
|
|
|
|
childBox.y1 = borderWidth;
|
|
|
|
childBox.x2 = availWidth - borderWidth;
|
|
|
|
childBox.y2 = availHeight - borderWidth;
|
2010-05-04 14:32:28 -04:00
|
|
|
switch (this._arrowSide) {
|
2019-02-01 07:21:00 -05:00
|
|
|
case St.Side.TOP:
|
|
|
|
childBox.y1 += rise;
|
|
|
|
break;
|
|
|
|
case St.Side.BOTTOM:
|
|
|
|
childBox.y2 -= rise;
|
|
|
|
break;
|
|
|
|
case St.Side.LEFT:
|
|
|
|
childBox.x1 += rise;
|
|
|
|
break;
|
|
|
|
case St.Side.RIGHT:
|
|
|
|
childBox.x2 -= rise;
|
|
|
|
break;
|
2010-05-04 14:32:28 -04:00
|
|
|
}
|
2020-05-09 15:30:26 -04:00
|
|
|
this.bin.allocate(childBox);
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2010-05-04 14:32:28 -04:00
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
_drawBorder(area) {
|
2018-08-21 06:38:23 -04:00
|
|
|
let themeNode = this.get_theme_node();
|
2010-05-04 14:32:28 -04:00
|
|
|
|
2013-02-20 08:13:46 -05:00
|
|
|
if (this._arrowActor) {
|
|
|
|
let [sourceX, sourceY] = this._arrowActor.get_transformed_position();
|
|
|
|
let [sourceWidth, sourceHeight] = this._arrowActor.get_transformed_size();
|
2018-08-21 06:38:23 -04:00
|
|
|
let [absX, absY] = this.get_transformed_position();
|
2013-02-20 08:13:46 -05:00
|
|
|
|
|
|
|
if (this._arrowSide == St.Side.TOP ||
|
2019-08-19 20:51:42 -04:00
|
|
|
this._arrowSide == St.Side.BOTTOM)
|
2013-02-20 08:13:46 -05:00
|
|
|
this._arrowOrigin = sourceX - absX + sourceWidth / 2;
|
2019-08-19 20:51:42 -04:00
|
|
|
else
|
2013-02-20 08:13:46 -05:00
|
|
|
this._arrowOrigin = sourceY - absY + sourceHeight / 2;
|
|
|
|
}
|
|
|
|
|
StThemeNode: simplify use of get_color/get_double/get_length
Although within St itself there are situations where the semantics of
these functions (return TRUE or FALSE and return the actual value in
an out parameter) is useful, it's mostly just annoying at the
application level, where you generally know that the CSS property is
going to specified, and there is no especially sane fallback if it's
not.
So rename the current methods to lookup_color, lookup_double, and
lookup_length, and add new get_color, get_double, and get_length
methods that don't take an "inherit" parameter, and return their
values directly. (Well, except for get_color, due to the lack of (out
caller-allocates) in gjs.)
And update the code to use either the old or new methods as appropriate.
https://bugzilla.gnome.org/show_bug.cgi?id=632590
2010-09-26 17:38:36 -04:00
|
|
|
let borderWidth = themeNode.get_length('-arrow-border-width');
|
|
|
|
let base = themeNode.get_length('-arrow-base');
|
|
|
|
let rise = themeNode.get_length('-arrow-rise');
|
|
|
|
let borderRadius = themeNode.get_length('-arrow-border-radius');
|
2010-05-04 14:32:28 -04:00
|
|
|
|
|
|
|
let halfBorder = borderWidth / 2;
|
2019-01-28 20:27:05 -05:00
|
|
|
let halfBase = Math.floor(base / 2);
|
2010-05-04 14:32:28 -04:00
|
|
|
|
2011-02-14 09:20:22 -05:00
|
|
|
let backgroundColor = themeNode.get_color('-arrow-background-color');
|
2010-05-04 14:32:28 -04:00
|
|
|
|
|
|
|
let [width, height] = area.get_surface_size();
|
|
|
|
let [boxWidth, boxHeight] = [width, height];
|
2019-08-19 20:51:42 -04:00
|
|
|
if (this._arrowSide == St.Side.TOP || this._arrowSide == St.Side.BOTTOM)
|
2010-05-04 14:32:28 -04:00
|
|
|
boxHeight -= rise;
|
2019-08-19 20:51:42 -04:00
|
|
|
else
|
2010-05-04 14:32:28 -04:00
|
|
|
boxWidth -= rise;
|
2019-08-19 20:51:42 -04:00
|
|
|
|
2010-05-04 14:32:28 -04:00
|
|
|
let cr = area.get_context();
|
2010-05-20 11:18:46 -04:00
|
|
|
|
|
|
|
// Translate so that box goes from 0,0 to boxWidth,boxHeight,
|
|
|
|
// with the arrow poking out of that
|
2019-08-19 20:51:42 -04:00
|
|
|
if (this._arrowSide == St.Side.TOP)
|
2010-05-04 14:32:28 -04:00
|
|
|
cr.translate(0, rise);
|
2019-08-19 20:51:42 -04:00
|
|
|
else if (this._arrowSide == St.Side.LEFT)
|
2010-05-20 11:18:46 -04:00
|
|
|
cr.translate(rise, 0);
|
|
|
|
|
2011-01-28 03:19:54 -05:00
|
|
|
let [x1, y1] = [halfBorder, halfBorder];
|
|
|
|
let [x2, y2] = [boxWidth - halfBorder, boxHeight - halfBorder];
|
2010-05-20 11:18:46 -04:00
|
|
|
|
2012-09-01 10:42:50 -04:00
|
|
|
let skipTopLeft = false;
|
|
|
|
let skipTopRight = false;
|
|
|
|
let skipBottomLeft = false;
|
|
|
|
let skipBottomRight = false;
|
|
|
|
|
2013-10-01 02:53:13 -04:00
|
|
|
if (rise) {
|
|
|
|
switch (this._arrowSide) {
|
|
|
|
case St.Side.TOP:
|
|
|
|
if (this._arrowOrigin == x1)
|
|
|
|
skipTopLeft = true;
|
|
|
|
else if (this._arrowOrigin == x2)
|
|
|
|
skipTopRight = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case St.Side.RIGHT:
|
|
|
|
if (this._arrowOrigin == y1)
|
|
|
|
skipTopRight = true;
|
|
|
|
else if (this._arrowOrigin == y2)
|
|
|
|
skipBottomRight = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case St.Side.BOTTOM:
|
|
|
|
if (this._arrowOrigin == x1)
|
|
|
|
skipBottomLeft = true;
|
|
|
|
else if (this._arrowOrigin == x2)
|
|
|
|
skipBottomRight = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case St.Side.LEFT:
|
|
|
|
if (this._arrowOrigin == y1)
|
|
|
|
skipTopLeft = true;
|
|
|
|
else if (this._arrowOrigin == y2)
|
|
|
|
skipBottomLeft = true;
|
|
|
|
break;
|
|
|
|
}
|
2012-09-01 10:42:50 -04:00
|
|
|
}
|
|
|
|
|
2011-01-28 03:19:54 -05:00
|
|
|
cr.moveTo(x1 + borderRadius, y1);
|
2013-10-01 02:53:13 -04:00
|
|
|
if (this._arrowSide == St.Side.TOP && rise) {
|
2012-09-01 10:42:50 -04:00
|
|
|
if (skipTopLeft) {
|
|
|
|
cr.moveTo(x1, y2 - borderRadius);
|
|
|
|
cr.lineTo(x1, y1 - rise);
|
|
|
|
cr.lineTo(x1 + halfBase, y1);
|
|
|
|
} else if (skipTopRight) {
|
|
|
|
cr.lineTo(x2 - halfBase, y1);
|
|
|
|
cr.lineTo(x2, y1 - rise);
|
|
|
|
cr.lineTo(x2, y1 + borderRadius);
|
2011-01-28 03:19:54 -05:00
|
|
|
} else {
|
|
|
|
cr.lineTo(this._arrowOrigin - halfBase, y1);
|
|
|
|
cr.lineTo(this._arrowOrigin, y1 - rise);
|
|
|
|
cr.lineTo(this._arrowOrigin + halfBase, y1);
|
|
|
|
}
|
2011-02-02 17:13:55 -05:00
|
|
|
}
|
|
|
|
|
2012-09-01 10:42:50 -04:00
|
|
|
if (!skipTopRight) {
|
|
|
|
cr.lineTo(x2 - borderRadius, y1);
|
|
|
|
cr.arc(x2 - borderRadius, y1 + borderRadius, borderRadius,
|
2019-01-28 20:27:05 -05:00
|
|
|
3 * Math.PI / 2, Math.PI * 2);
|
2012-09-01 10:42:50 -04:00
|
|
|
}
|
2010-05-20 11:18:46 -04:00
|
|
|
|
2013-10-01 02:53:13 -04:00
|
|
|
if (this._arrowSide == St.Side.RIGHT && rise) {
|
2012-09-01 10:42:50 -04:00
|
|
|
if (skipTopRight) {
|
|
|
|
cr.lineTo(x2 + rise, y1);
|
|
|
|
cr.lineTo(x2 + rise, y1 + halfBase);
|
|
|
|
} else if (skipBottomRight) {
|
|
|
|
cr.lineTo(x2, y2 - halfBase);
|
|
|
|
cr.lineTo(x2 + rise, y2);
|
|
|
|
cr.lineTo(x2 - borderRadius, y2);
|
2011-01-28 03:19:54 -05:00
|
|
|
} else {
|
|
|
|
cr.lineTo(x2, this._arrowOrigin - halfBase);
|
|
|
|
cr.lineTo(x2 + rise, this._arrowOrigin);
|
|
|
|
cr.lineTo(x2, this._arrowOrigin + halfBase);
|
|
|
|
}
|
2011-02-02 17:13:55 -05:00
|
|
|
}
|
|
|
|
|
2012-09-01 10:42:50 -04:00
|
|
|
if (!skipBottomRight) {
|
|
|
|
cr.lineTo(x2, y2 - borderRadius);
|
|
|
|
cr.arc(x2 - borderRadius, y2 - borderRadius, borderRadius,
|
2019-01-28 20:27:05 -05:00
|
|
|
0, Math.PI / 2);
|
2012-09-01 10:42:50 -04:00
|
|
|
}
|
2010-05-20 11:18:46 -04:00
|
|
|
|
2013-10-01 02:53:13 -04:00
|
|
|
if (this._arrowSide == St.Side.BOTTOM && rise) {
|
2012-09-01 10:42:50 -04:00
|
|
|
if (skipBottomLeft) {
|
|
|
|
cr.lineTo(x1 + halfBase, y2);
|
|
|
|
cr.lineTo(x1, y2 + rise);
|
|
|
|
cr.lineTo(x1, y2 - borderRadius);
|
|
|
|
} else if (skipBottomRight) {
|
|
|
|
cr.lineTo(x2, y2 + rise);
|
|
|
|
cr.lineTo(x2 - halfBase, y2);
|
2011-01-28 03:19:54 -05:00
|
|
|
} else {
|
|
|
|
cr.lineTo(this._arrowOrigin + halfBase, y2);
|
|
|
|
cr.lineTo(this._arrowOrigin, y2 + rise);
|
|
|
|
cr.lineTo(this._arrowOrigin - halfBase, y2);
|
|
|
|
}
|
2011-02-02 17:13:55 -05:00
|
|
|
}
|
|
|
|
|
2012-09-01 10:42:50 -04:00
|
|
|
if (!skipBottomLeft) {
|
|
|
|
cr.lineTo(x1 + borderRadius, y2);
|
|
|
|
cr.arc(x1 + borderRadius, y2 - borderRadius, borderRadius,
|
2019-01-28 20:27:05 -05:00
|
|
|
Math.PI / 2, Math.PI);
|
2012-09-01 10:42:50 -04:00
|
|
|
}
|
2010-05-20 11:18:46 -04:00
|
|
|
|
2013-10-01 02:53:13 -04:00
|
|
|
if (this._arrowSide == St.Side.LEFT && rise) {
|
2012-09-01 10:42:50 -04:00
|
|
|
if (skipTopLeft) {
|
|
|
|
cr.lineTo(x1, y1 + halfBase);
|
|
|
|
cr.lineTo(x1 - rise, y1);
|
|
|
|
cr.lineTo(x1 + borderRadius, y1);
|
|
|
|
} else if (skipBottomLeft) {
|
2019-01-28 20:18:52 -05:00
|
|
|
cr.lineTo(x1 - rise, y2);
|
2012-09-01 10:42:50 -04:00
|
|
|
cr.lineTo(x1 - rise, y2 - halfBase);
|
2011-01-28 03:19:54 -05:00
|
|
|
} else {
|
|
|
|
cr.lineTo(x1, this._arrowOrigin + halfBase);
|
|
|
|
cr.lineTo(x1 - rise, this._arrowOrigin);
|
|
|
|
cr.lineTo(x1, this._arrowOrigin - halfBase);
|
|
|
|
}
|
2011-02-02 17:13:55 -05:00
|
|
|
}
|
|
|
|
|
2012-09-01 10:42:50 -04:00
|
|
|
if (!skipTopLeft) {
|
|
|
|
cr.lineTo(x1, y1 + borderRadius);
|
|
|
|
cr.arc(x1 + borderRadius, y1 + borderRadius, borderRadius,
|
2019-01-28 20:27:05 -05:00
|
|
|
Math.PI, 3 * Math.PI / 2);
|
2012-09-01 10:42:50 -04:00
|
|
|
}
|
2010-05-20 11:18:46 -04:00
|
|
|
|
2010-05-04 14:32:28 -04:00
|
|
|
Clutter.cairo_set_source_color(cr, backgroundColor);
|
|
|
|
cr.fillPreserve();
|
2012-07-22 22:02:31 -04:00
|
|
|
|
|
|
|
if (borderWidth > 0) {
|
|
|
|
let borderColor = themeNode.get_color('-arrow-border-color');
|
|
|
|
Clutter.cairo_set_source_color(cr, borderColor);
|
|
|
|
cr.setLineWidth(borderWidth);
|
|
|
|
cr.stroke();
|
|
|
|
}
|
2013-01-07 15:07:40 -05:00
|
|
|
|
|
|
|
cr.$dispose();
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2010-05-04 14:32:28 -04:00
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
setPosition(sourceActor, alignment) {
|
2019-06-13 12:57:38 -04:00
|
|
|
if (!this._sourceActor || sourceActor != this._sourceActor) {
|
|
|
|
if (this._sourceActorDestroyId) {
|
|
|
|
this._sourceActor.disconnect(this._sourceActorDestroyId);
|
|
|
|
delete this._sourceActorDestroyId;
|
|
|
|
}
|
|
|
|
|
|
|
|
this._sourceActor = sourceActor;
|
|
|
|
|
|
|
|
if (this._sourceActor) {
|
|
|
|
this._sourceActorDestroyId = this._sourceActor.connect('destroy', () => {
|
|
|
|
this._sourceActor = null;
|
|
|
|
delete this._sourceActorDestroyId;
|
2019-01-28 20:18:52 -05:00
|
|
|
});
|
2019-06-13 12:57:38 -04:00
|
|
|
}
|
|
|
|
}
|
2011-03-25 10:04:28 -04:00
|
|
|
|
2019-06-17 06:31:48 -04:00
|
|
|
this._arrowAlignment = alignment;
|
2019-06-13 12:57:38 -04:00
|
|
|
|
2019-06-17 06:31:48 -04:00
|
|
|
this.queue_relayout();
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2011-03-25 10:04:28 -04:00
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
setSourceAlignment(alignment) {
|
2011-09-14 18:14:03 -04:00
|
|
|
this._sourceAlignment = alignment;
|
|
|
|
|
|
|
|
if (!this._sourceActor)
|
|
|
|
return;
|
|
|
|
|
2012-06-14 13:43:15 -04:00
|
|
|
this.setPosition(this._sourceActor, this._arrowAlignment);
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2011-09-14 18:14:03 -04:00
|
|
|
|
2019-06-13 13:24:01 -04:00
|
|
|
_reposition(allocationBox) {
|
2012-12-21 09:05:34 -05:00
|
|
|
let sourceActor = this._sourceActor;
|
|
|
|
let alignment = this._arrowAlignment;
|
2019-03-08 15:36:23 -05:00
|
|
|
let monitorIndex = Main.layoutManager.findIndexForActor(sourceActor);
|
|
|
|
|
2020-07-29 06:50:47 -04:00
|
|
|
this._sourceExtents = sourceActor.get_transformed_extents();
|
2019-03-08 15:36:23 -05:00
|
|
|
this._workArea = Main.layoutManager.getWorkAreaForMonitor(monitorIndex);
|
2012-12-21 09:05:34 -05:00
|
|
|
|
2010-10-19 15:10:48 -04:00
|
|
|
// Position correctly relative to the sourceActor
|
2021-06-29 14:13:00 -04:00
|
|
|
const sourceAllocation = sourceActor.get_allocation_box();
|
|
|
|
const sourceContentBox = sourceActor instanceof St.Widget
|
|
|
|
? sourceActor.get_theme_node().get_content_box(sourceAllocation)
|
|
|
|
: sourceAllocation;
|
2020-07-29 06:50:47 -04:00
|
|
|
let sourceTopLeft = this._sourceExtents.get_top_left();
|
|
|
|
let sourceBottomRight = this._sourceExtents.get_bottom_right();
|
|
|
|
let sourceCenterX = sourceTopLeft.x + sourceContentBox.x1 + (sourceContentBox.x2 - sourceContentBox.x1) * this._sourceAlignment;
|
|
|
|
let sourceCenterY = sourceTopLeft.y + sourceContentBox.y1 + (sourceContentBox.y2 - sourceContentBox.y1) * this._sourceAlignment;
|
2019-02-01 08:41:55 -05:00
|
|
|
let [, , natWidth, natHeight] = this.get_preferred_size();
|
2010-10-19 15:10:48 -04:00
|
|
|
|
2010-10-25 11:50:00 -04:00
|
|
|
// We also want to keep it onscreen, and separated from the
|
|
|
|
// edge by the same distance as the main part of the box is
|
|
|
|
// separated from its sourceActor
|
2019-03-08 15:36:23 -05:00
|
|
|
let workarea = this._workArea;
|
2018-08-21 06:38:23 -04:00
|
|
|
let themeNode = this.get_theme_node();
|
2011-02-09 12:27:00 -05:00
|
|
|
let borderWidth = themeNode.get_length('-arrow-border-width');
|
|
|
|
let arrowBase = themeNode.get_length('-arrow-base');
|
2010-11-22 14:10:42 -05:00
|
|
|
let borderRadius = themeNode.get_length('-arrow-border-radius');
|
2019-08-19 15:38:51 -04:00
|
|
|
let margin = 4 * borderRadius + borderWidth + arrowBase;
|
2010-10-25 11:50:00 -04:00
|
|
|
|
2011-07-30 13:24:24 -04:00
|
|
|
let gap = themeNode.get_length('-boxpointer-gap');
|
2012-08-31 18:49:14 -04:00
|
|
|
let padding = themeNode.get_length('-arrow-rise');
|
2011-07-30 13:24:24 -04:00
|
|
|
|
2010-10-19 15:10:48 -04:00
|
|
|
let resX, resY;
|
|
|
|
|
|
|
|
switch (this._arrowSide) {
|
|
|
|
case St.Side.TOP:
|
2020-07-29 06:50:47 -04:00
|
|
|
resY = sourceBottomRight.y + gap;
|
2010-10-19 15:10:48 -04:00
|
|
|
break;
|
|
|
|
case St.Side.BOTTOM:
|
2020-07-29 06:50:47 -04:00
|
|
|
resY = sourceTopLeft.y - natHeight - gap;
|
2010-10-19 15:10:48 -04:00
|
|
|
break;
|
|
|
|
case St.Side.LEFT:
|
2020-07-29 06:50:47 -04:00
|
|
|
resX = sourceBottomRight.x + gap;
|
2010-10-19 15:10:48 -04:00
|
|
|
break;
|
|
|
|
case St.Side.RIGHT:
|
2020-07-29 06:50:47 -04:00
|
|
|
resX = sourceTopLeft.x - natWidth - gap;
|
2010-10-19 15:10:48 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-09-01 10:42:50 -04:00
|
|
|
// Now align and position the pointing axis, making sure it fits on
|
|
|
|
// screen. If the arrowOrigin is so close to the edge that the arrow
|
|
|
|
// will not be isosceles, we try to compensate as follows:
|
|
|
|
// - We skip the rounded corner and settle for a right angled arrow
|
|
|
|
// as shown below. See _drawBorder for further details.
|
|
|
|
// |\_____
|
|
|
|
// |
|
|
|
|
// |
|
|
|
|
// - If the arrow was going to be acute angled, we move the position
|
|
|
|
// of the box to maintain the arrow's accuracy.
|
|
|
|
|
|
|
|
let arrowOrigin;
|
2019-01-28 20:27:05 -05:00
|
|
|
let halfBase = Math.floor(arrowBase / 2);
|
2012-09-01 10:42:50 -04:00
|
|
|
let halfBorder = borderWidth / 2;
|
2012-09-06 14:59:58 -04:00
|
|
|
let halfMargin = margin / 2;
|
2012-09-01 10:42:50 -04:00
|
|
|
let [x1, y1] = [halfBorder, halfBorder];
|
|
|
|
let [x2, y2] = [natWidth - halfBorder, natHeight - halfBorder];
|
|
|
|
|
2010-10-19 15:10:48 -04:00
|
|
|
switch (this._arrowSide) {
|
|
|
|
case St.Side.TOP:
|
|
|
|
case St.Side.BOTTOM:
|
2011-02-09 12:27:00 -05:00
|
|
|
resX = sourceCenterX - (halfMargin + (natWidth - margin) * alignment);
|
2010-10-19 15:10:48 -04:00
|
|
|
|
2019-03-22 08:31:48 -04:00
|
|
|
resX = Math.max(resX, workarea.x + padding);
|
|
|
|
resX = Math.min(resX, workarea.x + workarea.width - (padding + natWidth));
|
2012-09-01 10:42:50 -04:00
|
|
|
|
|
|
|
arrowOrigin = sourceCenterX - resX;
|
|
|
|
if (arrowOrigin <= (x1 + (borderRadius + halfBase))) {
|
|
|
|
if (arrowOrigin > x1)
|
2019-08-19 15:38:51 -04:00
|
|
|
resX += arrowOrigin - x1;
|
2012-09-01 10:42:50 -04:00
|
|
|
arrowOrigin = x1;
|
|
|
|
} else if (arrowOrigin >= (x2 - (borderRadius + halfBase))) {
|
|
|
|
if (arrowOrigin < x2)
|
2019-08-19 15:38:51 -04:00
|
|
|
resX -= x2 - arrowOrigin;
|
2012-09-01 10:42:50 -04:00
|
|
|
arrowOrigin = x2;
|
|
|
|
}
|
2010-10-19 15:10:48 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case St.Side.LEFT:
|
|
|
|
case St.Side.RIGHT:
|
2011-02-09 12:27:00 -05:00
|
|
|
resY = sourceCenterY - (halfMargin + (natHeight - margin) * alignment);
|
2010-10-19 15:10:48 -04:00
|
|
|
|
2019-03-22 08:31:48 -04:00
|
|
|
resY = Math.max(resY, workarea.y + padding);
|
|
|
|
resY = Math.min(resY, workarea.y + workarea.height - (padding + natHeight));
|
2010-10-19 15:10:48 -04:00
|
|
|
|
2012-09-01 10:42:50 -04:00
|
|
|
arrowOrigin = sourceCenterY - resY;
|
|
|
|
if (arrowOrigin <= (y1 + (borderRadius + halfBase))) {
|
|
|
|
if (arrowOrigin > y1)
|
2019-08-19 15:38:51 -04:00
|
|
|
resY += arrowOrigin - y1;
|
2012-09-01 10:42:50 -04:00
|
|
|
arrowOrigin = y1;
|
|
|
|
} else if (arrowOrigin >= (y2 - (borderRadius + halfBase))) {
|
|
|
|
if (arrowOrigin < y2)
|
2019-08-19 15:38:51 -04:00
|
|
|
resX -= y2 - arrowOrigin;
|
2012-09-01 10:42:50 -04:00
|
|
|
arrowOrigin = y2;
|
|
|
|
}
|
2010-10-19 15:10:48 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-09-01 10:42:50 -04:00
|
|
|
this.setArrowOrigin(arrowOrigin);
|
|
|
|
|
2018-08-21 06:38:23 -04:00
|
|
|
let parent = this.get_parent();
|
2010-10-19 15:10:48 -04:00
|
|
|
let success, x, y;
|
|
|
|
while (!success) {
|
|
|
|
[success, x, y] = parent.transform_stage_point(resX, resY);
|
|
|
|
parent = parent.get_parent();
|
|
|
|
}
|
|
|
|
|
2019-03-04 18:38:32 -05:00
|
|
|
// Actually set the position
|
2019-06-17 06:31:48 -04:00
|
|
|
allocationBox.set_origin(Math.floor(x), Math.floor(y));
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2010-10-19 15:10:48 -04:00
|
|
|
|
2010-05-04 14:32:28 -04:00
|
|
|
// @origin: Coordinate specifying middle of the arrow, along
|
|
|
|
// the Y axis for St.Side.LEFT, St.Side.RIGHT from the top and X axis from
|
|
|
|
// the left for St.Side.TOP and St.Side.BOTTOM.
|
2017-10-30 20:03:21 -04:00
|
|
|
setArrowOrigin(origin) {
|
2010-05-04 14:32:28 -04:00
|
|
|
if (this._arrowOrigin != origin) {
|
|
|
|
this._arrowOrigin = origin;
|
|
|
|
this._border.queue_repaint();
|
|
|
|
}
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2011-03-26 16:38:57 -04:00
|
|
|
|
2013-02-20 08:13:46 -05:00
|
|
|
// @actor: an actor relative to which the arrow is positioned.
|
|
|
|
// Differently from setPosition, this will not move the boxpointer itself,
|
|
|
|
// on the arrow
|
2017-10-30 20:03:21 -04:00
|
|
|
setArrowActor(actor) {
|
2013-02-20 08:13:46 -05:00
|
|
|
if (this._arrowActor != actor) {
|
|
|
|
this._arrowActor = actor;
|
|
|
|
this._border.queue_repaint();
|
|
|
|
}
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2013-02-20 08:13:46 -05:00
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
_calculateArrowSide(arrowSide) {
|
2020-07-29 06:50:47 -04:00
|
|
|
let sourceTopLeft = this._sourceExtents.get_top_left();
|
|
|
|
let sourceBottomRight = this._sourceExtents.get_bottom_right();
|
2019-02-01 08:41:55 -05:00
|
|
|
let [, , boxWidth, boxHeight] = this.get_preferred_size();
|
2019-03-08 15:36:23 -05:00
|
|
|
let workarea = this._workArea;
|
2012-06-14 13:43:15 -04:00
|
|
|
|
2012-12-21 08:40:40 -05:00
|
|
|
switch (arrowSide) {
|
2012-06-14 13:43:15 -04:00
|
|
|
case St.Side.TOP:
|
2020-07-29 06:50:47 -04:00
|
|
|
if (sourceBottomRight.y + boxHeight > workarea.y + workarea.height &&
|
|
|
|
boxHeight < sourceTopLeft.y - workarea.y)
|
2012-12-21 08:40:40 -05:00
|
|
|
return St.Side.BOTTOM;
|
2012-06-14 13:43:15 -04:00
|
|
|
break;
|
|
|
|
case St.Side.BOTTOM:
|
2020-07-29 06:50:47 -04:00
|
|
|
if (sourceTopLeft.y - boxHeight < workarea.y &&
|
|
|
|
boxHeight < workarea.y + workarea.height - sourceBottomRight.y)
|
2012-12-21 08:40:40 -05:00
|
|
|
return St.Side.TOP;
|
2012-06-14 13:43:15 -04:00
|
|
|
break;
|
|
|
|
case St.Side.LEFT:
|
2020-07-29 06:50:47 -04:00
|
|
|
if (sourceBottomRight.x + boxWidth > workarea.x + workarea.width &&
|
|
|
|
boxWidth < sourceTopLeft.x - workarea.x)
|
2012-12-21 08:40:40 -05:00
|
|
|
return St.Side.RIGHT;
|
2012-06-14 13:43:15 -04:00
|
|
|
break;
|
|
|
|
case St.Side.RIGHT:
|
2020-07-29 06:50:47 -04:00
|
|
|
if (sourceTopLeft.x - boxWidth < workarea.x &&
|
|
|
|
boxWidth < workarea.x + workarea.width - sourceBottomRight.x)
|
2012-12-21 08:40:40 -05:00
|
|
|
return St.Side.LEFT;
|
2012-06-14 13:43:15 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-12-21 08:40:40 -05:00
|
|
|
return arrowSide;
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2012-12-21 08:40:40 -05:00
|
|
|
|
2019-06-13 13:24:01 -04:00
|
|
|
_updateFlip(allocationBox) {
|
2012-12-21 08:40:40 -05:00
|
|
|
let arrowSide = this._calculateArrowSide(this._userArrowSide);
|
|
|
|
if (this._arrowSide != arrowSide) {
|
|
|
|
this._arrowSide = arrowSide;
|
2019-06-13 13:24:01 -04:00
|
|
|
this._reposition(allocationBox);
|
2013-09-10 05:48:55 -04:00
|
|
|
|
|
|
|
this.emit('arrow-side-changed');
|
2012-12-21 08:40:40 -05:00
|
|
|
}
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2012-06-14 13:43:15 -04:00
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
updateArrowSide(side) {
|
2013-08-30 12:50:35 -04:00
|
|
|
this._arrowSide = side;
|
|
|
|
this._border.queue_repaint();
|
2013-09-10 05:48:55 -04:00
|
|
|
|
|
|
|
this.emit('arrow-side-changed');
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2013-08-30 12:50:35 -04:00
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
getPadding(side) {
|
2013-08-30 12:50:35 -04:00
|
|
|
return this.bin.get_theme_node().get_padding(side);
|
2017-10-30 21:23:39 -04:00
|
|
|
}
|
2013-08-30 12:50:35 -04:00
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
getArrowHeight() {
|
2018-08-21 06:38:23 -04:00
|
|
|
return this.get_theme_node().get_length('-arrow-rise');
|
2010-05-04 14:32:28 -04:00
|
|
|
}
|
2011-11-20 12:56:27 -05:00
|
|
|
});
|