Chinaunix首页 | 论坛 | 博客
  • 博客访问: 336911
  • 博文数量: 222
  • 博客积分: 9349
  • 博客等级: 中将
  • 技术积分: 2135
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-07 13:45
文章分类

全部博文(222)

文章存档

2010年(222)

分类: LINUX

2010-08-14 09:41:31



窗口装饰定义了窗口外观,FVWM 能用色板或位图来装饰窗口。第一个例子,看一个没 有位图的简单窗口装饰,为初学者定义一些色彩模板以便设定装饰窗口的基本色 彩。色彩模板能用于定义所有 FVWM 要用到的色彩。下面建立三个简单的色彩模板。

#####
# Window Colorsets
###########
Colorset 3 fg #101060, bg #e6e7d7
Colorset 4 fg Black, bg #a6a797
Colorset 5 fg White, bg Black

建立三个色彩模板,分别命名为3,4,5,都有前景色(fg)和背景色(bg)。颜色能用十六 进制定义,也可引用 /etc/X11/rgb.txt 中定义的颜色。你能定义的其它颜色属性是高亮 (hi)和阴影(sh)。尽管色彩模板可以任意长度的整数编号,但由于 fvwm 用内存来保存每个 用到的色彩模板,所以要让色彩模板的编号尽可能的小一点。更详细的信息请看 FvwmThemes 的手册页。

装饰能分成三个部分,TitleStyle, ButtonStyle, BorderStyle。下面建立一个简单的 装饰

#####
# Window Decor
###########
DestroyDecor MyDecor
AddToDecor MyDecor
+ TitleStyle LeftJustified Height 18
+ ButtonStyle 1 ActiveUp Vector 4 30x30@3 60x60@3 60x30@4 30x60@3 -- Flat
+ ButtonStyle 1 ActiveDown Vector 4 30x30@3 60x60@3 60x30@4 30x60@3 -- Flat
+ ButtonStyle 1 Inactive Vector 4 30x30@3 60x60@3 60x30@4 30x60@3 -- Flat
+ ButtonStyle 3 ActiveUp Vector 5 30x60@3 60x60@3 60x50@3 30x50@3 30x60@3 -- Flat
+ ButtonStyle 3 ActiveDown Vector 5 30x60@3 60x60@3 60x50@3 30x50@3 30x60@3 -- Flat
+ ButtonStyle 3 Inactive Vector 5 30x60@3 60x60@3 60x50@3 30x50@3 30x60@3 -- Flat
+ ButtonStyle 5 ActiveUp Vector 7 30x30@3 30x60@3 60x60@3 60x30@3 30x30@3 30x35@3 60x35@3 -- Flat
+ ButtonStyle 5 ActiveDown Vector 7 30x30@3 30x60@3 60x60@3 60x30@3 30x30@3 30x35@3 60x35@3 -- Flat
+ ButtonStyle 5 Inactive Vector 7 30x30@3 30x60@3 60x60@3 60x30@3 30x30@3 30x35@3 60x35@3 -- Flat
+ TitleStyle -- Flat
+ BorderStyle Simple -- NoInset Flat
+ ButtonStyle All -- UseTitleStyle

这个装饰用 Vectors 创建了三个按钮,编号1,3,5(与按键绑定一节中窗口中的位置相同)。 注意:在按钮添加到装饰之前,它必须已通过按键绑定关联过一些动作。每句跟着一个 '-- Flat' 是为了不让按钮和标题栏凸出(陷入)于窗口。Vectors 只是简单得画线。每个 vector 建立一个 100x100 的格子并拥有任意数目的用线相连的点,语法 'Vector [number of points] [[point1] [point2] ...]'。 points 以 'XxY@Z' 定义,Z 是 0-4 中任意数字,代表用于这一行的颜色( 0 - Shadow(sh), 1 - Hilight(hi), 2 - Background(bg),3 - Foreground(fg), 4 - Invisible)

这里有个更为详细的对按钮和标题栏用位图的例子

#####
# Ukkosta Decor
###########
DestroyDecor UkkostaDecor
AddToDecor UkkostaDecor
+ TitleStyle LeftJustified Height 24
+ ButtonStyle 1 \
ActiveUp (Pixmap $[fvwm_img]/button/close-activeup.png -- Flat) \
ActiveDown (Pixmap $[fvwm_img]/button/close-activedown.png -- Flat) \
Inactive (Pixmap $[fvwm_img]/button/inactive.png -- Flat)
+ ButtonStyle 3 \
ActiveUp (Pixmap $[fvwm_img]/button/iconify-activeup.png -- Flat) \
ActiveDown (Pixmap $[fvwm_img]/button/iconify-activedown.png -- Flat) \
Inactive (Pixmap $[fvwm_img]/button/inactive.png -- Flat)
+ ButtonStyle 5 \
ActiveUp (Pixmap $[fvwm_img]/button/maximize-activeup.png -- Flat) \
ActiveDown (Pixmap $[fvwm_img]/button/maximize-activedown.png -- Flat) \
Inactive (Pixmap $[fvwm_img]/button/inactive.png -- Flat)
+ ButtonStyle 1 - Clear
+ ButtonStyle 3 - Clear MwmDecorMin
+ ButtonStyle 5 - Clear MwmDecorMax
+ TitleStyle AllActive MultiPixmap \
Main AdjustedPixmap $[fvwm_img]/decor/title-main-active.xpm, \
LeftEnd AdjustedPixmap $[fvwm_img]/decor/title-leftend-active.xpm, \
RightEnd AdjustedPixmap $[fvwm_img]/decor/title-rightend-active.xpm, \
UnderText AdjustedPixmap $[fvwm_img]/decor/title-undertext-active.xpm, \
LeftOfText AdjustedPixmap $[fvwm_img]/decor/title-leftoftext-active.xpm, \
RightOfext AdjustedPixmap $[fvwm_img]/decor/title-rightoftext-active.xpm
+ TitleStyle AllInactive MultiPixmap \
Main AdjustedPixmap $[fvwm_img]/decor/title-main-inactive.xpm, \
LeftEnd AdjustedPixmap $[fvwm_img]/decor/title-leftend-inactive.xpm, \
RightEnd AdjustedPixmap $[fvwm_img]/decor/title-rightend-inactive.xpm, \
UnderText AdjustedPixmap $[fvwm_img]/decor/title-undertext-inactive.xpm, \
LeftOfText AdjustedPixmap $[fvwm_img]/decor/title-leftoftext-inactive.xpm, \
RightOfext AdjustedPixmap $[fvwm_img]/decor/title-rightoftext-inactive.xpm
+ TitleStyle -- Flat
+ BorderStyle Simple -- NoInset Flat
+ ButtonStyle All -- UseTitleStyle

现在你已有了装饰定义,我们需要让窗口使用它,同时也要告诉窗口用哪个色彩模板。 像下面这样去做吧

#####
# Window Styles
###########
Style "*" UseDecor MyDecor
Style "*" Font "xft:Sans:Bold:size=8:minspace=False:antialias=True"
Style "*" BorderWidth 1, HandleWidth 1
Style "*" MWMBorder, FirmBorder
Style "*" Colorset 4
Style "*" HilightColorset 3
Style "*" BorderColorset 5
Style "*" HilightBorderColorset 4

这些样式字串告诉每个窗口用 MyDecor 装饰,同时设置窗口用的字体、边宽、色彩设定(高亮)、边缘色彩设定(高亮)。我喜欢所有窗口看上去一致,但是也有人喜欢为特殊的程序 用上不同的色彩模板和装饰。


阅读(525) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~