Changing the GTK Scrollbar image - gtk

I would like to change the image of GTK Scrollbar,
i.e) I want to remove the standard looking scrollbar, and add my resources to it.
I dont mind touching gtk code.
I am sure that GTK will maintain all the images as a resources,
Can any one please locate me, where to change the images?
Thanks in advance
Dinesh P

The scrollbars aren't drawn in GTK; the theme engine is responsible for drawing them. In all themes that I know of, they are not drawn using image resources, but instead using GDK or Cairo.
See for example this code from the Clearlooks theme: http://git.gnome.org/browse/gtk-engines/tree/engines/clearlooks/src/clearlooks_draw_glossy.c (line 915, function clearlooks_glossy_draw_scrollbar_stepper())
If you want to use images, you will have to change a theme engine or write your own.
<standard-lecture>
It's generally frowned upon to do this sort of thing in GTK; the toolkit is all about usability. Users with particular needs may have configured their themes in a particular way, for example to be compatible with a screen reader, and drawing your own customized stuff may interfere with that. At the very least, you will piss people off by breaking their desktop themes. As an application developer, you should build your application out of the widgets that GTK and other libraries provide, and the user should be free to decide how it looks on their own desktop. </standard-lecture>

Related

How to embed an SDL_Surface into GTK+

I am writing a game using SDL, but would like to use GTK+ for controls. I therefore need to embed an SDL_Surface into GTK+. How should I do this?
Edit
The game would be a tile-based transport simulator (like OpenTTD), but instead of using SDL to display the game UI (screenshot), I would use GTK+.
(I find OpenTTD's SDL-based GUI quite clumsy because it doesn't integrate with the OS and therefore doesn't support things like copy-paste, control with the arrow and tab keys, etc.)
Not knowing much about what you're currently trying to do I suspect that SDL and GTK+ may be overlapping quite a bit, so I'm not sure how useful would it be to use both at the same time.
When writing a game the purpose of any toolkit is usually to simply talk to the windowing system and to manage inputs as all the drawing is done using GL.
If you also plan to use GTK+ for controls I'd recommend to just use GTK+ and not mix the two.
With GTK+ the best way to use GL is to use the GtkGLArea widget which gives you a canvas where to draw using standard GL calls.
If instead you don't plan to use GL but you just want to draw in software, the right widget for that purpose would be GtkDrawingArea.
By joining the #gnome-games IRC channel on the irc.gnome.org server you may find people more knownledgeable that can guide you better than me. :)

Any way to move widgets beyond container without resizing it?

I am working on a game using GTK3 as a rendering technique (terrible idea, but it's a school project).
My gameobjects are made of Image widgets and are placed in a Fixed container. It's working pretty well, however when i move widgets beoynd right or bottom border, the window automatically grows along with it.
I want the window to stay at the sam size, event if widget leaves its area and becomes invisible. It works when i move widget past the upper or left border.
I tried using gtk_widget_set_vexpand and gtk_widget_set_hexpand. My window is set as not resizable (gtk_window_set_resizable).
Is there any way I can achieve this?
This isn't the right way to use GTK+. GTK+ is intended for laying out widgets in a GUI program.
There are better options for animating 2D elements. One that works with GTK+ natively is the Clutter library. You can also integrate SDL or OpenGL or something like that if you so choose.
That being said, you can also use GtkLayout instead of GtkFixed, or put the GtkFixed in a GtkScrolledWindow and hide the scrollbars and set the scroll policy to prevent scrolling. It's still technically misuse, and in fact GtkFixed (and possibly GtkLayout too but the docs don't say) is really not supposed to be used anymore unless absolutely necessary because it doesn't give you automatic support for tricky UI layout problems, but it doesn't have extra dependencies.

How to set anti-aliasing mode for specific gtk+ application

I trying to write simple gtk+ application with pygobject that using gtk.TextView. In stock demo code I see that font sets up with Pango, but I can't find corresponding method for set up antialiasing-mode. By default font looks little ugly for me.
Does anybody know how to set anti-aliasing in gtk+ app (with python or pure C, Pango or other way)?
Well, it's not easy. Many factors interact to get the final font glyphs on your screen.
Maybe one of the easiest ways to change antialiasing globally would be to reprogram fontconfig. This article describes how to disable anti-aliasing, but it indicates where the config item is located.
Then, on a per-application basis, the actual work of drawing the characters is in the hands of Pango, but Pango may be programmed to use Xft (fontconfig) or Cairo to do the actual drawing. In case of Cairo (which seems to gather popularity), the anti-aliasing is done there. There's an article on that here on stackoverflow. Basically there's a function in the Cairo library, called 'cairo_set_aliasing'
Edit: Have a look at the XFCE window manager. In ths Settings | Appearance tool, you can change the anti aliasing 'globally', from 'none', 'slight', 'more' to 'full', and select subpixel in color or gray, horizontal/vertical and details. The code is contained in the xfce4-appearance-settings module of XFCE.
The aliasing setup is in xfce4-settings-4.12.0.tar.bz2, in dialogs/appearance-settings/main.c. I'm not sure if it actually activated there. I've quite a lot of work at the moment, but, if necessary can lend you a hand later.

How to develop transparent interface?

This is not completely a programming question. Today when I load LiLi USB creator software I saw the interfaces are transparent. Is that because they are Photoshopped or is transparency a technique of IDE? I'm using both NetbBeans and Eclipse. To be clear, I'm adding a photo too.
For transparency of the entire GUI, including controls (which doesn't seem to be the case in your screenshot), .NET includes the Form.Opacity property.
Additionally, it may be possible to use LayeredWindows to change only the opacity of the top-level component to produce the desired effect.
For Java specifically, there's an official Java tutorial for that, although it seems to set the opacity of the entire window, including all child components.

SmartGWT skinning

Some SmartGWT components are composed by a lot of small images. This is the case of IButton for example that gets rendered using images.
I want to adapt the original SmartGWT CSS to fit my needs, that are basically color changes.
This answer is not quite accurate..
If you have staff with experience with image-based skinning and appropriate tools (eg Adobe Fireworks), start from whatever skin you like.
If you don't, and you need to change the colors but don't care about niceties like rounded corners in older IE (which are impossible without images), start from Simplicity, or start from the CSS3 rendering mode provided for the 3 most popular skins (from 3.1 on):
http://blog.isomorphic.com/css3-mode/
The latter approach (CSS3 mode) is more visually rich than Simplicity.
It seems, that the best way of skinning an SmartGWT application is starting from the Simplicity theme.
Isomorphic team suggest starting from this theme, as it uses less images that the others themes.
As far as I've read, everything should be done by hand (editing images, and CSS).