File: bar.e

package info (click to toggle)
entity 1.0.1-8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,604 kB
  • ctags: 5,394
  • sloc: ansic: 64,242; sh: 7,377; makefile: 776; perl: 319
file content (175 lines) | stat: -rw-r--r-- 4,995 bytes parent folder | download | duplicates (2)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<object default-lang="javascript" name="eBar">
  <popupmenu name="context" label="Menu">
    <menuitem label="Save State" onselect="save_self"/>
    <menuitem label="Close" onselect="entity:exit"/>
  </popupmenu>
  <javascript>
  <![CDATA[
	   function context_menu (node, button)
	   {
	       if (button == 3) {
	         enode ("popupmenu.context").attrib.popup = "true";
	       }
	   }
	   
	   function save_self (node)
	   {
	       obj = enode ("object");
	       filename = obj.attrib.__filename;
	       if (filename) {
		   xml = obj.get_xml ();
		   f = new File (filename);
		   f.open ("w");
		   f.write (xml);
		   f.close ();
	       }
	   }
  ]]>
  </javascript>
  <window name="main" height="32" ondelete="entity:exit" width="337"
   position="left" title="eBar" onbuttonpress="context_menu">
    <vwrapalign name="main" expand="true">
      <object onbuttonpress="context_menu" name="clock" dragable="true"
       expand="false" default-lang="javascript" tooltip="Tue Mar 27 2001">
        <menu visible="false" name="context" label="Menu" popup="true">
          <menuitem label="Remove" onselect="entity:exit"/>
        </menu>
        <label name="time" text="19:20:49"/>
        <timer interval="30000" action="update_tooltip"/>
        <timer interval="100" action="update_clock"/>
        <javascript>
        <![CDATA[
	    
	    function update_clock (timer_node)
	    {
		d = new Date ();
	        str = d.format ("%H:%M:%S");
		enode ("label.time").attrib.text = str; 
	    }
	    update_clock ();
    
	    function update_tooltip (node)
	    {
		d = new Date ();
		str = d.format ("%a %b %e %Y");
		enode ("object").attrib.tooltip = str;
	    }
	    update_tooltip ();

	    function context_menu (node, button, x, y)
	    {
		if (button == 3) {
		    enode ("menu.context").attrib.popup = "true";
		}
	    }

	]]>
        </javascript>
      </object>
      <object name="Launcher" dragable="true" default-lang="javascript">
        <button expand="true" name="launch" onbuttonpress="context_menu"
         onclick="launch" label="netscape"/>
        <menu visible="false" name="context" label="Menu" popup="true">
          <menuitem label="Configure.." onselect="open_configure"/>
          <menuitem label="Remove" onselect="entity:exit"/>
        </menu>
        <window name="configure" title="Configure Launcher"
         ondelete="close_configure" visible="false" border="3" width="174" height="130">
          <valign>
            <frame title="Command" border="3">
              <entry name="launch" text="netscape"/>
            </frame>
            <frame title="Title" border="3">
              <entry name="title" text="netscape"/>
            </frame>
            <button onclick="close_configure" label="OK"/>
          </valign>
        </window>
        <javascript>
        <![CDATA[

	function context_menu (node, button)
	{
	    if (button == 3) {
		enode ("menu.context").attrib.popup = true;
	    }
	}
	
	function close_configure ()
	{
	    enode ("window.configure").attrib.visible = "false";
	    app = enode ("entry.title").attrib.text;
	    enode ("button.launch").attrib.label = app;
	}

	function open_configure ()
	{
	    enode ("window.configure").attrib.visible = "true";
	}

	function launch ()
	{
	    node = enode ("entry.launch");
	    app = node.attrib.text;
	    app += "&";
	    System.system (app);
	}
			
]]>
        </javascript>
      </object>
      <object name="Launcher" dragable="true" default-lang="javascript">
        <button expand="true" name="launch" onbuttonpress="context_menu"
         onclick="launch" label="netscape"/>
        <menu visible="false" name="context" label="Menu" popup="true">
          <menuitem label="Configure.." onselect="open_configure"/>
          <menuitem label="Remove" onselect="entity:exit"/>
        </menu>
        <window name="configure" title="Configure Launcher"
         ondelete="close_configure" visible="false" border="3" width="174" height="130">
          <valign>
            <frame title="Command" border="3">
              <entry name="launch" text="netscape"/>
            </frame>
            <frame title="Title" border="3">
              <entry name="title" text="netscape"/>
            </frame>
            <button onclick="close_configure" label="OK"/>
          </valign>
        </window>
        <javascript>
        <![CDATA[

	function context_menu (node, button)
	{
	    if (button == 3) {
		enode ("menu.context").attrib.popup = true;
	    }
	}
	
	function close_configure ()
	{
	    enode ("window.configure").attrib.visible = "false";
	    app = enode ("entry.title").attrib.text;
	    enode ("button.launch").attrib.label = app;
	}

	function open_configure ()
	{
	    enode ("window.configure").attrib.visible = "true";
	}

	function launch ()
	{
	    node = enode ("entry.launch");
	    app = node.attrib.text;
	    app += "&";
	    System.system (app);
	}
			
]]>
        </javascript>
      </object>
    </vwrapalign>
  </window>
</object>