13
0

CairoPacker draws outside of its widget allocation

This fixes fixes TimeInfoBox packing when the InfoBox position changes.
This commit is contained in:
Robin Gareus 2016-12-10 20:48:57 +01:00
parent 914224f808
commit 642b357376
2 changed files with 25 additions and 9 deletions

View File

@ -65,6 +65,13 @@ CairoHPacker::on_expose_event (GdkEventExpose* ev)
return HBox::on_expose_event (ev);
}
void
CairoHPacker::on_size_allocate (Gtk::Allocation& alloc)
{
get_parent()->queue_draw();
HBox::on_size_allocate (alloc);
}
CairoVPacker::CairoVPacker ()
{
}
@ -83,6 +90,13 @@ CairoVPacker::on_realize ()
CairoWidget::provide_background_for_cairo_widget (*this, get_bg());
}
void
CairoVPacker::on_size_allocate (Gtk::Allocation& alloc)
{
get_parent()->queue_draw();
VBox::on_size_allocate (alloc);
}
Gdk::Color
CairoVPacker::get_bg () const
{

View File

@ -7,38 +7,40 @@
class LIBGTKMM2EXT_API CairoPacker
{
public:
public:
CairoPacker () {}
virtual ~CairoPacker () {}
virtual Gdk::Color get_bg () const = 0;
virtual Gdk::Color get_bg () const = 0;
protected:
protected:
virtual void draw_background (Gtk::Widget&, GdkEventExpose*);
};
class LIBGTKMM2EXT_API CairoHPacker : public CairoPacker, public Gtk::HBox
{
public:
public:
CairoHPacker ();
~CairoHPacker() {}
Gdk::Color get_bg () const;
Gdk::Color get_bg () const;
bool on_expose_event (GdkEventExpose*);
void on_realize ();
void on_realize ();
void on_size_allocate (Gtk::Allocation& alloc);
};
class LIBGTKMM2EXT_API CairoVPacker : public CairoPacker, public Gtk::VBox
{
public:
public:
CairoVPacker ();
~CairoVPacker () {}
Gdk::Color get_bg () const;
Gdk::Color get_bg () const;
bool on_expose_event (GdkEventExpose*);
void on_realize ();
void on_realize ();
void on_size_allocate (Gtk::Allocation& alloc);
};
#endif /* __gtkmm2ext_cairo_packer_h__ */