multicolumn combo with multiple options selectable



I want to put a combo box in a treeview with two columns so the first
column is a label and the second is a check box.  Also I would like to
be able to check off more than one option in the combo box.  So if the
treeview had a textile row the color column combo would list available
colors and one or more colors can be selected or checked off.  The part
of my code I'm trying to do this in is below.  First the only column
that shows in the combo is the list of colors and the check boxes seem
to get lost.  Second, I not sure how to connect the itemToggled signal
to the check boxes.  

Thank you in advance,
--dhk

function_to_build_the_multicolumn_combo() {
.
.
.
  enum {COL_COLOR, COL_USE, COL_CNT};
  typedef struct Color {gchar *color; gboolean use;} Color;
  static Color colors[]={
    {"Red", FALSE},
    {"Blue", TRUE},
    {"Green", TRUE},
    {"Brown", FALSE},
    {"Black", FALSE},
    {"White", FALSE}
  };
.
.
.
  /* <Color> */
  //renderer=gtk_cell_renderer_toggle_new();
  //g_object_set(G_OBJECT(renderer), "activatable", TRUE, NULL);
  //g_signal_connect(renderer, "toggled", G_CALLBACK(itemToggled), tv);

  /* Create the combo box */
  ls_combo=gtk_list_store_new(COL_CNT, G_TYPE_STRING, G_TYPE_BOOLEAN);
  for(ii=0; ii<G_N_ELEMENTS(tt); ii++) {
    gtk_list_store_append (ls_combo, &iter);
    gtk_list_store_set (ls_combo, &iter, COL_COLOR, colors[ii].color,
COL_USE, colors[ii].use, -1);
  }
  renderer = gtk_cell_renderer_combo_new();
  g_object_set(G_OBJECT(renderer), "model", ls_combo, "editable", TRUE,
NULL);
  g_object_set(G_OBJECT(renderer), "has-entry", 0, NULL);
  g_object_set(G_OBJECT(renderer), "text-column", 0, NULL);
  g_signal_connect(renderer, "edited",
G_CALLBACK(itemTypeComboEditedCb), tv);
  g_object_set(renderer, "editable", TRUE, NULL);
  /* Create a Column */
  column=gtk_tree_view_column_new();
  gtk_tree_view_column_set_title(column, "Colors");
  gtk_tree_view_column_pack_start(column, renderer, FALSE);
  irs=IRS_Colors;
  gtk_tree_view_column_set_attributes(column, renderer, "text", irs,
NULL);
  col_num=gtk_tree_view_insert_column(GTK_TREE_VIEW(tv), column, -1);
  g_object_unref(ls_combo);
}





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