-
Notifications
You must be signed in to change notification settings - Fork 0
/
TweetList.php
73 lines (64 loc) · 2.33 KB
/
TweetList.php
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
<?php
/**
* TweetList.php - \Callicore\Twitter\TweetList gtktreeview + gtkmodel for listing tweets
*
* This is released under the MIT, see license.txt for details
*
* @author Elizabeth Smith <[email protected]>
* @copyright Elizabeth Smith (c)2009
* @link http://callicore.net
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @version $Id: TweetList.php 25 2009-04-30 23:58:52Z auroraeosrose $
* @since Php 5.3.0
* @package callicore
* @subpackage twitter
* @filesource
*/
/**
* Namespace for application
*/
namespace Callicore\Twitter;
use \Gtk; // a lot of constants from here
use \Gobject; // type constants for liststore
use \GtkScrolledWindow; // this is the base widget we're using
use \GtkListStore; // our data store
use \GtkTreeView; // viewing the store
use \GtkCellRendererText; // view text
use \GtkTreeViewColumn; // putting renderer in a column
class TweetList extends GtkScrolledWindow {
/**
* The treeview widget
* @var object instanceof GtkTreeView
*/
protected $treeview;
/**
* The liststore widget
* @var object instanceof GtkListStore
*/
protected $liststore;
/**
* Creates a listview inside a treeview inside a gtkscrolledwindow
* the data can be one of recent, replies, messages, and everyone
* and is retreived from the twitter API
*
* @return void
*/
public function __construct($type) {
// create the parent
parent::__construct();
// we only scroll vertically please
$this->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS);
// create our liststore to put the twitter data in
$store = new GtkListStore(GObject::TYPE_STRING);
$store->append(array($type));
// create the treeview, set some settings, and add it
$this->treeview = new GtkTreeView($store);
$this->treeview->set_property('headers-visible', false);
$this->treeview->set_rules_hint(true);
$this->treeview->set_resize_mode(Gtk::RESIZE_IMMEDIATE);
$this->add($this->treeview);
$renderer = new GtkCellRendererText();
$column = new GtkTreeViewColumn('Message', $renderer, 'text', 0);
$this->treeview->append_column($column);
}
}