Re: About setting the resource file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If you have the images already in a directory under your gtk2.0 directory, try the following code (using the pixmap engine).  See border explanation below.

style "button" = "default"
{
    xthickness = 3
    ythickness = 3

engine "pixmap"
{

    image
    {
        function    = BOX
        recolorable    = TRUE
        detail        = "buttondefault"
        file        = "/button/button-default.png"
        border        = { 6 ,6, 6 ,6}
        stretch        = TRUE
    }

    image
    {
        function    = BOX
        state        = NORMAL
        file        = "/button/button-normal.png"
        border        = { 6 ,6, 6 ,6}
        stretch        = TRUE
    }

    image
    {
        function    = BOX
        recolorable    = TRUE
        state        = PRELIGHT
        shadow        = OUT
        file        = "/button/button-prelight.png"
        border        ={ 6 ,6, 6 ,6}
        stretch        = TRUE
    }

    image
    {
        function    = BOX
        recolorable    = TRUE
        state        = PRELIGHT
        shadow        = IN
        file        = "/button/button-prelight.png"
        border        = { 6 ,6, 6 ,6}
        stretch        = TRUE
    }

    image
    {
        function    = BOX
        state        = INSENSITIVE
        file        = "/button/button-inactive.png"
        border        = { 6 ,6, 6 ,6}
        stretch        = TRUE
    }


    image
    {
        function    = BOX
        state        = ACTIVE
        file        = "/button/button-active.png"
        border        = { 6 ,6, 6 ,6}
        stretch        = TRUE
    }
}

class "GtkButton"                      style "button"

----
Border explanation from https://stage.maemo.org/svn/maemo/projects/haf/trunk/sapwood/README
Images and borders
==================

border = { left, right, top, bottom }
the number of pixels from left, right, top and bottom edge respectively

This chapter tries to explain how the image stretching is done. The border
values define how the original image is to be stretched to fill up larger
areas. They are used to divide the image into a 3x3 grid of smaller images.
These smaller images are tiled, or not depending on their position in the
grid, while painting.

Take a 5x5 pixels image for example, with borders of 2px on each side. The
grid will look something like below. The corner pieces (1,3,7,9) are 2x2
pixels, the center (5) is 1x1 pixels and the horizontal (4,6) and vertical
(2,8) slices are 2x1 and 1x2 pixels respectively.

+--+-+--+
|11|2|33| top
|11|2|33|
+--+-+--+
|44|5|66|
+--+-+--+
|77|8|99| bottom
|77|8|99|
+--+-+--+
^ right
left


When the image is stretched to fill up say a 11x8 pixels area the stretched
image will look something like below. The corner pieces (1,3,7,9) are still
2x2 pixels, the horizontal slices (4,6) are tiled only vertically, the
vertical slices (2,8) are tiled only horizontally, and the center (5) is tiled
both horizontally and vertically.

+--+-------+--+
|11|2222222|33| top
|11|2222222|33|
+--+-------+--+
|44|5555555|66|
|44|5555555|66|
|44|5555555|66|
|44|5555555|66|
+--+-------+--+
|77|8888888|99| bottom
|77|8888888|99|
+--+-------+--+
^ right
left

1,3,7,9 are fixed
2,8 are tiled horizontally
4,6 are tiled vertically
5 is tiled both horizontally and vertically


 
Nik Bhattacharya
Cell: (512) 350-6452


----- Original Message ----
From: Keane Hu <keane_hu_sl@xxxxxxxxx>
To: gtk-list@xxxxxxxxx
Sent: Tuesday, July 8, 2008 3:42:40 AM
Subject: About setting the resource file

        Hi,
           I meet a broblem that use a resource file to setting the picture of  button widget, I try for a long time, but also failed. So would you help me, tell me something or methods, please.

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux