Re: Re:GtkScrolledWindow/GtkViewport question
Hi Michael, Unfortunately I don't think this is easy. You need o do some kind of crazy hack, like realizing but not mapping the dialog, measuring the size you get, guessing the amount of chrome the theme is adding from that, then setting the default window size and finally mapping. I'd love to be proved wrong though. Yuk! John ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkDrawingArea size
On 03/06/2012 02:08 PM, Christopher Howard wrote: Hello again. So, I recently started a project to create a certain board game (in C) using gtk+, and I just started learning gtk+. I was planning to draw the board graphics, pieces, etc. all into one GtkDrawingArea. So, how do I fix the size of the drawing area so it doesn't get larger or smaller than my graphics? The alternative, I suppose, would be to scale everything against the actual size of the drawing area (cairo can resize bitmap images, no?) but presumably that would be a lot more complicated to code, and I would still need to constrain the proportions of width to height. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list Bump. I'm trying to look through some other projects to see how this is done, but I would appreciate it if anyone happens to know of the top of their head. -- frigidcode.com indicium.us ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkDrawingArea size
If you did not yet start implementing it, goocanvas might be another option to the bare stuff. goocanvas allows you to set a fixed paper size. Am 7. März 2012 19:44 schrieb Christopher Howard christopher.how...@frigidcode.com: On 03/06/2012 02:08 PM, Christopher Howard wrote: Hello again. So, I recently started a project to create a certain board game (in C) using gtk+, and I just started learning gtk+. I was planning to draw the board graphics, pieces, etc. all into one GtkDrawingArea. So, how do I fix the size of the drawing area so it doesn't get larger or smaller than my graphics? The alternative, I suppose, would be to scale everything against the actual size of the drawing area (cairo can resize bitmap images, no?) but presumably that would be a lot more complicated to code, and I would still need to constrain the proportions of width to height. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list Bump. I'm trying to look through some other projects to see how this is done, but I would appreciate it if anyone happens to know of the top of their head. -- frigidcode.com indicium.us ___ 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: GtkDrawingArea size
On 03/07/2012 11:37 AM, Bernhard Schuster wrote: If you did not yet start implementing it, goocanvas might be another option to the bare stuff. goocanvas allows you to set a fixed paper size. I think the halign and valign properties are what I was looking for. It seems that, if I do an align center, that the widget never grows larger than its requested size, though it still can shrink. code: -- gtk_widget_set_size_request (my_widget, 256, 256); gtk_widget_set_halign(my_widget, GTK_ALIGN_CENTER); gtk_widget_set_valign(my_widget, GTK_ALIGN_CENTER); -- -- frigidcode.com indicium.us ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkDrawingArea size
On Wed, 2012-03-07 at 09:44 -0900, Christopher Howard wrote: X Bump. I'm trying to look through some other projects to see how this is done, but I would appreciate it if anyone happens to know of the top of their head. I guess you can have a drawingarea of fixed size if you put it in a container of fixed size, ie. make the window fixed size, see http://developer.gnome.org/gtk3/stable/GtkWindow.html#GtkWindow--resizable With cairo it is easy to scale your graphics, and you get all these nice stuff like anti-aliasing, transparency and much more. But cairo is not very fast -- for my current toy project (http://www.ssalewski.de/PetEd.html.de) I had to carefully figure out which redraw operation is really necessary for updating the display. A complete redraw can take more than 100ms -- but now I have fixed that by using bounding boxes for each elements, and redrawing only what has changed. But for fast action games OpenGL may be a better choice. When your application does not need fast graphics, then you may also consider other languages than C -- I am using Ruby currently, next time I may give Vala a try... ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
modifiable dialog button labels?
Hi all, I am trying to code some reusable GtkDialogs (i.e., create them only once, then hide and reuse them later as necessary rather than destroying and recreating every time). I need numerous dialogs which ask a simple question and then have two buttons for the user to choose between, e.g., Favorite drink? Wine/Beer Which way? North/South (Poor examples maybe, but you get the idea.) Seems like a waste to create a bunch of different dialogs that are all using the same basic structure, I would prefer to just create one and then modify its elements as needed. I can see how to change a text label inserted into the dialog's content area to alter my question text, but so far have discovered no way to alter the text labels used in the buttons which I supply at creation time to gtk_dialog_new_with_buttons(). Seems like this ought to be an easy thing to do, but I can see no way to retrieve any pointer to the dialog's button objects nor any way to explicitly set their labels after the dialog has been created. Any ideas? Thanks! Roger Davis ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: modifiable dialog button labels?
From: Roger Davis r...@soest.hawaii.edu To: gtk-app-devel-list@gnome.org Sent: Wednesday, March 7, 2012 7:59 PM Subject: modifiable dialog button labels? Hi all, I am trying to code some reusable GtkDialogs (i.e., create them only once, then hide and reuse them later as necessary rather than destroying and recreating every time). I need numerous dialogs which ask a simple question and then have two buttons for the user to choose between, e.g., Favorite drink? Wine/Beer Which way? North/South (Poor examples maybe, but you get the idea.) Seems like a waste to create a bunch of different dialogs that are all using the same basic structure, I would prefer to just create one and then modify its elements as needed. I can see how to change a text label inserted into the dialog's content area to alter my question text, but so far have discovered no way to alter the text labels used in the buttons which I supply at creation time to gtk_dialog_new_with_buttons(). Seems like this ought to be an easy thing to do, but I can see no way to retrieve any pointer to the dialog's button objects nor any way to explicitly set their labels after the dialog has been created. Any ideas? Thanks! Roger Davis _ you can use gtk_get_action_area() to get the GtkBox that that is the action area, that itself contains the buttons. I believe you can then get all the child widgets, which would be the GtkButtons. The docs for GtkDialog describes it some, but doesn't talk about getting the buttons. I think you would have to go to the page for GtkBox for how to get the children. -lsd ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: modifiable dialog button labels?
On Wed, 7 Mar 2012, Lance Dillon wrote: you can use gtk_get_action_area() to get the GtkBox that that is the action area, that itself contains the buttons. I believe you can then get all the child widgets, which would be the GtkButtons. The docs for GtkDialog describes it some, but doesn't talk about getting the buttons. I think you would have to go to the page for GtkBox for how to get the children. Hi Lance, The GtkDialog documentation tells only how to access the action area, not its children. Searching around I see a gtk_container_get_children() which presumably returns a list of GtkWidget pointers. Is there a way I can look at a widget pointer and detrmine the widget's type, i.e., figure out whether or not it's a button? I see references to a gtk_widget_get_type() on the web, but no good examples of how it's used, and it appears to be not present at all in my own GTK release's GtkWidget documentation. There also seem to be some related type discovery functions in the gobject library such as g_type(), etc., but so far I have not found any useful examples of how I might use them to figure out if any particular widget pointer is a button or not. Thanks, Roger___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list