* GTK strangeness @ 2009-10-01 1:52 RasikaSrinivasan@gmail.com 2009-10-01 2:10 ` Srini - 2009-10-01 7:39 ` Dmitry A. Kazakov 0 siblings, 2 replies; 5+ messages in thread From: RasikaSrinivasan@gmail.com @ 2009-10-01 1:52 UTC (permalink / raw) I have a strange situation. I attempt to set the font to a different font than normal. It appears this works fine for gtk.label.gtk_label but gtk.button.gtk_button Is this expected? Also I expected that all widgets would inherit some settings like font from their container. Is this not so in gtk? thanks for hints, srini ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GTK strangeness 2009-10-01 1:52 GTK strangeness RasikaSrinivasan@gmail.com @ 2009-10-01 2:10 ` Srini - 2009-10-01 7:39 ` Dmitry A. Kazakov 1 sibling, 0 replies; 5+ messages in thread From: Srini - @ 2009-10-01 2:10 UTC (permalink / raw) On Sep 30, 9:52 pm, "RasikaSriniva...@gmail.com" <rasikasriniva...@gmail.com> wrote: > I have a strange situation. > > I attempt to set the font to a different font than normal. > > It appears this works fine for gtk.label.gtk_label but > gtk.button.gtk_button > > Is this expected? > > Also I expected that all widgets would inherit some settings like font > from their container. Is this not so in gtk? > > thanks for hints, srini BTW - I am using GtkAda (not from C or C++ or anything like that) thanks, srini ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GTK strangeness 2009-10-01 1:52 GTK strangeness RasikaSrinivasan@gmail.com 2009-10-01 2:10 ` Srini - @ 2009-10-01 7:39 ` Dmitry A. Kazakov 2009-10-01 13:19 ` Srini - 1 sibling, 1 reply; 5+ messages in thread From: Dmitry A. Kazakov @ 2009-10-01 7:39 UTC (permalink / raw) On Wed, 30 Sep 2009 18:52:15 -0700 (PDT), RasikaSrinivasan@gmail.com wrote: > I have a strange situation. > > I attempt to set the font to a different font than normal. > > It appears this works fine for gtk.label.gtk_label but > gtk.button.gtk_button > > Is this expected? That depends on how are you doing what. There are numerous ways of setting fonts to particular widgets and the font itself as a parameter/property of the widget can be of different flavors, e.g. a property, a style, a property style, bare argument of a call, coming with another widget etc. > Also I expected that all widgets would inherit some settings like font > from their container. Is this not so in gtk? There is no standard mechanism because of the variety of ways a widget may decide which font to use. Specifically to Gtk_Button, it is a container and the text in it can be any sort of thing. You can for example create a tree view and put it into the button. What would be the font? The answer is, that depends on what font and whom it actually belongs. In this case certainly not to the button. In the standard scenario, when the button label is set with Set_Label, the font is set by the widget style. There are ways to influence that and it again depends on how are you going to do it (programmatically, using resource files and schemas etc). Sorry, if that sounds confusing, but it is. OK, I didn't want to leave you with that. (:-)) So here is the most simple way to set the font programmatically. You create a button (Gtk_Button) with no text or images. Then you create a label (Gtk_Label) with the desired font and text. Then put that label into the button, which is a mere bin container. Here you are. If you need an icon too, create a Gtk_HBox put there the label and the image, put the box into the button. Done. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GTK strangeness 2009-10-01 7:39 ` Dmitry A. Kazakov @ 2009-10-01 13:19 ` Srini - 2009-10-01 15:22 ` Dmitry A. Kazakov 0 siblings, 1 reply; 5+ messages in thread From: Srini - @ 2009-10-01 13:19 UTC (permalink / raw) On Oct 1, 3:39 am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> wrote: > On Wed, 30 Sep 2009 18:52:15 -0700 (PDT), RasikaSriniva...@gmail.com wrote: > > I have a strange situation. > > > I attempt to set the font to a different font than normal. > > > It appears this works fine for gtk.label.gtk_label but > > gtk.button.gtk_button > > > Is this expected? > > That depends on how are you doing what. There are numerous ways of setting > fonts to particular widgets and the font itself as a parameter/property of > the widget can be of different flavors, e.g. a property, a style, a > property style, bare argument of a call, coming with another widget etc. > > > Also I expected that all widgets would inherit some settings like font > > from their container. Is this not so in gtk? > > There is no standard mechanism because of the variety of ways a widget may > decide which font to use. > > Specifically to Gtk_Button, it is a container and the text in it can be any > sort of thing. You can for example create a tree view and put it into the > button. What would be the font? The answer is, that depends on what font > and whom it actually belongs. In this case certainly not to the button. > > In the standard scenario, when the button label is set with Set_Label, the > font is set by the widget style. There are ways to influence that and it > again depends on how are you going to do it (programmatically, using > resource files and schemas etc). Sorry, if that sounds confusing, but it > is. > > OK, I didn't want to leave you with that. (:-)) So here is the most simple > way to set the font programmatically. You create a button (Gtk_Button) with > no text or images. Then you create a label (Gtk_Label) with the desired > font and text. Then put that label into the button, which is a mere bin > container. Here you are. > > If you need an icon too, create a Gtk_HBox put there the label and the > image, put the box into the button. Done. > > -- > Regards, > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de Great. I was using Modify_font which did not work. This technique works great. Perhaps there is a wiki or FAQ dedicated to GtkAda? If not might be worth it. many subtleties. My next question has to do with : - font selection - a. the right way to access fonts installed on a system with and without a selection dialog? for example I want to use Verdana as the font for my dialogs/messages etc. should i look at some mods to pango.aliases file? - File_Selection Dialog My reading of the doc says, I build a dialog based on the file_selection widget. and it does not appear to match the native file_selection dialog. Eg windows or the mac have their own "style" if you will. thanks, srini ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GTK strangeness 2009-10-01 13:19 ` Srini - @ 2009-10-01 15:22 ` Dmitry A. Kazakov 0 siblings, 0 replies; 5+ messages in thread From: Dmitry A. Kazakov @ 2009-10-01 15:22 UTC (permalink / raw) On Thu, 1 Oct 2009 06:19:25 -0700 (PDT), Srini - wrote: > Perhaps there is a wiki or FAQ dedicated to GtkAda? > If not might be worth it. many subtleties. There is nothing specific about GtkAda, except maybe its design with regard to handling events based on generics. GtkAda comes with some documentation how to create simple custom widgets and very basic information about Gtk. The questions you asked are not GtkAda, but Gtk itself. There is a Gtk FAQ and some how-to's for tricky widgets like Gtk_Tree_View. Yes, you should translate them from C to GtkAda, but it is not difficult because GtkAda is thin bindings. > My next question has to do with : > > - font selection - a. the right way to access fonts installed on a > system with and without a selection dialog? for example I want to use > Verdana as the font for my dialogs/messages etc. should i look at some > mods to pango.aliases file? You can give a list of font names and pango will try to find a match, like: Font : Pango_Font_Description := From_String ("fixed,monospace 10"); This tries to find "fixed" then "monospace". > - File_Selection Dialog My reading of the doc says, I build a dialog > based on the file_selection widget. and it does not appear to match > the native file_selection dialog. Yes, because Gtk has its own look and feel in order to be portable. It does not use any Windows widgets. For example Gtk_Gentry has nothing to do with Windows EDIT control. > Eg windows or the mac have their own "style" if you will. I don't use Gtk file selection because I have my own, which is more in the Windows flavor. You can find it here among other additions to GtkAda: http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-10-01 15:22 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-10-01 1:52 GTK strangeness RasikaSrinivasan@gmail.com 2009-10-01 2:10 ` Srini - 2009-10-01 7:39 ` Dmitry A. Kazakov 2009-10-01 13:19 ` Srini - 2009-10-01 15:22 ` Dmitry A. Kazakov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox