Fix yet another oversight for the windows icon file update
[ardour.git] / gtk2_ardour / ardour_spacer.h
1 /*
2  * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18
19 #ifndef __gtkardour_ardour_spacer_h__
20 #define __gtkardour_ardour_spacer_h__
21
22 #include "gtkmm2ext/cairo_widget.h"
23
24 class ArdourVSpacer : public CairoWidget
25 {
26 public:
27         ArdourVSpacer (float r = 0.75f) : CairoWidget (), ratio (r) {}
28
29 protected:
30         void render (cairo_t* cr, cairo_rectangle_t* r) {
31                 float h = r->height * ratio;
32                 float t = .5f * (r->height - h);
33                 cairo_rectangle (cr, 0, t, 1, h);
34                 cairo_set_source_rgb (cr, 0, 0, 0);
35                 cairo_fill (cr);
36         }
37
38         void on_size_request (Gtk::Requisition* req) {
39                 req->width = 1;
40                 req->height = 0;
41                 CairoWidget::on_size_request (req);
42         }
43
44         float ratio;
45 };
46
47 #endif