Antonio Coralles a écrit :
Yann Normand wrote:
Antonio Coralles a écrit :
I'm really courious about the classes in Gnome::Canvasmm, but only with
the reference, i'm somekind of lost, as i dont't have any Gtk+
background ... So, what i want to know is, if there are some simple
examples, or a tutorial which illustrates the usage of this classes. At
the moment i don't even know how to create a gtkmm app which uses a
Canvas to display some text ...
Thanks, Antonio
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org <mailto:gtkmm-list gnome org>
http://mail.gnome.org/mailman/listinfo/gtkmm-list
Unfortunately, there is no good tutorial the Gnome Canvas with Gtkmm.
However, you will easily find tutorials on the Gnome Canvas in C. You
should have no problem porting the examples with Gnomecanvasmm . But be
careful because the tutorials I read on the web are quite old, and
therefore were written for the first API version of Gnome Canvas (we are
now at 2.10). Nevertheless, the differences aren't heavy.
The Canvas object inherits from Gtk::Widget. Thus, you can add it to a
container just like any widget. It is common to add the Canvas to a
ScrolledWindow permitting to easily scroll through the Canvas.
I agree that the Gnomecanvasmm reference is poor. You should have a look
at the Gnome Canvas API Reference instead.
--
Yann Normand
Sogeti-Transiciel
Thanks for your tipp ... maybe sombody knows why the follwoing code:
#include <gtkmm/window.h>
#include <gtkmm/main.h>
#include <libgnomecanvasmm/canvas.h>
#include <libgnomecanvasmm/text.h>
#include <libgnomecanvasmm/init.h>
using namespace Gtk;
class CanvasWindow : public Window
{
public:
CanvasWindow() : _text(*_canvas.root(), 0, 0, "Hey")
{
set_size_request(400, 400);
add(_canvas);
show_all_children();
}
virtual ~CanvasWindow() {}
private:
Gnome::Canvas::Canvas _canvas;
Gnome::Canvas::Text _text;
};
int main(int argc, char **argv)
{
Gnome::Canvas::init();
Main kit(argc, argv);
CanvasWindow win;
Main::run(win);
}
leads directly to a segfault (i'm using canvasmm-2.6.1). gdb says
Program received signal SIGSEGV, Segmentation fault.
0xb7fb0fa2 in Gnome::Canvas::Item::item_construct () from
/usr/lib/libgnomecanvasmm-2.6.so.1
(gdb) back
#0 0xb7fb0fa2 in Gnome::Canvas::Item::item_construct () from
/usr/lib/libgnomecanvasmm-2.6.so.1
#1 0xb7fbacd3 in Gnome::Canvas::Text::Text () from
/usr/lib/libgnomecanvasmm-2.6.so.1
#2 0x0804beaf in CanvasWindow::CanvasWindow ()
#3 0x0804bd04 in main ()
Thanks,
Antonio
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
I tried your source and it runs fine. I use the version 2.10.0 of
canvasmm
--
Yann Normand
Sogeti-Transiciel
|