Re: Height of a GtkTextView



On Saturday 03 September 2005 10:49, Stefan Kost wrote:
Hi,

Hi,

   How can I get height of a text (in pixels) stored in a GtkTextView?
I have looked in the API reference but found nothing relevant:-/

the only thing I found to do it is to set the treeview to fixed-height
mode, then get the height of one row and multiply by the number of rows
I have subclassed the treview (as I paint over it) and in realize I do:

path=gtk_tree_path_new_from_indices(0,-1);
gtk_tree_view_get_background_area(GTK_TREE_VIEW(widget),path,NULL,&br);
row_height=br.height;
GST_INFO(" cell background visible rect: %d x %d, %d x
%d",br.x,br.y,br.width,br.height);

With a tree view you can use gtk_tree_view_column_cell_get_size(), but the 
original poster was interested in GtkTextView.

With a text view the issue is not the text height but the line height.  That 
can presumably be obtained with gtk_text_view_get_line_yrange().

Chris



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