53
53
* - handle horizontal dash
55
55
const MyDashActor = new Lang.Class({
56
Name: 'DashToDock.MyDashActor',
56
Name: 'DashToDock_MyDashActor',
58
59
_init: function(settings) {
59
60
// a prefix is required to avoid conflicting with the parent class variable
68
69
orientation: this._isHorizontal ? Clutter.Orientation.HORIZONTAL : Clutter.Orientation.VERTICAL
71
this.actor = new Shell.GenericContainer({
73
74
layout_manager: layout,
74
75
clip_to_allocation: true
76
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
77
this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
78
this.actor.connect('allocate', Lang.bind(this, this._allocate));
80
this.actor._delegate = this;
83
_allocate: function(actor, box, flags) {
79
vfunc_allocate: function(box, flags) {
80
this.set_allocation(box, flags);
84
81
let contentBox = box;
85
82
let availWidth = contentBox.x2 - contentBox.x1;
86
83
let availHeight = contentBox.y2 - contentBox.y1;
88
let [appIcons, showAppsButton] = actor.get_children();
85
let [appIcons, showAppsButton] = this.get_children();
89
86
let [showAppsMinHeight, showAppsNatHeight] = showAppsButton.get_preferred_height(availWidth);
90
87
let [showAppsMinWidth, showAppsNatWidth] = showAppsButton.get_preferred_width(availHeight);
126
_getPreferredWidth: function(actor, forHeight, alloc) {
123
vfunc_get_preferred_width: function(forHeight) {
127
124
// We want to request the natural height of all our children
128
125
// as our natural height, so we chain up to StWidget (which
129
126
// then calls BoxLayout), but we only request the showApps
130
127
// button as the minimum size
132
let [, natWidth] = this.actor.layout_manager.get_preferred_width(this.actor, forHeight);
129
let [, natWidth] = this.layout_manager.get_preferred_width(this, forHeight);
134
let themeNode = this.actor.get_theme_node();
135
let [, showAppsButton] = this.actor.get_children();
131
let themeNode = this.get_theme_node();
132
let [, showAppsButton] = this.get_children();
136
133
let [minWidth, ] = showAppsButton.get_preferred_height(forHeight);
138
alloc.min_size = minWidth;
139
alloc.natural_size = natWidth;
135
return [minWidth, natWidth];
143
_getPreferredHeight: function(actor, forWidth, alloc) {
139
vfunc_get_preferred_height: function(forWidth) {
144
140
// We want to request the natural height of all our children
145
141
// as our natural height, so we chain up to StWidget (which
146
142
// then calls BoxLayout), but we only request the showApps
147
143
// button as the minimum size
149
let [, natHeight] = this.actor.layout_manager.get_preferred_height(this.actor, forWidth);
145
let [, natHeight] = this.layout_manager.get_preferred_height(this, forWidth);
151
let themeNode = this.actor.get_theme_node();
152
let [, showAppsButton] = this.actor.get_children();
147
let themeNode = this.get_theme_node();
148
let [, showAppsButton] = this.get_children();
153
149
let [minHeight, ] = showAppsButton.get_preferred_height(forWidth);
155
alloc.min_size = minHeight;
156
alloc.natural_size = natHeight;
151
return [minHeight, natHeight];
203
198
this._ensureAppIconVisibilityTimeoutId = 0;
204
199
this._labelShowing = false;
206
this._containerObject = new MyDashActor(settings);
207
this._container = this._containerObject.actor;
201
this._container = new MyDashActor(settings);
208
202
this._scrollView = new St.ScrollView({
209
203
name: 'dashtodockDashScrollview',
210
204
hscrollbar_policy: Gtk.PolicyType.NEVER,