Online Documentation Server
 ПОИСК
ods.com.ua Web
 КАТЕГОРИИ
Home
Programming
Net technology
Unixes
Security
RFC, HOWTO
Web technology
Data bases
Other docs

 


 ПОДПИСКА

 О КОПИРАЙТАХ
Вся предоставленная на этом сервере информация собрана нами из разных источников. Если Вам кажется, что публикация каких-то документов нарушает чьи-либо авторские права, сообщите нам об этом.




Resource Matching
next up previous contents
Next: Resource Precedence Rules Up: Widget Resource Management Previous: Setting Resources

Resource Matching

When an application starts up, a merged resource database is created, from resource settings in the X resource manager and various text files, in the manner described in the preceeding sections. When a widget is created, its hierarchy using both instance names and class names, plus its resource instance names and class names, are compared against each resource setting in the application's merged resource database.

In order to begin to understand the resource matching mechanism, consider setting the background colour of the quit button widget in the Athena version of the xbutton application. It is a Command class widget and, like all widget classes, inherits the resource background from the Core widget class.

Suppose the merged resource database was:

 
1		xbutton.background: red

2 xbutton*background: green

3 xbutton*label: stop

4 xbutton.Command.background: blue

5 quit.background: orange

6 *quit.background:yellow

What will be the background colour of the quit button? Looking at the entries in the merged resource database, only those that have background as the last element of the specification part are relevant. Thus, the third entry can be eleminated. Next, the widget's hierarchy, using both instance names and class names, is compared against the remaining entries. To be a contender, the first element of each entry's specification part must match the first element of the widget's hierarchy, either by instance name or class name, remembering that an asterisk will match anything.

The widget hierarchy for the Athena version is:

 
		xbutton.quit (instance names)

XButton.Command (class names)

So, the fifth entry can be eliminated from the proceedings. The process continues by stripping off the first element (unless it is an asterisk) of the specification part of the remaining entries and also the first element of the widget's hierarchy. The entries from the merged resource database now appear as:

 
1		background: red

2 *background: green

4 Command.background: blue

6 *quit.background:yellow

The widget's hierarchy becomes:

 
		quit (instance names)

Command (class names)

The comparison continues as before. Thus, the first entry can now be eliminated. The matching process is now complete with the second, fourth and sixth entries all viable resource settings for the widget's background colour. There are precendence rules to determine which entry is ultimately chosen.



next up previous contents
Next: Resource Precedence Rules Up: Widget Resource Management Previous: Setting Resources



JR Pitchers
Wed May 3 16:45:04 BST 1995


With any suggestions or questions please feel free to contact us