db0c2b5959
ShellTheme replaces both NbtkStyle and ccss_stylesheet_t. The interface NbtkStylable is replaced by usage of ShellThemeNode. A concrete node class allows some significant optimizations of property inheritance that would have been much more difficult to achieve with the highly abstract pair of NbtkStylable and ccss_node_t. Some operations that were previously on NbtkStylable (like the ::style-changed signal) are directly on NtkWidget. Custom properties are no longer registered as param-specs; instead you call directly into shell theme node to look up a length or color: shell_theme_node_get_length (theme_node, "border-spacing", FALSE, &spacing); The dependency on libccss is dropped, while preserving all existing functionality and adding proper parsing and inheritance of font properties and proper inheritance for the 'color' property. Some more javascript tests for CSS functionality are added; workarounds for a CSS bug where *.some-class was needed instead of .some-class are removed.
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
|
|
const Clutter = imports.gi.Clutter;
|
|
const Nbtk = imports.gi.Nbtk;
|
|
|
|
const UI = imports.testcommon.ui;
|
|
|
|
UI.init();
|
|
let stage = Clutter.Stage.get_default();
|
|
|
|
let b = new Nbtk.BoxLayout({ vertical: true,
|
|
width: stage.width,
|
|
height: stage.height });
|
|
stage.add_actor(b);
|
|
|
|
let t;
|
|
|
|
t = new Nbtk.Label({ "text": "Bold", style_class: "bold" });
|
|
b.add(t);
|
|
t = new Nbtk.Label({ "text": "Monospace", style_class: "monospace" });
|
|
b.add(t);
|
|
t = new Nbtk.Label({ "text": "Italic", style_class: "italic" });
|
|
b.add(t);
|
|
t = new Nbtk.Label({ "text": "Bold Italic", style_class: "bold italic" });
|
|
b.add(t);
|
|
t = new Nbtk.Label({ "text": "Big Italic", style_class: "big italic" });
|
|
b.add(t);
|
|
t = new Nbtk.Label({ "text": "Big Bold", style_class: "big bold" });
|
|
b.add(t);
|
|
|
|
let b2 = new Nbtk.BoxLayout({ vertical: true, style_class: "monospace" });
|
|
b.add(b2);
|
|
t = new Nbtk.Label({ "text": "Big Monospace", style_class: "big" });
|
|
b2.add(t);
|
|
t = new Nbtk.Label({ "text": "Italic Monospace", style_class: "italic" });
|
|
b2.add(t);
|
|
|
|
stage.show();
|
|
Clutter.main();
|