View Full Version : Programming question (gdk)


maslan
hi all
i wanna to know can i make a resource file in my gtk & qt programs.
instead of callin the icon from a file.
i wanna it to be build in the exec.
:)

uniball
I know nothing about Qt, But i can tell you about Gtk+
Are you trying to set the main window icon or add an image to an existing window ? "ex: like in katoob about box ?"

maslan
i can do u what u mention
but what i want to add the icon or the image in the exectuable itself not be loaded.
as in programming windows we can make a resource files
containing icons,images,cursors,accelerators,menus.
i want the executable 1 file containing it's images & icons
in itself.

:)

i think that's impossible

:D

alaa
it is not impossible since in the end an image has to be loaded in memory inside a certain data structure, so all you need to do is find a way to manually put that image in a static data structure.

the easiest way to do this would be an xpm since xpm's are valid C code

so you would have something like this in your code


/* XPM */
static char * b_top_c_xpm[] = {
"16 5 5 1",
" c None",
". c #000000",
"+ c #E8ECE8",
"@ c #A8A8B0",
"# c #707470",
"................",
"++++++++++++++++",
"@@@@@@@@@@@@@@@@",
"################",
"................"};


interesting thing is, you don't really need to put this inside a .c or .h file you could just do


#include "b_top_c.xpm"


and afterwards just pass b_top_c_xpm to your functions.

cheers,
Alaa

ErrorMsg
there is a resorce file in linux , I heard about it, there is a stupid
tool come with X to do that but I'm not sure I not know in other words but I'm just trying to confuse you!! :D
--
off subject:
When I was using Allegro there is an eazy way to add
files to the executable
-Allegro is a game lib for linux/windows...-

uniball
X resources is not similar to the executable resource file.