Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/background.vala
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
using Cairo;

namespace LiveChart {
public class Background : Drawable, Object {

public abstract class AbstractBackground : Drawable, Colorable, Object {
public abstract bool visible { get; set; default = true; }
public abstract Gdk.RGBA main_color { get; set; }
public abstract void draw(Context ctx, Config config);

}

public class Background : AbstractBackground {
private BackgroundDrawer drawer = new BackgroundDrawer();

public bool visible { get; set; default = true; }
public override bool visible { get; set; default = true; }

public Gdk.RGBA color {
get {
Expand All @@ -16,7 +24,7 @@ namespace LiveChart {
}

[Version (deprecated = true, deprecated_since = "1.8.0", replacement = "Background.color")]
public Gdk.RGBA main_color {
public override Gdk.RGBA main_color {
get; set; default = Gdk.RGBA() {
red = 0.1f,
green = 0.1f,
Expand All @@ -25,7 +33,7 @@ namespace LiveChart {
};
}

public void draw(Context ctx, Config config) {
public override void draw(Context ctx, Config config) {
if (visible) {
drawer.draw(ctx, config, this.color);
}
Expand Down
2 changes: 1 addition & 1 deletion src/chart.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace LiveChart {
private Cairo.Context? cairo_context = null;

public Grid grid { get; set; default = new Grid(); }
public Background background { get; set; default = new Background(); }
public AbstractBackground background { get; set; default = new Background(); }
public Legend legend { get; set; default = new HorizontalLegend(); }
public Config config;
public Series series;
Expand Down