# pixmap_path "<dir 1>:<dir 2>:<dir 3>:..."
#
pixmap_path "/usr/include/X11R6/pixmaps:/home/imain/pixmaps"
#
# style <name> [= <name>]
# {
# <option>
# }
#
# widget <widget_set> style <style_name>
# widget_class <widget_class_set> style <style_name>
# 這裡列出所有狀態。注意有些狀態不能用在一定的元件上。
#
# NORMAL -元件的一般狀態,如滑鼠不位於元件上方,鍵未按下時元件所處的狀態。
#
# PRELIGHT - 當滑鼠移到元件上方,在此狀態下定義的顏色生效。
#
#
# ACTIVE -當處於元件上的滑鼠鍵被按下或點擊時,該元件被啟用,相應的屬性值將生效。
#
#
# INSENSITIVE -當元件被設置為不敏感 (insensitive) 時,它不能被啟用,相應屬性值起作用。
#
#
# SELECTED -選擇一個物件時,取相應的屬性值。
#
# 給定了這些狀態,我們就能使用以下指令設置在這些狀態下元件的屬性。
#
# fg - 設置元件的前景色。
# fg - 設置元件的背景色。
# bg_pixmap - 設置元件的背景為一幅像素圖。
# font - 設置給定元件所用的字型。
#
# 本例設置一種名為"button"的風格。這個名稱實際不重要,因為在檔案的後面會指定給實際的元件。
style "window"
{
#此處設置視窗背景為指定的像素圖。
#bg_pixmap[<STATE>] = "<pixmap filename>"
bg_pixmap[NORMAL] = "warning.xpm"
}
style "scale"
{
#設置"NORMAL"狀態下前景色(字型顏色)為紅色。
fg[NORMAL] = { 1.0, 0, 0 }
#設置此元件的背景圖案為其父元件的背景圖案。
bg_pixmap[NORMAL] = "<parent>"
}
style "button"
{
# 顯示一個按鈕的所有可能狀態,唯一未用的狀態是SELECTED。
fg[PRELIGHT] = { 0, 1.0, 1.0 }
bg[PRELIGHT] = { 0, 0, 1.0 }
bg[ACTIVE] = { 1.0, 0, 0 }
fg[ACTIVE] = { 0, 1.0, 0 }
bg[NORMAL] = { 1.0, 1.0, 0 }
fg[NORMAL] = { .99, 0, .99 }
bg[INSENSITIVE] = { 1.0, 1.0, 1.0 }
fg[INSENSITIVE] = { 1.0, 0, 1.0 }
}
# 在本例中,我們繼承"button"風格的屬性,然後重設PRELIGHT狀態下的字型和背景色以創建一個新的"main_button"風格。
style "main_button" = "button"
{
font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*"
bg[PRELIGHT] = { 0.75, 0, 0 }
}
style "toggle_button" = "button"
{
fg[NORMAL] = { 1.0, 0, 0 }
fg[ACTIVE] = { 1.0, 0, 0 }
# 這裡設置toggle_button的背景圖案為其父元件的圖案(在應用程式中已定義)。
bg_pixmap[NORMAL] = "<parent>"
}
style "text"
{
bg_pixmap[NORMAL] = "marble.xpm"
fg[NORMAL] = { 1.0, 1.0, 1.0 }
}
style "ruler"
{
font = "-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*"
}
# pixmap_path "~/.pixmaps"
# 下面設置使用以上所定義風格的元件類型。
# 元件類型是在類別的組織中列出的,但是恰有可能在檔案中列出供用戶參考。
widget_class "GtkWindow" style "window"
widget_class "GtkDialog" style "window"
widget_class "GtkFileSelection" style "window"
widget_class "*Gtk*Scale" style "scale"
widget_class "*GtkCheckButton*" style "toggle_button"
widget_class "*GtkRadioButton*" style "toggle_button"
widget_class "*GtkButton*" style "button"
widget_class "*Ruler" style "ruler"
widget_class "*GtkText" style "text"
# 設置作為「main windows」的子元件的所有按鈕元件為main_button風格。
# 這些(專門命名的元件)都必須附有文件說明讓用戶更好地使用它們。
widget "main window.*GtkButton*" style "main_button"
|
2008-03-04
1 則留言