13
0

Add a horizontal separator widget

This commit is contained in:
Robin Gareus 2020-07-21 04:41:16 +02:00
parent 7b68b85f93
commit e8e143bb32
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 32 additions and 0 deletions

View File

@ -27,6 +27,12 @@ ArdourVSpacer::ArdourVSpacer (float r)
{
}
ArdourHSpacer::ArdourHSpacer (float r)
: CairoWidget ()
, ratio (r)
{
}
ArdourDropShadow::ArdourDropShadow (ShadowMode m, float a)
: CairoWidget ()
, alpha (a)

View File

@ -53,6 +53,32 @@ protected:
float ratio;
};
class LIBWIDGETS_API ArdourHSpacer : public CairoWidget
{
public:
ArdourHSpacer (float r = 0.75f);
protected:
void render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*) {
float width = get_width();
float w = width * ratio;
float t = .5f * (width - w);
ctx->rectangle (t, 0, w, 1);
ctx->set_source_rgb (0, 0, 0);
ctx->fill ();
}
void on_size_request (Gtk::Requisition* req) {
req->width = 0;
req->height = 1;
CairoWidget::on_size_request (req);
}
float ratio;
};
class LIBWIDGETS_API ArdourDropShadow : public CairoWidget
{
public: