私は gtkmm 2.4 を使用するアプリケーションを持っていますが、最近 gtkmm 3.0 に切り替えるまで問題なく動作していました。g++ (バージョン 4.6.1) に問題があり、「エラー: 'class Gtk::TextView' には 'modify_font' という名前のメンバーがありません」というエラーが吐き出され続けます。これは、ビルド インクルードを gtkmm 2.4 に戻す場合 ( pkg-config gtkmm-3.0 --cflags --libs
gtkmm-2.4 に戻すことによって) には当てはまりません。
(code::blocks 内から) ヘッダーをたどりましたが、関数ヘッダーは間違いなくそこにあります。Gtk::Widget::modify_font も減価償却されたようには見えません。
その Gtk::TextView に関して私のクラス階層がどのように見えるかの例:
// The parent of the offending TextView
class popupWindow : public Gtk::Window
{
public:
popupWindow();
private:
Gtk::TextView theView;
Gtk::ScrolledWindow scrollView;
Gtk::VBox layoutBox;
Glib::RefPtr<Gtk::TextBuffer> textBuffer;
};
// The main window class
class mainWindow : public Gtk::Window
{
private:
popupWindow foo;
};
// Part of the header where I try and set the modified font
popupWindow::popupwindow() : layoutBox(false, 8)
{
// Modify the font styling of the TextView
{
Pango::FontDescription fdesc;
fdesc.set_family("monospace");
fdesc.set_size(10 * PANGO_SCALE);
theView.modify_font(fdesc);
}
// Make a new text buffer
textBuffer = Gtk::TextBuffer::create();
add(layoutBox);
layoutBox.pack_start(scrollView);
scrollView.add(theView);
theView.set_buffer(textBuffer);
}