File: Menu-Definitions.html

package info (click to toggle)
pcb 1.99j%2B20050127-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,632 kB
  • ctags: 4,302
  • sloc: ansic: 45,369; pascal: 3,526; sh: 1,140; yacc: 1,076; makefile: 575; lex: 348; perl: 183; awk: 102; tcl: 63
file content (82 lines) | stat: -rw-r--r-- 3,558 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<html lang="en">
<head>
<title>Pcb</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Pcb">
<meta name="generator" content="makeinfo 4.6">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
--></style>
</head>
<body>
<div class="node">
<p>
Node:&nbsp;<a name="Menu%20Definitions">Menu Definitions</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="Menu-Files-and-Defaults.html#Menu%20Files%20and%20Defaults">Menu Files and Defaults</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Resource-Syntax.html#Resource%20Syntax">Resource Syntax</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Custom-Menus.html#Custom%20Menus">Custom Menus</a>
<hr><br>
</div>

<h3 class="section">Menu Definitions</h3>

<p>To best understand this section, you should find the
<code>pcb-menu.res</code> file that your Pcb uses and refer to it for
examples (see <a href="Menu-Files-and-Defaults.html#Menu%20Files%20and%20Defaults">Menu Files and Defaults</a>).

   <p>A resource defines a menu when it meets certain semantic requirements. 
The menu hierarchy is reflected as a hierarchy of unnamed
subresources, with the first string of each subresource defining the
label used for the menu button.  A subresource that itself contains
subresources becomes a submenu, a subresource that does not becomes a
button.

   <p>A submenu should only contain subresources for the buttons or submenus
within that submenu.  Two exceptions are allowed: an initial string
sets the label, and the string "-" (a single dash) will create a
separator.

   <p>A button should not contain subresources, but will contain many
strings, named and unnamed.  The first member shall be an unnamed
string which is the label for the button.  Any other unnamed strings
within the button's resource will be used as actions (much like the
.Xdefaults action strings), which are functions that will be called
when the button is pressed (or popped up, or created, depending on the
action).  As a convenience, if a left parenthesis is seen, the current
"word" will continue at least until the matching right parenthesis. 
This allows you to pass strings with spaces as arguments to actions
without needing to quote the action.

   <p>Named resources in button resources will be used as X resources.  Such
resources can be used to set the font, color, and spacing of buttons. 
As a convenience, "fg" can be used as an abbreviation for "foreground".

   <p>Within the menu's resource file, Pcb will look for a few key named
subresources.  At the moment, the only one it looks for is one called
<code>MainMenu</code>.  This will be used for the main menu bar.  In the
future, other named subresources will be used for popup resources.

   <p>Given all this, a small sample <code>pcb-menu.res</code> would be:

<pre class="example">     MainMenu = {
       {File
         {"Load layout" Load(Layout)}
         -
         {"Quit Program" Quit() fg=red font=10x20}
       }
     }
     </pre>

   <p>Within the Pcb sources are specially crafted comments that mark all
the actions, flags, menu hooks, and whatnot that Pcb offers.  Read the
file <code>src/gather-actions</code> in the Pcb source tree for
documentation for these comments.

   </body></html>