Port more to CSS

https://bugzilla.gnome.org/show_bug.cgi?id=599661
This commit is contained in:
Colin Walters 2009-10-27 13:27:00 -04:00
parent aa9d3515a1
commit c4a49b4de2
2 changed files with 21 additions and 12 deletions

View File

@ -364,6 +364,19 @@ StTooltip {
border-radius: 4px; border-radius: 4px;
} }
#LookingGlassDialog .labels {
spacing: 4px;
}
#LookingGlassDialog .notebook-tab {
padding: 2px;
}
#LookingGlassDialog .notebook-tab:selected {
border: 1px solid #88ff66;
padding: 1px;
}
#LookingGlassDialog StLabel #LookingGlassDialog StLabel
{ {
color: #88ff66; color: #88ff66;

View File

@ -39,24 +39,21 @@ Notebook.prototype = {
_init: function() { _init: function() {
this.actor = new St.BoxLayout({ vertical: true }); this.actor = new St.BoxLayout({ vertical: true });
this.tabControls = new Big.Box({ orientation: Big.BoxOrientation.HORIZONTAL, this.tabControls = new St.BoxLayout({ style_class: "labels" });
spacing: 4, padding: 2 });
this._selectedIndex = -1; this._selectedIndex = -1;
this._tabs = []; this._tabs = [];
}, },
appendPage: function(name, child) { appendPage: function(name, child) {
let labelOuterBox = new Big.Box({ padding: 2 }); let labelBox = new St.BoxLayout({ style_class: "notebook-tab" });
let labelBox = new St.BoxLayout({ reactive: true }); let label = new St.Button({ label: name });
labelOuterBox.append(labelBox, Big.BoxPackFlags.NONE); label.connect('clicked', Lang.bind(this, function () {
let label = new St.Label({ text: name });
labelBox.connect('button-press-event', Lang.bind(this, function () {
this.selectChild(child); this.selectChild(child);
return true; return true;
})); }));
labelBox.add(label, { expand: true }); labelBox.add(label, { expand: true });
this.tabControls.append(labelOuterBox, Big.BoxPackFlags.NONE); this.tabControls.add(labelBox);
let scrollview = new St.ScrollView({ x_fill: true, y_fill: true }); let scrollview = new St.ScrollView({ x_fill: true, y_fill: true });
scrollview.get_hscroll_bar().hide(); scrollview.get_hscroll_bar().hide();
@ -64,6 +61,7 @@ Notebook.prototype = {
let tabData = { child: child, let tabData = { child: child,
labelBox: labelBox, labelBox: labelBox,
label: label,
scrollView: scrollview, scrollView: scrollview,
_scrollToBottom: false }; _scrollToBottom: false };
this._tabs.push(tabData); this._tabs.push(tabData);
@ -82,8 +80,7 @@ Notebook.prototype = {
if (this._selectedIndex < 0) if (this._selectedIndex < 0)
return; return;
let tabData = this._tabs[this._selectedIndex]; let tabData = this._tabs[this._selectedIndex];
tabData.labelBox.padding = 2; tabData.labelBox.set_style_pseudo_class(null);
tabData.labelBox.border = 0;
tabData.scrollView.hide(); tabData.scrollView.hide();
this._selectedIndex = -1; this._selectedIndex = -1;
}, },
@ -97,8 +94,7 @@ Notebook.prototype = {
return; return;
} }
let tabData = this._tabs[index]; let tabData = this._tabs[index];
tabData.labelBox.padding = 1; tabData.labelBox.set_style_pseudo_class('selected');
tabData.labelBox.border = 1;
tabData.scrollView.show(); tabData.scrollView.show();
this._selectedIndex = index; this._selectedIndex = index;
this.emit('selection', tabData.child); this.emit('selection', tabData.child);