How to detect gtk widget partial visible? visibility-notify-event?
Hi list, Is it possible for a gtk widget to detect it is partial visible? For example, I can drag one window on another window. The covered window can be notified that it is partial visible? I've registered the visibility-notify-event but never receive callback, I would like to figure out in my case, is it possible to receive callback? Or the exact timing gtk will emit the signal. Best regards, Eric Tsai ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
How can I print GtkTextBuffer using GtkPrint ?
I want to support printing in my application using GtkPrint. Is there a simple way to print the contents of the GtkTextBuffer (containing multiple fonts, colors and other formatting) using the GtkPrint ? Do I have to write the code that draws the text manually ? Is there any complex sample code that could help me ? TIA, Miroslav ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to detect gtk widget partial visible? visibility-notify-event?
On Tue, Sep 11, 2007 at 05:54:54PM +0800, MD Tsai wrote: Is it possible for a gtk widget to detect it is partial visible? For example, I can drag one window on another window. The covered window can be notified that it is partial visible? I've registered the visibility-notify-event but never receive callback, gtk_widget_add_events(widget, GDK_VISIBILITY_NOTIFY_MASK); Yeti -- http://gwyddion.net/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to detect gtk widget partial visible? visibility-notify-event?
Hi Yeti, Thanks for your reply. It seems every widget could use this function to enable the event bits, is this right? How could I find the default event setting of every widget, which is enabled and which is disabled? Best regard, Eric Tsai 2007/9/11, David Nečas (Yeti) [EMAIL PROTECTED]: On Tue, Sep 11, 2007 at 05:54:54PM +0800, MD Tsai wrote: Is it possible for a gtk widget to detect it is partial visible? For example, I can drag one window on another window. The covered window can be notified that it is partial visible? I've registered the visibility-notify-event but never receive callback, gtk_widget_add_events(widget, GDK_VISIBILITY_NOTIFY_MASK); Yeti -- http://gwyddion.net/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkEntryCompletion popup size
I'm using a GtkEntryCompletion in popup-mode and controlling the list of matches myself. I see that it displays up to 15 matches and if there are more it adds a scroll bar to the popup window. For my purposes it doesn't seem worthwhile to have a scroll bar. Is there any way to control whether or when a scroll bar is added? Or is there any way to discover the maximum number of rows that will be visible in the popup? Or is it always guaranteed to be 15? Thanks, Dave ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Lower case to upper case german ess-zet
Hi I have a problem converting german ess-zet (ß) from lower to uppercase when using g_unichar_toupper, but it works fine using g_utf8_strup. Using g_unichar_toupper I get a 0 as result. Here it is a sample. The output is: g_unichar_toupper. Lower:'ß', Upper:'' g_utf8_strup. Lower:'ß', Upper:'SS' int main() { gchar *strLower = ß; // Bad conversion with g_unichar_toupper gunichar uniLower = g_utf8_get_char(strLower); gunichar uniUpper = g_unichar_toupper(uniLower); gchar strUpper[6]; gint len = g_unichar_to_utf8(uniUpper, strUpper); strUpper[len] = '\0'; printf(\ng_unichar_toupper. Lower:'%s', Upper:'%s', strLower, strUpper); // Result: g_unichar_toupper. Lower:'ß', Upper:'' //Good conversion with g_utf8_strup gchar *goodUpper = g_utf8_strup (strLower, -1); printf(\nGood. Lower:'%s', Upper:'%s', strLower, goodUpper); g_free(goodUpper); // Result: g_utf8_strup. Lower:'ß', Upper:'SS' } Regards ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Lower case to upper case german ess-zet
On Tue, Sep 11, 2007 at 06:12:53PM +, Luis Ramirez wrote: I have a problem converting german ess-zet (ß) from lower to uppercase when using g_unichar_toupper, but it works fine using g_utf8_strup. Using g_unichar_toupper I get a 0 as result. You should not, both according to my reading of GLib source code and experiment. Since the uppercase is not repesentable with a signle character, you should get the input character back from g_unichar_toupper(), exactly as the documentation states -- and this is also what I observe. Here it is a sample. The output is: Note embedding these things in mail makes them subject to abritrary reencoding and can result in recipients trying entirely different code if they are not very careful -- use \xc3\x9f representation. g_unichar_toupper. Lower:'ß', Upper:'' g_utf8_strup. Lower:'ß', Upper:'SS' I get g_unichar_toupper. Lower:'ß', Upper:'ß' g_utf8_strup. Lower:'ß', Upper:'SS' as expected. Perhaps a too old GLib? Yeti -- http://gwyddion.net/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk pango draw rotated text
Thanks for the support. For future reference in google or whatever: Pascal Rotate Text GTK2 renderer := gdk_pango_renderer_get_default( gtk_widget_get_screen(DevCtx.DCWidget) ); gdk_pango_renderer_set_drawable ( renderer, DevCtx.drawable); gdk_pango_renderer_set_gc ( renderer, DevCtx.GC); WidgetCont := pango_layout_get_context(UseFont); matrix.xx := 1.0; matrix.xy := 0.0; matrix.yx := 0.0; matrix.yy := 1.0; matrix.x0 := 0.0; matrix.y0 := 0.0; pango_matrix_translate (@matrix, X, Y); --pos to draw pango_matrix_rotate (@matrix, 285); --angle pango_context_set_matrix (WidgetCont, @matrix); pango_layout_context_changed (DevCtx.Layout); pango_renderer_draw_layout (renderer, DevCtx.Layout X, Y);--pos todraw gdk_pango_renderer_set_drawable ( renderer, nil); gdk_pango_renderer_set_gc ( renderer, nil); _LR_ On Mon, 2007-09-10 at 17:06 +0200, David Nečas (Yeti) wrote: On Mon, Sep 10, 2007 at 01:27:48PM +0100, Luis Rodrigues wrote: It's not on my system. I use Debian, do you happen do know the package name? http://packages.debian.org/search?searchon=contentskeywords=gtk-demomode=pathsuite=stablearch=any Yeti -- http://gwyddion.net/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to convert a jpg image to a GtkImage ?
Following this thread, I decided it would be wise to avoid this kind of leak since my application uses hundreds of loaders to load hundreds of pixbufs, so I made my code look like: pixbuf_p = gdk_pixbuf_loader_get_pixbuf(my_loader); g_object_unref ( my_loader); add_to_my_list ( pixbuf_p ); However, this apparently frees up the pixbuf as well, and everything goes to hell in a handbasket as pixbuf_p is now a reference to some piece of recycled memory or something like that. How does one free up the loader but retain the pixbuf ? Tom -- Tom Trebisky MMT Observatory University of Arizona -- Tucson [EMAIL PROTECTED] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Cell Renderer Combo Callback
undefined ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to convert a jpg image to a GtkImage ?
Hi, You could clone the pixbuf, or create a new one the same size and blit the content of the soon-to-be recycled one into the new one before unref'ing the loader Jonathan On 9/11/07, Tom Trebisky [EMAIL PROTECTED] wrote: Following this thread, I decided it would be wise to avoid this kind of leak since my application uses hundreds of loaders to load hundreds of pixbufs, so I made my code look like: pixbuf_p = gdk_pixbuf_loader_get_pixbuf(my_loader); g_object_unref ( my_loader); add_to_my_list ( pixbuf_p ); However, this apparently frees up the pixbuf as well, and everything goes to hell in a handbasket as pixbuf_p is now a reference to some piece of recycled memory or something like that. How does one free up the loader but retain the pixbuf ? Tom -- Tom Trebisky MMT Observatory University of Arizona -- Tucson [EMAIL PROTECTED] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Morpheus linux, c'est une question de VI ou de MORE ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Cell Renderer Combo Callback
I have a combo render in a treeview and I can't get the callback to set the value once it's selected. I want the combo to default to Stock but be able to be changed to any of the other values in the itemtype array. Below is the way the item type combo is being created and added to the tree view followed by the callback. Does any one see the error? Thanks, --dhk /* --- ItemType Treeview Column --- */ renderer = gtk_cell_renderer_combo_new(); /* Create the combo box */ ls_combo=gtk_list_store_new(1, G_TYPE_STRING); for(ii=0; ii9; ii++) { gtk_list_store_append (ls_combo, iter); gtk_list_store_set (ls_combo, iter, 0, itemtype[ii], -1); } g_object_set(G_OBJECT(renderer), model, ls_combo, text-column, 0, text, Stock, has-entry, FALSE, editable, TRUE, NULL); g_signal_connect(renderer, edited, G_CALLBACK(itemTypeComboEditedCb), ls_combo); /* Create a Column */ column=gtk_tree_view_column_new(); gtk_tree_view_column_set_title(column, ItemType); gtk_tree_view_column_pack_start(column, renderer, FALSE); ips=IPS_ItemType; // gtk_tree_view_column_set_attributes(column, renderer, text, ips, NULL); col_num=gtk_tree_view_insert_column(GTK_TREE_VIEW(tv), column, -1); g_object_unref(ls_combo); /* FIELD is the column number not the index: always one more than index. */ g_object_set_data(G_OBJECT(renderer), FIELD, GUINT_TO_POINTER(col_num)); /* -- */ /* The callback */ void itemTypeComboEditedCb(GtkCellRendererText *cell, const gchar *path, const gchar *value, GtkListStore *list) { gboolean rc=FALSE; GtkTreeIter iter; GtkTreePath *tp=NULL; GtkTreeModel *tm=NULL; /* a tree model */ gint col_num=0; tp=gtk_tree_path_new_from_string(path); col_num=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cell), FIELD)); gtk_tree_model_get_iter (GTK_TREE_MODEL(list), iter, tp); gtk_list_store_set(list, iter, 0, value, -1); /* The following sets the whole column to the same value, not just the row it was select in. */ //g_object_set(G_OBJECT(cell), text, value, NULL); } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to convert a jpg image to a GtkImage ?
On Tue, Sep 11, 2007 at 10:53:02PM +0200, Jonathan Winterflood wrote: As for adding a click to the reference count, if it works, would probably be the best way to go Of course it works and it is recommended in gdk_pixbuf_loader_get_pixbuf() documentation -- if anyone bothered to read it... Yeti -- http://gwyddion.net/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Newbie Question: Changing a Label
Hi Everyone. I'm trying to write a simple program that changes a label when a button is clicked. The program compiles and runs, but there's no label change. Here's what I have in my callbacks.c: #ifdef HAVE_CONFIG_H # include config.h #endif #include gtk/gtk.h #include callbacks.h #include interface.h #include support.h void on_window1_destroy (GtkObject *object, gpointer user_data) { gtk_exit(0); } void on_button2_clicked (GtkButton *button, gpointer user_data) { gtk_exit(0); } void on_button1_clicked (GtkButton *button, gpointer user_data) { GtkWidget* window1; GtkWidget* window2; GtkWidget* label1; gtk_label_set_text((label1),Hi!); } Like I said, this runs w/o any compile errors, but when I run it in the terminal, I see the following: Gtk-CRITICAL **: gtk_label_set_text: assertion `GTK_IS_LABEL (label)' failed So something went wrong. Can anyone help me out here? Regards, Brian -- [EMAIL PROTECTED] http://brianswebpagehome.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list