File: ctree-test.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 (97 lines) | stat: -rw-r--r-- 2,319 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
<object name="profile_builder">
  <window name="main" width="800" height="600" 
          ondelete="entity:exit" title="Profile Builder">
    <valign expand="true">
      <button label="Clear columns" onclick="clear_cols"/>
      <button label="Load columns" onclick="load_cols"/>
      <button label="Populate Cells" onclick="load_cells"/>
      <halign expand="true">
        <scrollwindow expand="true" name="anom_sw">
          <ctree name="mytree" expand="true" selection-type="multiple"
                 expander-style="none">
	    <ctree-column width="80" title="This" onclick="column_clicked"/>
	    <ctree-column width="80" title="is"/>
	    <ctree-column width="80" title="a"/>
	    <ctree-column title="test."/>
            <ctree-row onbuttonpress="on_button_press">
              <ctree-cell text="Hello"/>
	      <ctree-cell text="New"/>
	      <ctree-cell text="World"/>
	      <ctree-cell text="2001"/>
	    </ctree-row>
            <ctree-row onbuttonpress="javascript:on_button_press">
              <ctree-cell text="Hello"/>
	      <ctree-cell text="New"/>
	      <ctree-cell text="World"/>
	      <ctree-cell text="2001"/>
	    </ctree-row>
          </ctree>
        </scrollwindow>
      </halign>
    </valign>
  </window>

  <javascript>
  <![CDATA[

  function on_button_press (ctree, row, cell, bnum, column, offset)
  {
      print ("got", ctree.path, row.path, cell.path, bnum, column, offset);
  }

  ]]>
  </javascript>
      
  <perl>
  <![CDATA[

  sub column_clicked
  {
    print ("column clicked!\n");
  }

  sub on_button_press
  {
    my ($ctree, $row, $cell, $bnum, $column, $offset) = @_;
    print "$ctree, $row, $cell, $bnum, $column, $offset\n";
  }

  sub clear_cols
  {
    my $node;

    $node = enode ("ctree.mytree");
    $node->destroy_children ();
  }


  sub load_cols
  {
    my $node;

    $node = enode ("ctree.mytree");
    $node->append_xml (qq!<ctree-column title="This"/>
	    <ctree-column title="is"/>
	    <ctree-column title="a"/>
	    <ctree-column title="test."/>!);
  }


  sub load_cells
  {
    my $node;
   
    $node = enode ("ctree.mytree");
    $node->append_xml (qq!<ctree-row><ctree-cell text="Hello"/>
			  <ctree-cell text="New"/>
			  <ctree-cell text="World"/>
			  <ctree-cell text="2001"/></ctree-row>!);
  }

  ]]>
  </perl>
</object>