diff options
author | Ben Loftis <ben@harrisonconsoles.com> | 2018-02-17 22:25:39 -0600 |
---|---|---|
committer | Ben Loftis <ben@harrisonconsoles.com> | 2018-02-17 22:25:39 -0600 |
commit | 0b3026d388c13677c7ba6afbf2ef9770d6ad0dac (patch) | |
tree | 6bb7811db89e7236eb0477fb342136bb168d51f9 /libs/widgets | |
parent | 4c7ad5db4dd3774bdf4acfed4a03c70891f9aa20 (diff) |
Drop-shadow spacer; for theming.
Diffstat (limited to 'libs/widgets')
-rw-r--r-- | libs/widgets/ardour_spacer.cc | 6 | ||||
-rw-r--r-- | libs/widgets/widgets/ardour_spacer.h | 23 |
2 files changed, 29 insertions, 0 deletions
diff --git a/libs/widgets/ardour_spacer.cc b/libs/widgets/ardour_spacer.cc index 4155a17ee4..712792a710 100644 --- a/libs/widgets/ardour_spacer.cc +++ b/libs/widgets/ardour_spacer.cc @@ -25,3 +25,9 @@ ArdourVSpacer::ArdourVSpacer (float r) , ratio (r) { } + +ArdourDropShadow::ArdourDropShadow (float a) + : CairoWidget () + , alpha (a) +{ +} diff --git a/libs/widgets/widgets/ardour_spacer.h b/libs/widgets/widgets/ardour_spacer.h index b2668f19d7..e9f6ad1448 100644 --- a/libs/widgets/widgets/ardour_spacer.h +++ b/libs/widgets/widgets/ardour_spacer.h @@ -51,6 +51,29 @@ protected: float ratio; }; +class LIBWIDGETS_API ArdourDropShadow : public CairoWidget +{ +public: + ArdourDropShadow (float a = 0.75f); + +protected: + void render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*) { + float width = get_width(); + float height = get_height(); + + Cairo::RefPtr<Cairo::LinearGradient> _gradient = Cairo::LinearGradient::create (0, 0, 0, height); + _gradient->add_color_stop_rgba (0, 0, 0, 0, alpha); + _gradient->add_color_stop_rgba (1, 0, 0, 0, 0); + + ctx->set_source (_gradient); + + ctx->rectangle (0, 0, width, height); + ctx->fill (); + } + + float alpha; +}; + } /* end namespace */ #endif |