ardour/libs/gtkmm2ext/trimming_bin.cc
Carl Hetherington cf45b07f73 Somewhat experimental fix to try to stop the editor window jumping around on small screens.
git-svn-id: svn://localhost/ardour2/branches/3.0@8412 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-01-03 03:10:43 +00:00

38 lines
891 B
C++

#include <iostream>
#include "gtkmm2ext/trimming_bin.h"
using namespace std;
using namespace Gtkmm2ext;
void
TrimmingBin::on_size_request (Gtk::Requisition* r)
{
Gtk::ScrolledWindow::on_size_request (r);
/* Munge the height request so that it is that of the child;
the Gtk::ScrolledWindow's request may include space for
a horizontal scrollbar, which we will never show.
*/
Gtk::Widget* c = get_child ();
if (c && c->is_visible ()) {
Gtk::Requisition cr;
c->size_request (cr);
r->height = cr.height;
}
}
void
TrimmingBin::on_size_allocate (Gtk::Allocation& a)
{
/* We replace Gtk::ScrolledWindow's on_size_allocate with this
which accepts what we are given and forces the child to use
the same allocation (which may result in it being shrunk).
*/
set_allocation (a);
Widget* c = get_child ();
if (c && c->is_visible ()) {
c->size_allocate (a);
}
}