allow FittedCanvasWidget to have it's root first child replaced
This commit is contained in:
parent
5ad5603f1e
commit
de6178093e
@ -76,10 +76,16 @@ void
|
|||||||
FittedCanvasWidget::on_size_allocate (Gtk::Allocation& alloc)
|
FittedCanvasWidget::on_size_allocate (Gtk::Allocation& alloc)
|
||||||
{
|
{
|
||||||
GtkCanvas::on_size_allocate(alloc);
|
GtkCanvas::on_size_allocate(alloc);
|
||||||
|
repeat_size_allocation ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FittedCanvasWidget::repeat_size_allocation ()
|
||||||
|
{
|
||||||
if (!_root.items().empty()) {
|
if (!_root.items().empty()) {
|
||||||
ArdourCanvas::Item *fitted = *_root.items().begin();
|
ArdourCanvas::Item *fitted = *_root.items().begin();
|
||||||
fitted->size_allocate(ArdourCanvas::Rect(0,0,alloc.get_width(), alloc.get_height()));
|
Gtk::Allocation a = get_allocation ();
|
||||||
|
fitted->size_allocate (ArdourCanvas::Rect (0, 0, a.get_width(), a.get_height()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,10 +55,14 @@ public:
|
|||||||
/* per gtk convention you may use -1 for width OR height if you don't care about that dimension */
|
/* per gtk convention you may use -1 for width OR height if you don't care about that dimension */
|
||||||
FittedCanvasWidget(float nominal_width, float nominal_height, bool follow_scale=true);
|
FittedCanvasWidget(float nominal_width, float nominal_height, bool follow_scale=true);
|
||||||
|
|
||||||
|
/* call if the root item's first child is changed, to force a size-allocate on it */
|
||||||
|
void repeat_size_allocation ();
|
||||||
|
|
||||||
void on_size_request (Gtk::Requisition* req); //always returns the nominal size, regardless of children
|
void on_size_request (Gtk::Requisition* req); //always returns the nominal size, regardless of children
|
||||||
void on_size_allocate (Gtk::Allocation& alloc);
|
void on_size_allocate (Gtk::Allocation& alloc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
ArdourCanvas::Rect _allocation;
|
||||||
float _nominal_width;
|
float _nominal_width;
|
||||||
float _nominal_height;
|
float _nominal_height;
|
||||||
bool _follow_scale;
|
bool _follow_scale;
|
||||||
|
Loading…
Reference in New Issue
Block a user