Re: Can put a GtkLayout in a GtkListBox

2014-11-05 Thread Tristan Van Berkom
On Wed, 2014-11-05 at 13:08 +0100, Cedric Bellegarde wrote:
 Hello, in this code, adding a layout to a GtkListBox do not show layout 
 content :(
 
 What am i missing?
 

A GtkLayout is like a GtkViewport which you can place widgets at
specific locations and draw on etc, it has the special property
that it does not require space (typically it's used in a scrolled
window).

The reason you would not see the label would be that the layout
does not have any specific size request and as such does not get
allocated any space, so anything packed inside it would be clipped
away from view.

Cheers,
-Tristan

 regards,
 
 from gi.repository import Gtk
 
 class mywindow(Gtk.Window):
 
 def __init__(self):
 Gtk.Window.__init__(self, title=Hello)
 box = Gtk.ListBox()
 label = Gtk.Label(Hello)
 label2 = Gtk.Label(Hello2)
 layout = Gtk.Layout()
 layout.put(label, 0, 0)
 box.add(layout)
 box.add(label2)
 self.add(box)
 
 win = mywindow()
 win.connect(delete-event, Gtk.main_quit)
 win.show_all()
 win.resize(300, 300)
 Gtk.main()
 
 --
 Cédric Bellegarde
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Can put a GtkLayout in a GtkListBox

2014-11-05 Thread Cedric Bellegarde

Ok, so here another question...

I want to implement drag and drop in a gtklistbox.

If i add buttons to gtklistbox, set button as drag source, it works.

If i add complex widgets to gtklistbox, as my container (gtkgrid) 
doesn't have a window, it fails to be a drag source.


That's why i'm looking for a container with a window (and tried with 
GtkLayout)


https://wiki.gnome.org/GnomeLove/DragNDropTutorial
Note that these GTK+ widgets must have an associated X Window, check 
using GTK_WIDGET_NO_WINDOW(widget)).


any idea?

regards
--
Cédric Bellegarde

Le mer. 5 nov. 2014 à 13:28, Tristan Van Berkom 
tris...@upstairslabs.com a écrit :

On Wed, 2014-11-05 at 13:08 +0100, Cedric Bellegarde wrote:
 Hello, in this code, adding a layout to a GtkListBox do not show 
layout

 content :(

 What am i missing?



A GtkLayout is like a GtkViewport which you can place widgets at
specific locations and draw on etc, it has the special property
that it does not require space (typically it's used in a scrolled
window).

The reason you would not see the label would be that the layout
does not have any specific size request and as such does not get
allocated any space, so anything packed inside it would be clipped
away from view.

Cheers,
-Tristan


 regards,

 from gi.repository import Gtk

 class mywindow(Gtk.Window):

 def __init__(self):
 Gtk.Window.__init__(self, title=Hello)
 box = Gtk.ListBox()
 label = Gtk.Label(Hello)
 label2 = Gtk.Label(Hello2)
 layout = Gtk.Layout()
 layout.put(label, 0, 0)
 box.add(layout)
 box.add(label2)
 self.add(box)

 win = mywindow()
 win.connect(delete-event, Gtk.main_quit)
 win.show_all()
 win.resize(300, 300)
 Gtk.main()

 --
 Cédric Bellegarde
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Can put a GtkLayout in a GtkListBox

2014-11-05 Thread Cédric Bellegarde

Ok, just need to add an eventbox...

regards,
--
Cédric

Le mer. 5 nov. 2014 à 14:41, Cedric Bellegarde gnu...@gmail.com a 
écrit :

Ok, so here another question...

I want to implement drag and drop in a gtklistbox.

If i add buttons to gtklistbox, set button as drag source, it works.

If i add complex widgets to gtklistbox, as my container (gtkgrid) 
doesn't have a window, it fails to be a drag source.


That's why i'm looking for a container with a window (and tried with 
GtkLayout)


https://wiki.gnome.org/GnomeLove/DragNDropTutorial
Note that these GTK+ widgets must have an associated X Window, check 
using GTK_WIDGET_NO_WINDOW(widget)).


any idea?

regards
--
Cédric Bellegarde

Le mer. 5 nov. 2014 à 13:28, Tristan Van Berkom 
tris...@upstairslabs.com a écrit :

On Wed, 2014-11-05 at 13:08 +0100, Cedric Bellegarde wrote:
 Hello, in this code, adding a layout to a GtkListBox do not show 
layout

 content :(

 What am i missing?



A GtkLayout is like a GtkViewport which you can place widgets at
specific locations and draw on etc, it has the special property
that it does not require space (typically it's used in a scrolled
window).

The reason you would not see the label would be that the layout
does not have any specific size request and as such does not get
allocated any space, so anything packed inside it would be clipped
away from view.

Cheers,
-Tristan


 regards,

 from gi.repository import Gtk

 class mywindow(Gtk.Window):

 def __init__(self):
 Gtk.Window.__init__(self, title=Hello)
 box = Gtk.ListBox()
 label = Gtk.Label(Hello)
 label2 = Gtk.Label(Hello2)
 layout = Gtk.Layout()
 layout.put(label, 0, 0)
 box.add(layout)
 box.add(label2)
 self.add(box)

 win = mywindow()
 win.connect(delete-event, Gtk.main_quit)
 win.show_all()
 win.resize(300, 300)
 Gtk.main()

 --
 Cédric Bellegarde
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list