1<?php
2// $Header: /cvsroot/html2ps/box.input.textarea.php,v 1.5 2006/12/24 14:42:43 Konstantin Exp $
3
4class TextAreaInputBox extends InlineBlockBox {
5  var $_field_name;
6  var $_value;
7
8  function TextAreaInputBox($value, $name) {
9    $this->InlineBlockBox();
10
11    $this->set_value($value);
12    $this->_field_name  = $name;
13  }
14
15  function &create(&$root, &$pipeline) {
16    $value = $root->get_content();
17    $name  = $root->get_attribute('name');
18
19    $box = new TextAreaInputBox($value, $name);
20    $box->readCSS($pipeline->get_current_css_state());
21    $box->create_content($root, $pipeline);
22
23    return $box;
24  }
25
26  function get_height() {
27    $normal_height = parent::get_height();
28    return $normal_height - $this->_get_vert_extra();
29  }
30
31  function get_min_width(&$context) {
32    return $this->get_max_width($context);
33  }
34
35  function get_max_width(&$context) {
36    return $this->get_width();
37  }
38
39  function get_value() {
40    return $this->_value;
41  }
42
43  function get_width() {
44    $normal_width = parent::get_width();
45    return $normal_width - $this->_get_hor_extra();
46  }
47
48  function set_value($value) {
49    $this->_value = $value;
50  }
51
52  function show(&$driver) {
53    /**
54     * If we're rendering the interactive form, the field content should not be rendered
55     */
56    global $g_config;
57    if ($g_config['renderforms']) {
58      $status = GenericFormattedBox::show($driver);
59
60      $driver->field_multiline_text($this->get_left_padding(),
61                                    $this->get_top_padding(),
62                                    $this->get_width()  + $this->get_padding_left() + $this->get_padding_right(),
63                                    $this->get_height() + $this->get_padding_top()  + $this->get_padding_bottom(),
64                                    $this->_value,
65                                    $this->_field_name);
66    } else {
67      $status = GenericContainerBox::show($driver);
68    }
69
70    return $status;
71  }
72}
73
74?>