File: bar.e

package info (click to toggle)
entity 0.7.2-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,352 kB
  • ctags: 5,272
  • sloc: ansic: 61,707; sh: 7,921; makefile: 732; perl: 399
file content (123 lines) | stat: -rwxr-xr-x 3,433 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
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
<object default-lang="javascript" name="eBar">
  <menu visible="false" name="context" label="Menu">
    <menuitem label="Save State" onselect="save_self"/>
    <menuitem label="Close" onselect="entity:exit"/>
  </menu>
  <javascript>
  <![CDATA[
	   function context_menu (node, button)
	   {
	       if (button == 3) {   
		   enode ("menu.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="Sat Jul 22 2000">
        <menu visible="false" name="context" label="Menu">
          <menuitem label="Remove" onselect="entity:exit"/>
        </menu>
        <label name="time" text="11:33:18"/>
        <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">
          <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>