Re: PHP-GTK and themes ????
| From: | Jake Cobb | Date: | Fri, 25 May 2007 15:21:34 +0000 |
| Subject: | Re: PHP-GTK and themes ???? | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-7856@lists.php.net to get a copy of this message | ||
Hello,
PHP-GTK 2 supports themes insofar as Gtk+ itself supports them.
What may be lacking at the moment in PHP-GTK is theme control
from within your code, but someone else would need to confirm or
deny that.
I have two builds that I use regularly, one in Linux (Kubuntu) and one
in Windows.
For the Linux build, I compiled PHP and PHP-GTK myself
but built against development packages provided by the distribution
for all dependencies. Kubuntu uses KDE which is Qt based and my
system settings are set to use my KDE style for Gtk+ applications. So,
when my application runs in Kubuntu, it uses my selected system theme.
In Windows, I have a complete custom deployable build. I created this
for the most part following an excellent tutorial found here:
http://elizabethmariesmith.com/2006/11/15/how-to-compile-php52-and-php-gtk2-on-windows-using-visual-c-express/2/
So, my deployable php-gtk build sits in a directory and has all of its
necessary components with it. Portions of the Gtk+ development tree
have to be present to run, but you can get away with leaving out themes.
In order to have themes, you need (at least?) the following directories
available alongside your build or otherwise in the path:
share\themes\<theme_name>\gtk-2.0\gtkrc
lib\gtk-2.0\<gtk_version>\engines
My theme is specified as "MS-Windows" in two places:
etc\gtkrc
.gtkrc-2.0
The .gtkrc-2.0 seems to be the one controlling selection.
Note you don't specify these full paths in your path, you just need the root.
So the folder containing share, lib, etc and .gtkrc-2.0 needs to be in your path.
Themes use different engines, so your engines folder needs the appropriate one.
For "MS-Windows" the engine is Wimp. I have the following files:
libwimp.dll
libpixmap.dll
libsvg.dll
in
lib\gtk-2.0\2.10.0\engines
When I run my application in Windows using that build, it uses the
Wimp/MS-Windows theme. When I initially created the build, I omitted
the share folder and the application ran without a theme.
Since I'm developing a specialized commercial application, it's important
that I have control over the build. I built an installer using NSIS that
installs my deployable php-gtk build and my application.
Here's the catch. If I run the installer on a Windows XP system that does
not have Gtk+ already installed (which it would be if Gimp, Gaim, etc were installed),
then the Wimp theme is used. If I install to a Windows XP system which already
has Gtk+, my theme choice may or may not be used. In some cases the application
is themed, but its not using my theme. All my efforts at locating the various .gtkrc-2.0
files and temporarily renaming them and at renaming the existing libwimp.dll did not
effect the theme being used. I can only assume there are Gtk+ related files in the main
system paths that are overriding my choice. Finally, if I install to a Windows Server 2003
system (without an existing Gtk+ install), the application has no theme.
So, the short answer is yes it supports themes but ensuring consistent use of a single
theme is tricky.
Perhaps if someone else has experience with this they can complement / supplement my own.
-Jake Cobb
Adz07 wrote:
Can some one just confirm to me if PHP-GDK2 supports themes??? It says it doesn't on the php-gdk web site but i have seen some apps that look like they have themes?? I am confused because i setup everything, created an app , run it and it looked just like regular windows XP quite nice..i could live with that theme. Since playing around with the location of files etc, the app still runs but now does not have the look and feel of XP.. looks more like standard linux type. can anyone reply with a directory list of what should be where so i can check if this is the reason for it changing. Thanks