Re: Deriving from Pango::Layout
- From: Kjell Ahlstedt <kjell ahlstedt bredband net>
- To: Phil Wolff <adiabat centurylink net>
- Cc: "gtkmm-list gnome org" <gtkmm-list gnome org>
- Subject: Re: Deriving from Pango::Layout
- Date: Sat, 18 Feb 2017 10:47:46 +0100
Den 2017-02-17 kl. 21:14, skrev Phil Wolff:
#include <gtkmm.h>
class CTextBuffer : public Gtk::TextBuffer
{
public:
static Glib::RefPtr<CTextBuffer > create ( Gtk::TextView* );
virtual ~CTextBuffer () {}
private:
explicit CTextBuffer ( Gtk::TextView* );
Gtk::TextView* m_pTextView;
};
//==================================
Glib::RefPtr<CTextBuffer > CTextBuffer::create ( Gtk::TextView* pView )
{
return Glib::RefPtr<CTextBuffer > ( new CTextBuffer ( pView ) );
}
CTextBuffer::CTextBuffer ( Gtk::TextView* pView )
{
m_pTextView = pView;
}
The example above compiles with no errors. However when I try it with
Pango::Layout in place of Gtk::TextBuffer:
#include <gtkmm.h>
#include <pangomm.h>
class CLayout : public Pango::Layout
{
public:
static Glib::RefPtr<CLayout > create ( const
Glib::RefPtr<Pango::Context >& );
virtual ~CLayout () {}
private:
explicit CLayout ( const Glib::RefPtr<Pango::Context >& );
Glib::RefPtr<Pango::Context > m_refContext;
};
//==================================
Glib::RefPtr<CLayout > CLayout::create ( const
Glib::RefPtr<Pango::Context >& context )
{
return Glib::RefPtr<CLayout > ( new CLayout ( context ) );
}
CLayout::CLayout ( const Glib::RefPtr<Pango::Context >& context )
{
m_refContext = context;
}
pl.cc: In constructor ‘CLayout::CLayout(const
Glib::RefPtr<Pango::Context>&)’:
pl.cc:20:65: error: no matching function for call to
‘Pango::Layout::Layout()’
CLayout::CLayout ( const Glib::RefPtr<Pango::Context >& context )
^
In file included from /usr/include/gtkmm-3.0/gtkmm/widget.h:32:0,
from /usr/include/gtkmm-3.0/gtkmm/action.h:31,
from /usr/include/gtkmm-3.0/gtkmm/toggleaction.h:27,
from /usr/include/gtkmm-3.0/gtkmm.h:95,
from pl.cc:1:
/usr/include/pangomm-1.4/pangomm/layout.h:259:12: note: candidate:
Pango::Layout::Layout(const Glib::RefPtr<Pango::Context>&)
explicit Layout(const Glib::RefPtr<Context>& context);
^~~~~~
/usr/include/pangomm-1.4/pangomm/layout.h:259:12: note: candidate
expects 1 argument, 0 provided
Can someone give me a clue as to what I'm failing to see?
The constructor CLayout ( const Glib::RefPtr<Pango::Context >& )
implicitly calls the default constructor of the base class,
Pango::Layout::Layout(). But Pango::Layout does not have a default
constructor.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]