From 5a9bd4b4b5eb40fe1eeb618271841110d87b7dd7 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 5 Jun 2014 13:40:47 -0400 Subject: Fixed the GTK+ Combobox sizing issues for real this time. --- gtkcalls_unix.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'gtkcalls_unix.go') diff --git a/gtkcalls_unix.go b/gtkcalls_unix.go index 99fff8e..d79e68e 100644 --- a/gtkcalls_unix.go +++ b/gtkcalls_unix.go @@ -13,15 +13,18 @@ import ( // #include "gtk_unix.h" // static inline void gtkSetComboBoxArbitrarilyResizeable(GtkWidget *w) // { -// // we can safely assume that the cell renderers of a GtkComboBoxText are a single GtkCellRendererText by default -// // thanks mclasen and tristan in irc.gimp.net/#gtk+ +// /* we can safely assume that the cell renderers of a GtkComboBoxText are a single GtkCellRendererText by default */ +// /* thanks mclasen and tristan in irc.gimp.net/#gtk+ */ // GtkCellLayout *cbox = (GtkCellLayout *) w; // GList *renderer; // // renderer = gtk_cell_layout_get_cells(cbox); -// g_object_set(renderer->data, "width-chars", 0, NULL); +// g_object_set(renderer->data, +// "ellipsize-set", TRUE, /* with no ellipsizing or wrapping, the combobox won't resize */ +// "ellipsize", PANGO_ELLIPSIZE_END, +// "width-chars", 0, +// NULL); // g_list_free(renderer); -// gtk_combo_box_set_popup_fixed_width(cbox, FALSE); // } import "C" @@ -169,9 +172,9 @@ fmt.Printf("%p %s\n", c, fromgstr(C.g_type_name(t))) func gtk_combo_box_text_new_with_entry() *C.GtkWidget { w := C.gtk_combo_box_text_new_with_entry() - C.gtkSetComboBoxArbitrarilyResizeable(w) // we need to set the entry's width-chars to achieve the arbitrary sizing we want // thanks to tristan in irc.gimp.net/#gtk+ + // in my tests, this is sufficient to get the effect we want; setting the cell renderer isn't necessary like it is with an entry-less combobox entry := togtkentry(C.gtk_bin_get_child((*C.GtkBin)(unsafe.Pointer(w)))) C.gtk_entry_set_width_chars(entry, 0) return w -- cgit v1.2.3