2 /* vim: set expandtab tabstop=4 shiftwidth=4: */
7 * Copyright (c) 2003-2009 KUBO Atsuhiro <kubo@iteman.jp>,
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
13 * * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
31 * @category Networking
32 * @package Net_UserAgent_Mobile
33 * @author KUBO Atsuhiro <kubo@iteman.jp>
34 * @copyright 2003-2009 KUBO Atsuhiro <kubo@iteman.jp>
35 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
36 * @version CVS: $Id: Display.php 2043 2009-07-03 09:36:18Z fishbone $
37 * @since File available since Release 0.1
39 * @modified-for adjust for magic3 framework
40 * @modified-by naoki hirata(naoki@aplo.co.jp)
41 * @modified-date 2009.7.3
44 // {{{ Net_UserAgent_Mobile_Display
47 * Display information for Net_UserAgent_Mobile
49 * Net_UserAgent_Mobile_Display is a class for display information on
50 * {@link Net_UserAgent_Mobile}. Handy for image resizing or dispatching.
54 * require_once 'Net/UserAgent/Mobile.php';
56 * $agent = &Net_UserAgent_Mobile::factory();
57 * $display = $agent->getDisplay();
59 * $width = $display->getWidth();
60 * $height = $display->getHeight();
61 * list($width, $height) = $display->getSize();
63 * if ($display->isColor()) {
64 * $depth = $display->getDepth();
67 * // only available in DoCoMo 505i
68 * $width_bytes = $display->getWidthBytes();
69 * $height_bytes = $display->getHeightBytes();
72 * USING EXTERNAL MAP FILE:
73 * If the environment variable DOCOMO_MAP exists, the specified XML data will be used
74 * for DoCoMo display information.
76 * ex) Please add the following code.
77 * $_SERVER['DOCOMO_MAP'] = '/path/to/DoCoMoMap.xml';
79 * @category Networking
80 * @package Net_UserAgent_Mobile
81 * @author KUBO Atsuhiro <kubo@iteman.jp>
82 * @copyright 2003-2009 KUBO Atsuhiro <kubo@iteman.jp>
83 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
84 * @version Release: 1.0.0
85 * @since Class available since Release 0.1
87 class Net_UserAgent_Mobile_Display
103 * width of the display
109 * height of the display
115 * depth of the display
121 * color capability of the display
127 * width (bytes) of the display
133 * height (bytes) of the display
150 * @param array $data display infomation
152 function Net_UserAgent_Mobile_Display($data)
154 $this->_width = (integer)@$data['width'];
155 $this->_height = (integer)@$data['height'];
156 $this->_depth = (integer)@$data['depth'];
157 $this->_color = (boolean)@$data['color'];
159 $this->_widthBytes = (integer)@$data['width_bytes'];
160 $this->_heightBytes = (integer)@$data['height_bytes'];
167 * returns width * height of the display
173 return $this->_width * $this->_height;
180 * returns width with height of the display
186 return array($this->_width, $this->_height);
193 * returns width of the display
199 return $this->_width;
206 * returns height of the display
212 return $this->_height;
219 * returns depth of the display
225 return $this->_depth;
232 * returns true if the display has color capability
238 return $this->_color;
242 // {{{ getWidthBytes()
245 * returns width (bytes) of the display
249 function getWidthBytes()
251 return $this->_widthBytes;
255 // {{{ getHeightBytes()
258 * returns height (bytes) of the display
262 function getHeightBytes()
264 return $this->_heightBytes;
286 * c-hanging-comment-ender-p: nil
287 * indent-tabs-mode: nil