CList column auto-resize (on demand)



Hello,

    I would like to "auto-resize" the column on demand. I'll be using a combination of gtk_clist_optimal_column_width (to get the width of my column) and gtk_clist_set_column_width (to set it). I want to have this feature working like on most spreadshits :
 
    I didn't find any relevant signal to bind this feature to. I've looked in the gtk_clist.c source file and it seems that they are using internal properties of the clist to do the job and binding the signal button_press. In the source they do something like that : in the button_press callback
    /* This code is extract from gtkclist.c of the Gtk+ 1.2.10 source code */
    /* It is extract from the handler of the button_press event
  for (i = 0; i < clist->columns; i++)
    if (clist->column[i].resizeable && clist->column[i].window &&
        event->window == clist->column[i].window)

    So they are testing for each column if it is resizeable AND if it has its own gdk_window set AND if the gdk_window involved in the event is the same as the column one. I can do the same test on a customized button_press event callback that I will attached to my clist widget instance, and do the trick. But I find it unsafe because I'm using internal data. Do you know of any better way?

I hope I've been clear enough. I'm sorry for my english and if you don't understand you can always ask me to say it again differently :-)
Thank you in advance for any help,


Best regards,
---
Jean-Christophe Berthon



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