Combo_box_text and scrolling to empty space

2018-02-18 Thread Wojciech Puchar
how to fix this - large combobox text (with lots of entries) behave like 
this


http://www.puchar.net/NOBACKUP/gtk1.png


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


Re: simple question

2018-02-18 Thread Nicola Fontana
Il Sat, 17 Feb 2018 21:32:19 +0100 (CET) Wojciech Puchar  
scrisse:

> i want in my program to change background color of the gtk_button to red 
> sometimes as a signal to the user.
> 
> it works fine with default theme but not with some other themes like 
> E17gtk.
> 
> how to fix this and ENFORCE color of button?

Hi,

you can't. Some theme (e.g. the ones based on the pixmap engine)
can use images and totally ignore the background colors you set.
E17gtk seems to be pixmap based:

https://github.com/tsujan/E17gtk/blob/master/gtk-2.0/gtkrc#L99

You can disable the engine and style from scratch, but this will
quickly end up in creating a new theme.

If you want full control over something just use a canvas. Don't
try to bend the theme to do what they are not supposed to do, e.g.
change the background image to something "redish" because you set
a red background.

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


Re: GtkTreeViewColumn width

2018-02-18 Thread Eric Cashon via gtk-app-devel-list

Try switching the sizing to what is needed. Something like

...
gint combo_id=gtk_combo_box_get_active(combo);
if(combo_id==0)
  {
g_print("%i\n", gtk_tree_view_column_get_width(column2));
gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column2), 
GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(column2), 25);
gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column2), 
GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column2), TRUE);
  }
...

Then when you start the program, get the saved values, set as fixed and then 
switch to autosize.

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


Re: GtkTreeViewColumn width

2018-02-18 Thread Eric Cashon via gtk-app-devel-list

 
Hi Phil,

You should be able to resize columns if you want. If you have set sizes of text 
to display in the tree view and want to allocate sizes you can do that.

Eric


/*
Tested with Ubuntu16.04 and GTK3.18.
gcc -Wall tree_column1.c -o tree_column1 `pkg-config --cflags --libs 
gtk+-3.0`
*/

#include

static GtkTreeStore* get_tree_store();
static void set_column2_width(GtkComboBox *combo, GtkTreeViewColumn *column2);

int main(int argc, char *argv[])
  {
gtk_init(, );

GtkWidget *window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Tree View");
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size(GTK_WINDOW(window), 400, 400);
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);

GtkTreeStore *store=get_tree_store();

GtkWidget *tree=gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
g_object_unref(G_OBJECT(store));

GtkCellRenderer *renderer1=gtk_cell_renderer_text_new();
g_object_set(renderer1, "editable", FALSE, NULL);
   
GtkTreeViewColumn 
*column1=gtk_tree_view_column_new_with_attributes("Column1", renderer1, "text", 
0, NULL);
gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column1), 
GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(column1), 100);

GtkTreeViewColumn 
*column2=gtk_tree_view_column_new_with_attributes("Column2", renderer1, "text", 
1, NULL);
gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column2), 
GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(column2), 25);

GtkTreeViewColumn 
*column3=gtk_tree_view_column_new_with_attributes("Column3", renderer1, "text", 
2, NULL);

gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column1);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column2); 
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column3); 

GtkWidget *scroll=gtk_scrolled_window_new(NULL, NULL);
gtk_container_set_border_width(GTK_CONTAINER(scroll), 5);
gtk_widget_set_vexpand(scroll, TRUE);
gtk_widget_set_hexpand(scroll, TRUE);
gtk_container_add(GTK_CONTAINER(scroll), tree); 

GtkWidget *combo=gtk_combo_box_text_new();
gtk_widget_set_hexpand(combo, TRUE);
gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(combo), 0, "1", "Column2 width 
25");
gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(combo), 1, "2", "Column2 width 
50");
gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(combo), 2, "3", "Column2 width 
100");
gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(combo), 3, "4", "Column2 width 
150");
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
g_signal_connect(combo, "changed", G_CALLBACK(set_column2_width), column2); 
  

GtkWidget *grid=gtk_grid_new();
gtk_container_set_border_width(GTK_CONTAINER(grid), 20);
gtk_grid_attach(GTK_GRID(grid), scroll, 0, 0, 1, 1);
gtk_grid_attach(GTK_GRID(grid), combo, 0, 1, 1, 1);
gtk_container_add(GTK_CONTAINER(window), grid);
   
gtk_widget_show_all(window);
gtk_main();
return 0;   
  }
static GtkTreeStore* get_tree_store()
  {
gint i=0;
GtkTreeStore *store=gtk_tree_store_new(3, G_TYPE_INT, G_TYPE_STRING, 
G_TYPE_STRING);

GtkTreeIter iter1;
for(i=0;i<10;i++)
  {
gchar *string1=g_strdup_printf("Name %i", i);
gtk_tree_store_append(store, , NULL);
gtk_tree_store_set(store, , 0, i, 1, string1, 2, string1, -1);
g_free(string1);
  }
  
return store;
  }
static void set_column2_width(GtkComboBox *combo, GtkTreeViewColumn *column2)
  {
gint combo_id=gtk_combo_box_get_active(combo);
if(combo_id==0) 
gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(column2), 25);
else if(combo_id==1) 
gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(column2), 50);
else if(combo_id==2) 
gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(column2), 100);
else gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(column2), 
150);
  }


 


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


GtkTreeViewColumn width

2018-02-18 Thread Phil Wolff

Why is GtkTreeViewColumn's "width" property read-only?

If you can make the column resizeable so the user can change the width, 
why isn't there a means to do so under program control? Or is there a 
way and I just haven't found it?

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