gtk-- newbie question


I'm a rank newbie to Gnome, and I have a really dumb question about how
to use gtk--. I am having trouble with figuring out how drawing primitives

 Here's my pathetic attempt at drawing a rectangle in a window:

#include <gtk--.h>

// Attempt to draw a rectangle - this doesn't work because I'm
// doing something hideously boneheaded

class HexWindow : public Gtk_Window {
   Gtk_DrawingArea *d_area;

   HexWindow() : d_area( new Gtk_DrawingArea() ){
       set_title("Here is a rectangle");

int main( int argc, char **argv )

   Gtk_Main m( &argc, &argv );
   HexWindow w;;;
   return 0;


I compile with:

$ g++ `gtkmm-config --cflags` -o hello hello.C `gtkmm-config --libs`

and get this compiler error:

hello.C: In method `HexWindow::HexWindow()':
hello.C:15: no matching function for call to
`Gtk_DrawingArea::draw_rectangle (HexWindow *, bool, int, int, int,

 Perhaps someone could fix my rotten code and demonstrate the correct
way to draw the rectangle in a window? I know I am missing something
obvious but this is the best I could do with my poor understanding of
the gtk-- source code.

 Many thanks for any hints. If this is the wrong forum for gtk-- questions,
please let me know where I should go.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]