2014-06-22 09:53:14 -04:00
|
|
|
/*
|
2019-08-02 22:40:09 -04:00
|
|
|
* Copyright (C) 2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2014-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2014-06-22 09:53:14 -04:00
|
|
|
|
|
|
|
#include "canvas/container.h"
|
|
|
|
|
|
|
|
using namespace ArdourCanvas;
|
|
|
|
|
2015-10-04 14:51:05 -04:00
|
|
|
Container::Container (Canvas* canvas)
|
2014-06-22 09:53:14 -04:00
|
|
|
: Item (canvas)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-10-04 14:51:05 -04:00
|
|
|
Container::Container (Item* parent)
|
2014-06-22 09:53:14 -04:00
|
|
|
: Item (parent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-10-04 14:51:05 -04:00
|
|
|
Container::Container (Item* parent, Duple const & p)
|
2014-06-22 09:53:14 -04:00
|
|
|
: Item (parent, p)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-04-01 09:02:49 -04:00
|
|
|
void
|
|
|
|
Container::prepare_for_render (Rect const & area) const
|
|
|
|
{
|
|
|
|
Item::prepare_for_render_children (area);
|
|
|
|
}
|
|
|
|
|
2014-06-22 11:41:05 -04:00
|
|
|
void
|
|
|
|
Container::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
|
|
|
{
|
2020-06-29 19:25:11 -04:00
|
|
|
if (0 && (fill() || outline())) {
|
2020-06-10 21:39:14 -04:00
|
|
|
|
|
|
|
Rect bb (bounding_box());
|
|
|
|
Rect self (item_to_window (bb, false));
|
|
|
|
const Rect draw = self.intersection (area);
|
|
|
|
|
|
|
|
if (fill()) {
|
2020-06-19 15:52:43 -04:00
|
|
|
|
2020-06-10 21:39:14 -04:00
|
|
|
setup_fill_context (context);
|
|
|
|
context->rectangle (draw.x0, draw.y0, draw.width(), draw.height());
|
|
|
|
context->fill_preserve ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (outline()) {
|
|
|
|
if (!fill()) {
|
|
|
|
context->rectangle (draw.x0, draw.y0, draw.width(), draw.height());
|
|
|
|
}
|
|
|
|
setup_outline_context (context);
|
|
|
|
context->stroke ();
|
|
|
|
}
|
|
|
|
}
|
2014-06-22 11:41:05 -04:00
|
|
|
Item::render_children (area, context);
|
|
|
|
}
|
|
|
|
|
2014-06-22 09:53:14 -04:00
|
|
|
void
|
|
|
|
Container::compute_bounding_box () const
|
|
|
|
{
|
2017-01-19 14:54:24 -05:00
|
|
|
_bounding_box = Rect ();
|
2014-06-22 09:53:14 -04:00
|
|
|
add_child_bounding_boxes ();
|
|
|
|
_bounding_box_dirty = false;
|
|
|
|
}
|