# 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" |