I have created a little drawing area class and now need a pixmap to draw into during the expose event callback. But I can’t get any parameter that I have tried to compile. Here are the relevant parts of the code…
The class definition…
class set_display_drawing_area : public Gtk::DrawingArea
{
public:
set_display_drawing_area ();
virtual ~set_display_drawing_area ();
protected:
virtual bool on_expose_event(GdkEventExpose* event);
private:
GdkPixmap *pixmap_ptr;
};
and the expose callback…
bool set_display_drawing_area::on_expose_event(GdkEventExpose* event)
{
Glib::RefPtr<Gdk::Window> window = get_window();
if (window)
{
Gtk::Allocation allocation = get_allocation();
const int width = allocation.get_width();
const int height = allocation.get_height();
pixmap_ptr = gdk_pixmap_new (window, // <-- What is needed here?
width,
height,
-1);
You’re mixing gtkmm (C++) and gtk (C) style code here.
gdk_pixmap_newis a C function which has no idea about templates and classes (such asGlib::RefPtr). You’ll probably want to use gtkmm for your pixmap as well:and