Compiling under Windows using MSCV

2008-04-29 Thread oscar pablo di liscia
Im am trying to compile GTK applications using MSCV 6.0.
I downlodaded and instaled all the GTK packages. When I
try to compile a simple sample project everything seems fine until
this  error pops up:
[EMAIL PROTECTED] unresolved external
I don´t have this problem compiling with Mingw.
I am new in this list and probably this is a very common error already
commented, but I could not find  any cue un the list.
Any help will be welcome.
Best
Oscar
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Linking against iconv in a non-standard dir

2008-04-29 Thread Dean
Hi gtk-list,

I am trying to build glib-2.14.6 against libiconv in an odd directory. 
(Solaris10, sparc).  configure runs fine, but the build fails with

ld: fatal: library -liconv: not found

I've tried all kinds of combinations of LDFLAGS and CPPFLAGS, but can't get ld 
to find iconv.  (It does exist where I've told ld to look.)  I'm kinda flailing 
around looking for the right flags now.

config.log is at http://deanandadie.net/config.log.txt

script I use to run ./configure:

#!/usr/bin/sh

SOFTDIST_DIR="/usr/dist/share"
OS=`uname -r`
ARCH="sun4"

PACKAGE="glib"
VERSION="2.14.6"

PREFIX="${SOFTDIST_DIR}/${PACKAGE},v${VERSION}"

LIBICONV_DIR="${SOFTDIST_DIR}/libiconv,v1.9.2"
GETTEXT_DIR="${SOFTDIST_DIR}/gettext,v0.17"

LD_LIBRARY_PATH="${LIBICONV_DIR}/${OS}-lib.${ARCH}:${GETTEXT_DIR}/${OS}-lib.${ARCH}";
 
export LD_LIBRARY_PATH

LDFLAGS="-L ${LIBICONV_DIR}/${OS}-lib.${ARCH} -L 
${GETTEXT_DIR}/${OS}-lib.${ARCH} -R ${LD_LIBRARY_PATH}"; export LDFLAGS

CPPFLAGS="-I ${LIBICONV_DIR}/${OS}-include.${ARCH} -I 
${GETTEXT_DIR}/${OS}-include.${ARCH}"; export CPPFLAGS

PKG_CONFIG="${SOFTDIST_DIR}/pkg-config,v0.23/${OS}-bin.${ARCH}/pkg-config"; 
export PKG_CONFIG

#PKG_CONFIG_PATH=

#CC=cc; export CC
#CXX=CC; export CXX

CFLAGS="-mcpu=v9"; export CFLAGS

./configure --prefix=${PREFIX} \
 --bindir=${PREFIX}/${OS}-bin.${ARCH} \
 --libdir=${PREFIX}/${OS}-lib.${ARCH} \
 --includedir=${PREFIX}/${OS}-include.${ARCH} \
 --mandir=${PREFIX}/doc/man \
 --with-libiconv=gnu

And the failure:

  gcc -shared -Wl,-M -Wl,.libs/libglib-2.0.so.0.1400.6.exp -Wl,-h 
-Wl,libglib-2.0.so.0 -o .libs/libglib-2.0.so.0.1400.6  .libs/garray.o 
.libs/gasyncqueue.o .libs/gatomic.o .libs/gbacktrace.o .libs/gbase64.o 
.libs/gbookmarkfile.o .libs/gcache.o .libs/gcompletion.o .libs/gconvert.o 
.libs/gdataset.o .libs/gdate.o .libs/gdir.o .libs/gerror.o .libs/gfileutils.o 
.libs/ghash.o .libs/ghook.o .libs/giochannel.o .libs/gkeyfile.o .libs/glist.o 
.libs/gmain.o .libs/gmappedfile.o .libs/gmarkup.o .libs/gmem.o 
.libs/gmessages.o 
.libs/gnode.o .libs/goption.o .libs/gpattern.o .libs/gprimes.o .libs/gqsort.o 
.libs/gqueue.o .libs/grel.o .libs/grand.o .libs/gregex.o .libs/gscanner.o 
.libs/gsequence.o .libs/gshell.o .libs/gslice.o .libs/gslist.o .libs/gstdio.o 
.libs/gstrfuncs.o .libs/gstring.o .libs/gthread.o .libs/gthreadpool.o 
.libs/gtimer.o .libs/gtree.o .libs/guniprop.o .libs/gutf8.o .libs/gunibreak.o 
.libs/gunicollate.o .libs/gunidecomp.o .libs/gutils.o .libs/gprintf.o 
.libs/giounix.o .libs/gspawn.o -Wl,-z -Wl,allextract 
libcharset/.libs/libcharset.a pcre/.libs/libpcre.a -Wl,-z -Wl,defaultextract 
-R/usr/dist/share/libiconv,v1.9.2/5.10-lib.sun4:/usr/dist/share/gettext,v0.17/5.10-lib.sun4
 
-L/home/brundage/work/csc_sun_work/SR195558/artifacts/build/glib-2.14.6/glib 
-L/home/brundage/work/csc_sun_work/SR195558/artifacts/build/glib-2.14.6/glib/libcharset
 
-liconv 
-L/home/brundage/work/csc_sun_work/SR195558/artifacts/build/glib-2.14.6/glib/pcre
 
-lintl -lc  -mcpu=v9

ld: fatal: library -liconv: not found


0 ccs-v440-01:2.0 build/glib-2.14.6 % ls 
/usr/dist/share/libiconv,v1.9.2/5.10-lib.sun4
charset.aliaslibcharset.so.1  libiconv.so.2
libcharset.a libcharset.so.1.0.0  libiconv.so.2.2.0
libcharset.lalibiconv.la  libiconv_plug.so
libcharset.solibiconv.so


--Dean - Unscrambler of eggs
--
Take your time, take your chances
[2045.2, 273.7] Apparent Rennerian
-
It matters not how strait the gate / How charged with punishment the scroll
I am the master of my fate / I am the captain of my soul.  -- Invictus --
-- William E Henley --
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Question about pixbuf

2008-04-29 Thread Emmanuele Bassi

On Tue, 2008-04-29 at 12:48 -0500, Moises wrote:
> I am working with openGL and GTK+, and I am loading
> Images with gdk_pixbuf_new_from_file() for generate
> the textures, when I generate opengl texture I will
> not need the pixbuf, then I have to free the memory of
> the image, my question is, as I free memory of
> pixbuf?

GdkPixbuf is a GObject, so the usual GObject API for decreasing the
reference count will apply:

  g_object_unref (pixbuf);

if the reference count hit 0 then the pixbuf will be disposed and all
its associated data will be released.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net

___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Question about pixbuf

2008-04-29 Thread Moises
I am working with openGL and GTK+, and I am loading
Images with gdk_pixbuf_new_from_file() for generate
the textures, when I generate opengl texture I will
not need the pixbuf, then I have to free the memory of
the image, my question is, as I free memory of
pixbuf?, I looked at the documentation of pixbuf  but
only  this function gdk_pixbuf_loader_close() but this
function is for pixbufloader.


  

Yahoo! Deportes Beta
¡No te pierdas lo último sobre el torneo clausura 2008! Entérate aquí 
http://deportes.yahoo.com
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Popup Scrollbar Concept

2008-04-29 Thread Alexandre Moreira
On Mon, Apr 28, 2008 at 3:26 PM, Thorsten Wilms <[EMAIL PROTECTED]> wrote:
> Hi!
>
>  I would love to see popup scrollbars in GTK. Since the concept is a bit
>  hard to explain/imagine, I made a PyGTK demo (and that's the top of my
>  coding skills so far).
>

Nice! I don't know if it would be implemented, because it is too
different and stuff like that but I sure like it.

Sweet Concept!

** wishes it would be implemented (at least as a compile option, or
even better, runtime option), but I don't have high hopes for it... **


Regards,
Alexandre Moreira.

>  There's a feature request and the file is attached there:
>  http://bugzilla.gnome.org/show_bug.cgi?id=530413
>  http://bugzilla.gnome.org/attachment.cgi?id=110053&action=view
>
>  But if you do like it a bit more wordy, here's the initial concept:
>  http://thorwil.wordpress.com/2007/05/31/scrollbars-with-popups/
>
>
>  --
>  Thorsten Wilms
>
>  thorwil's design for free software:
>  http://thorwil.wordpress.com/
>
>  ___
>  gtk-list mailing list
>  gtk-list@gnome.org
>  http://mail.gnome.org/mailman/listinfo/gtk-list
>
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to put widget in CUSTOM GtkContainer

2008-04-29 Thread Tomas Carnecky
AlannY wrote:
> Tomas Carnecky wrote:
>> AlannY wrote:
>> That still isn't the whole code! What does grid_class_init() do? Attach 
>> both the whole grid header and source file to the email.
> 
> /* ** */
> 
> static void
> grid_class_init (GridClass *class)
> {
>GtkObjectClass *object_class;
>GtkWidgetClass *widget_class;
> 
>object_class = (GtkObjectClass*) class;
>widget_class = (GtkWidgetClass*) class;
> 
>parent_class = gtk_type_class (gtk_widget_get_type ());
> 
>object_class->destroy = grid_destroy;
> 
>widget_class->realize = grid_realize;
>widget_class->expose_event = grid_expose;

here you have to set GtkContainerClass->add, remove, forall and 
child_type. See 
http://svn.gnome.org/viewvc/gtk%2B/trunk/gtk/gtkbin.c?revision=19491&view=markup
 
as an example of a widget that derives from GtkContainer.

> }
> 
> /* ** */
> static void
> grid_init (Grid *grid)
> {
> }
> 
> /* ** */
> static void
> grid_realize (GtkWidget *widget)
> {
>Grid *grid;
>GdkWindowAttr attributes;
>gint attributes_mask;
> 
>g_return_if_fail (widget != NULL);
>g_return_if_fail (IS_GRID (widget));
> 
>GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
>grid = GRID (widget);
> 
>attributes.x = widget->allocation.x;
>attributes.y = widget->allocation.y;
>attributes.width = widget->allocation.width;
>attributes.height = widget->allocation.height;
>attributes.wclass = GDK_INPUT_OUTPUT;
>attributes.window_type = GDK_WINDOW_CHILD;
>attributes.event_mask = gtk_widget_get_events (widget) | 
> GDK_EXPOSURE_MASK;
>attributes.visual = gtk_widget_get_visual (widget);
>attributes.colormap = gtk_widget_get_colormap (widget);
> 
>attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
>widget->window = gdk_window_new (widget->parent->window, &attributes, 
> attributes_mask);
> 
>widget->style = gtk_style_attach (widget->style, widget->window);
> 
>gdk_window_set_user_data (widget->window, widget);
> 
>gtk_style_set_background (widget->style, widget->window, 
> GTK_STATE_ACTIVE);
> }
> 
> /* ** */
> static gboolean
> grid_expose (GtkWidget *widget,
>   GdkEventExpose *event)
> {
>g_return_val_if_fail (widget != NULL, FALSE);
>g_return_val_if_fail (IS_GRID (widget), FALSE);
>g_return_val_if_fail (event != NULL, FALSE);
> 
>if (event->count > 0)
>  return FALSE;
> 
>return FALSE;
> }
> 
> /* ** */
> static void
> grid_destroy (GtkObject *object)
> {
>g_return_if_fail (object != NULL);
>g_return_if_fail (IS_GRID (object));
> 
>if (GTK_OBJECT_CLASS (parent_class)->destroy)
>  (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
> }
> 
> /* ** */
> 
> That's all I have ;-)
> ___
> gtk-app-devel-list mailing list
> [EMAIL PROTECTED]
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 


-- 
So Long, and Thanks for All the Fish
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to put widget in CUSTOM GtkContainer

2008-04-29 Thread Emmanuele Bassi

On Tue, 2008-04-29 at 18:03 +0400, AlannY wrote:
> Milosz Derezynski wrote:
> > I don't believe that using set_parent() will actually place the widget 
> > inside the container; try gtk_container_add(GTK_CONTAINER(grid), 
> > widget); instead
> 
> I don't believe in it too ;-) So I decide to ask what to do ;-)
> gtk_container_add not works ;-)

could you please stop wincing? it's neither funny nor appropriate.

you're not implementing the GtkContainer virtual functions. you're also
adding a GdkWindow to a container widget - which is not recommended.

you should read the tutorial on how to subclass a GObject first:

  http://library.gnome.org/devel/gobject/stable/howto-gobject.html

and then read the documentation and implementations of GtkContainer,
starting with something simple like GtkBin.

you might also ponder on switching to another language altogether.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net

___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to put widget in CUSTOM GtkContainer

2008-04-29 Thread AlannY
Milosz Derezynski wrote:
> I don't believe that using set_parent() will actually place the widget 
> inside the container; try gtk_container_add(GTK_CONTAINER(grid), 
> widget); instead

I don't believe in it too ;-) So I decide to ask what to do ;-)
gtk_container_add not works ;-)
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to put widget in CUSTOM GtkContainer

2008-04-29 Thread AlannY
Tomas Carnecky wrote:
> AlannY wrote:
> That still isn't the whole code! What does grid_class_init() do? Attach 
> both the whole grid header and source file to the email.

/* ** */

static void
grid_class_init (GridClass *class)
{
   GtkObjectClass *object_class;
   GtkWidgetClass *widget_class;

   object_class = (GtkObjectClass*) class;
   widget_class = (GtkWidgetClass*) class;

   parent_class = gtk_type_class (gtk_widget_get_type ());

   object_class->destroy = grid_destroy;

   widget_class->realize = grid_realize;
   widget_class->expose_event = grid_expose;
}

/* ** */
static void
grid_init (Grid *grid)
{
}

/* ** */
static void
grid_realize (GtkWidget *widget)
{
   Grid *grid;
   GdkWindowAttr attributes;
   gint attributes_mask;

   g_return_if_fail (widget != NULL);
   g_return_if_fail (IS_GRID (widget));

   GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
   grid = GRID (widget);

   attributes.x = widget->allocation.x;
   attributes.y = widget->allocation.y;
   attributes.width = widget->allocation.width;
   attributes.height = widget->allocation.height;
   attributes.wclass = GDK_INPUT_OUTPUT;
   attributes.window_type = GDK_WINDOW_CHILD;
   attributes.event_mask = gtk_widget_get_events (widget) | 
GDK_EXPOSURE_MASK;
   attributes.visual = gtk_widget_get_visual (widget);
   attributes.colormap = gtk_widget_get_colormap (widget);

   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
   widget->window = gdk_window_new (widget->parent->window, &attributes, 
attributes_mask);

   widget->style = gtk_style_attach (widget->style, widget->window);

   gdk_window_set_user_data (widget->window, widget);

   gtk_style_set_background (widget->style, widget->window, 
GTK_STATE_ACTIVE);
}

/* ** */
static gboolean
grid_expose (GtkWidget *widget,
  GdkEventExpose *event)
{
   g_return_val_if_fail (widget != NULL, FALSE);
   g_return_val_if_fail (IS_GRID (widget), FALSE);
   g_return_val_if_fail (event != NULL, FALSE);

   if (event->count > 0)
 return FALSE;

   return FALSE;
}

/* ** */
static void
grid_destroy (GtkObject *object)
{
   g_return_if_fail (object != NULL);
   g_return_if_fail (IS_GRID (object));

   if (GTK_OBJECT_CLASS (parent_class)->destroy)
 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}

/* ** */

That's all I have ;-)
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to put widget in CUSTOM GtkContainer

2008-04-29 Thread Milosz Derezynski
I don't believe that using set_parent() will actually place the widget
inside the container; try gtk_container_add(GTK_CONTAINER(grid), widget);
instead

2008/4/29 Tomas Carnecky <[EMAIL PROTECTED]>:

> AlannY wrote:
> > Hi there, my name is Alan and I have some troubles with GtkContainer.
> >
> > It's about 2 days, I already have spent trying to solve it, but I (i
> > guess) can't.
> >
> > I'm writing a program, which looks like:
> > +-+
> > | Main Window (GtkWindow) |
> > | +-+ |
> > | | My custom widget| |
> > | | +-+ | |
> > | | | GtkButton   | | |
> > | | +-+ | |
> > | +-+ |
> > +-+
> >
> > I need some approach to place a GtkButton in my custom widget. I found
> > (from GTK+ sources) that GtkTreeView, GtkNotebook (and others) inherits
> > from GtkContainer . So, I decide to inherit my widget not from
> > GtkWidget, but from GtkContainer.
> >
> > typedef struct _GridGrid;
> > typedef struct _GridClass   GridClass;
> >
> > struct _Grid
> > {
> >GtkContainer parent;
> > };
> >
> > struct _GridClass
> > {
> >GtkContainerClass parent_class;
> > };
> >
> > And my _get_type function looks like:
> >
> > GtkType
> > grid_get_type ()
> > {
> >static GtkType grid_type = 0;
> >
> >if (!grid_type)
> >  {
> >const GTypeInfo object_info =
> >{
> >   sizeof (GtkContainerClass),
> >   NULL,
> >  NULL,
> >   (GClassInitFunc) grid_class_init,
>
> That still isn't the whole code! What does grid_class_init() do? Attach
> both the whole grid header and source file to the email.
>
> >   NULL,
> >   NULL,
> >   sizeof (Grid),
> >   0,
> >   (GInstanceInitFunc) grid_init,
> >   NULL,
> >};
> >
> >grid_type = g_type_register_static (GTK_TYPE_CONTAINER,
> > g_intern_static_string ("Grid"), &object_info, 0);
> >  }
> >
> >return grid_type;
> > }
> >
> > The main feature of this function is GTK_TYPE_CONTAINER ;-) You see ;-)
> >
> > Next in my program, I'm creating my widget (grid) with that:
> >
> > [...]
> > grid = grid_new ();
> > gtk_container_add (GTK_CONTAINER (window), grid);
> > [...]
> >
> > So, my problem starts here: at _new() function. I want to create
> > GtkButton and place it in my widget.
> >
> > GtkWidget*
> > grid_new ()
> > {
> >Grid *grid;
> >
> >grid = g_object_new (grid_get_type (), NULL);
> >
> >button = gtk_button_new_with_label ("Test");
> >gtk_widget_set_parent (button, GTK_WIDGET (grid));
> >gtk_widget_show (button);
> >
> >return GTK_WIDGET (grid);
> > }
> >
> > Everything right and works without errors ;-) But nothing happens. I
> > can't see a GtkButton ;-)
> >
> > How to solve it? I need some way for "draw" (expose) GtkButton in my
> > custom widget ;-) How to do it?
> >
> > P.S. I extremely think, that I just forgot something. But there are no
> > tutorials about it ;-) "Information vacuum", so I decide to ask in
> > mailing-lists.
> > P.P.S. Only information about custom widget creation is a GTK sources,
> > but (even with it) I can't solve my problem. ;-)
> > P.P.P.S. Also, I really want to understand how GtkBox works ;-)
>
> And stop creating new threads... This is your third thread in
> gtk-app-devel where you ask the same question.
>
> tom
>
> ___
> gtk-list mailing list
> gtk-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to put widget in CUSTOM GtkContainer

2008-04-29 Thread Tomas Carnecky
AlannY wrote:
> Hi there, my name is Alan and I have some troubles with GtkContainer.
> 
> It's about 2 days, I already have spent trying to solve it, but I (i 
> guess) can't.
> 
> I'm writing a program, which looks like:
> +-+
> | Main Window (GtkWindow) |
> | +-+ |
> | | My custom widget| |
> | | +-+ | |
> | | | GtkButton   | | |
> | | +-+ | |
> | +-+ |
> +-+
> 
> I need some approach to place a GtkButton in my custom widget. I found 
> (from GTK+ sources) that GtkTreeView, GtkNotebook (and others) inherits 
> from GtkContainer . So, I decide to inherit my widget not from 
> GtkWidget, but from GtkContainer.
> 
> typedef struct _GridGrid;
> typedef struct _GridClass   GridClass;
> 
> struct _Grid
> {
>GtkContainer parent;
> };
> 
> struct _GridClass
> {
>GtkContainerClass parent_class;
> };
> 
> And my _get_type function looks like:
> 
> GtkType
> grid_get_type ()
> {
>static GtkType grid_type = 0;
> 
>if (!grid_type)
>  {
>const GTypeInfo object_info =
>{
>   sizeof (GtkContainerClass),
>   NULL,
>  NULL,
>   (GClassInitFunc) grid_class_init,

That still isn't the whole code! What does grid_class_init() do? Attach 
both the whole grid header and source file to the email.

>   NULL,
>   NULL,
>   sizeof (Grid),
>   0,
>   (GInstanceInitFunc) grid_init,
>   NULL,
>};
> 
>grid_type = g_type_register_static (GTK_TYPE_CONTAINER, 
> g_intern_static_string ("Grid"), &object_info, 0);
>  }
> 
>return grid_type;
> }
> 
> The main feature of this function is GTK_TYPE_CONTAINER ;-) You see ;-)
> 
> Next in my program, I'm creating my widget (grid) with that:
> 
> [...]
> grid = grid_new ();
> gtk_container_add (GTK_CONTAINER (window), grid);
> [...]
> 
> So, my problem starts here: at _new() function. I want to create 
> GtkButton and place it in my widget.
> 
> GtkWidget*
> grid_new ()
> {
>Grid *grid;
> 
>grid = g_object_new (grid_get_type (), NULL);
> 
>button = gtk_button_new_with_label ("Test");
>gtk_widget_set_parent (button, GTK_WIDGET (grid));
>gtk_widget_show (button);
> 
>return GTK_WIDGET (grid);
> }
> 
> Everything right and works without errors ;-) But nothing happens. I 
> can't see a GtkButton ;-)
> 
> How to solve it? I need some way for "draw" (expose) GtkButton in my 
> custom widget ;-) How to do it?
> 
> P.S. I extremely think, that I just forgot something. But there are no 
> tutorials about it ;-) "Information vacuum", so I decide to ask in 
> mailing-lists.
> P.P.S. Only information about custom widget creation is a GTK sources, 
> but (even with it) I can't solve my problem. ;-)
> P.P.P.S. Also, I really want to understand how GtkBox works ;-)

And stop creating new threads... This is your third thread in 
gtk-app-devel where you ask the same question.

tom

___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


How to put widget in CUSTOM GtkContainer

2008-04-29 Thread AlannY
Hi there, my name is Alan and I have some troubles with GtkContainer.

It's about 2 days, I already have spent trying to solve it, but I (i 
guess) can't.

I'm writing a program, which looks like:
+-+
| Main Window (GtkWindow) |
| +-+ |
| | My custom widget| |
| | +-+ | |
| | | GtkButton   | | |
| | +-+ | |
| +-+ |
+-+

I need some approach to place a GtkButton in my custom widget. I found 
(from GTK+ sources) that GtkTreeView, GtkNotebook (and others) inherits 
from GtkContainer . So, I decide to inherit my widget not from 
GtkWidget, but from GtkContainer.

typedef struct _GridGrid;
typedef struct _GridClass   GridClass;

struct _Grid
{
   GtkContainer parent;
};

struct _GridClass
{
   GtkContainerClass parent_class;
};

And my _get_type function looks like:

GtkType
grid_get_type ()
{
   static GtkType grid_type = 0;

   if (!grid_type)
 {
   const GTypeInfo object_info =
   {
sizeof (GtkContainerClass),
NULL,
 NULL,
(GClassInitFunc) grid_class_init,
NULL,
NULL,
sizeof (Grid),
0,
(GInstanceInitFunc) grid_init,
NULL,
   };

   grid_type = g_type_register_static (GTK_TYPE_CONTAINER, 
g_intern_static_string ("Grid"), &object_info, 0);
 }

   return grid_type;
}

The main feature of this function is GTK_TYPE_CONTAINER ;-) You see ;-)

Next in my program, I'm creating my widget (grid) with that:

[...]
grid = grid_new ();
gtk_container_add (GTK_CONTAINER (window), grid);
[...]

So, my problem starts here: at _new() function. I want to create 
GtkButton and place it in my widget.

GtkWidget*
grid_new ()
{
   Grid *grid;

   grid = g_object_new (grid_get_type (), NULL);

   button = gtk_button_new_with_label ("Test");
   gtk_widget_set_parent (button, GTK_WIDGET (grid));
   gtk_widget_show (button);

   return GTK_WIDGET (grid);
}

Everything right and works without errors ;-) But nothing happens. I 
can't see a GtkButton ;-)

How to solve it? I need some way for "draw" (expose) GtkButton in my 
custom widget ;-) How to do it?

P.S. I extremely think, that I just forgot something. But there are no 
tutorials about it ;-) "Information vacuum", so I decide to ask in 
mailing-lists.
P.P.S. Only information about custom widget creation is a GTK sources, 
but (even with it) I can't solve my problem. ;-)
P.P.P.S. Also, I really want to understand how GtkBox works ;-)

Thank you.
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: who define *_parent_class variable ?

2008-04-29 Thread KLEIN Stéphane
Le Tue, 29 Apr 2008 09:31:19 +0200, Jean Bréfort a écrit :

> Le mardi 29 avril 2008 à 07:05 +, KLEIN Stéphane a écrit :
>> Le Tue, 29 Apr 2008 07:22:24 +0200, Jean Bréfort a écrit :
>> 
>> > Le lundi 28 avril 2008 à 21:07 +, KLEIN Stephane a écrit :
>> >> Hello,
>> >> 
>> >> in many gobject source code I've some variable named
>> >> "foo_bar_parent_class". Example in gedit source code :
>> >> 
>> >> * gedit_view_parent_class
>> >> * gedit_tab_parent_class
>> >> * gedit_statusbar_parent_class
>> >> 
>> >> I would like to know what is the macro definition that define this
>> >> variable ? In gobject document, I found this : G_DEFINE_TYPE() [1]
>> >> but this macro is never called in previous examples (gedit source
>> >> code).
>> >> 
>> >> Someone can tell to me what define *_parent_class variable ?
>> >> 
>> >> Thanks for your help,
>> >> Stephane
>> >> 
>> >> [1] http://library.gnome.org/devel/gobject/2.6/gobject-Type-
>> >> Information.html#G-DEFINE-TYPE:CAPS
>> > 
>> > In your foo_bar_class_init function, add this line:
>> > 
>> > foo_bar_parent_klass = g_type_class_peek_parent (klass);
>> 
>> In gedit source code, there aren't *_parent_class =
>> g_type_class_peek_parent(klass)
>> 
>> Example, I don't found it for :
>> 
>> * gedit_view_parent_class
>> * gedit_tab_parent_class
>> * gedit_statusbar_parent_class
>> 
>> I think there are a macro whose do it but who and where ?
>> 
>> Regards,
>> Stephane
>> 
>> 
> Look at the G_DEFINE_TYPE macro.

Yes, is that :

G_DEFINE_TYPE(GeditStatusbar, gedit_statusbar, GTK_TYPE_STATUSBAR)

Thanks,
Stephane


___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: who define *_parent_class variable ?

2008-04-29 Thread Jean Bréfort
Le mardi 29 avril 2008 à 07:05 +, KLEIN Stéphane a écrit :
> Le Tue, 29 Apr 2008 07:22:24 +0200, Jean Bréfort a écrit :
> 
> > Le lundi 28 avril 2008 à 21:07 +, KLEIN Stephane a écrit :
> >> Hello,
> >> 
> >> in many gobject source code I've some variable named
> >> "foo_bar_parent_class". Example in gedit source code :
> >> 
> >> * gedit_view_parent_class
> >> * gedit_tab_parent_class
> >> * gedit_statusbar_parent_class
> >> 
> >> I would like to know what is the macro definition that define this
> >> variable ? In gobject document, I found this : G_DEFINE_TYPE() [1] but
> >> this macro is never called in previous examples (gedit source code).
> >> 
> >> Someone can tell to me what define *_parent_class variable ?
> >> 
> >> Thanks for your help,
> >> Stephane
> >> 
> >> [1] http://library.gnome.org/devel/gobject/2.6/gobject-Type-
> >> Information.html#G-DEFINE-TYPE:CAPS
> > 
> > In your foo_bar_class_init function, add this line:
> > 
> > foo_bar_parent_klass = g_type_class_peek_parent (klass);
> 
> In gedit source code, there aren't *_parent_class = 
> g_type_class_peek_parent(klass)
> 
> Example, I don't found it for :
> 
> * gedit_view_parent_class
> * gedit_tab_parent_class
> * gedit_statusbar_parent_class
> 
> I think there are a macro whose do it but who and where ?
> 
> Regards,
> Stephane
> 

Look at the G_DEFINE_TYPE macro.

___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: who define *_parent_class variable ?

2008-04-29 Thread KLEIN Stéphane
Le Tue, 29 Apr 2008 07:22:24 +0200, Jean Bréfort a écrit :

> Le lundi 28 avril 2008 à 21:07 +, KLEIN Stephane a écrit :
>> Hello,
>> 
>> in many gobject source code I've some variable named
>> "foo_bar_parent_class". Example in gedit source code :
>> 
>> * gedit_view_parent_class
>> * gedit_tab_parent_class
>> * gedit_statusbar_parent_class
>> 
>> I would like to know what is the macro definition that define this
>> variable ? In gobject document, I found this : G_DEFINE_TYPE() [1] but
>> this macro is never called in previous examples (gedit source code).
>> 
>> Someone can tell to me what define *_parent_class variable ?
>> 
>> Thanks for your help,
>> Stephane
>> 
>> [1] http://library.gnome.org/devel/gobject/2.6/gobject-Type-
>> Information.html#G-DEFINE-TYPE:CAPS
> 
> In your foo_bar_class_init function, add this line:
> 
> foo_bar_parent_klass = g_type_class_peek_parent (klass);

In gedit source code, there aren't *_parent_class = 
g_type_class_peek_parent(klass)

Example, I don't found it for :

* gedit_view_parent_class
* gedit_tab_parent_class
* gedit_statusbar_parent_class

I think there are a macro whose do it but who and where ?

Regards,
Stephane


___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list