Wrap GtkComboBox column-wise instead of row-wise

Viewed 167

I'm having trouble to wrap a GTKComboBox with a large number of alphabetically sorted entries column-wise instead of row-wise.

Please have a look at the following minimal working example and the attached screenshot to get an idea of what I'm trying to achieve. The focal point of my code is the function gtk_combo_box_set_wrap_width which wraps the GtkComboBox as table (see GTK3 API reference).

#include <gtk/gtk.h>

int main(int argc, char *argv[]) 
{
    GtkWidget *window;
    GtkWidget *combobox;

    gtk_init(&argc,&argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_container_set_border_width(GTK_CONTAINER(window), 10 );
    gtk_window_set_default_size(GTK_WINDOW(window), 100, 50);

    combobox = gtk_combo_box_text_new();
    gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combobox), NULL, "A" );
    gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combobox), NULL, "B" );
    gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combobox), NULL, "C" );
    gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combobox), NULL, "D" );

    gtk_combo_box_set_wrap_width (GTK_COMBO_BOX(combobox), 2);

    gtk_container_add(GTK_CONTAINER(window), combobox);

    gtk_widget_show_all(window);
    gtk_main();

    return(0);
}

This gives me the following output:

Row-wise wrap

As you can see, the entries get wrapped row-wise, i.e. are read from left to right.

Is there a convenient way to wrap the elements column-wise without re-sorting them accordingly?

Column-wise wrap

0 Answers
Related