本文整理汇总了PHP中Gtk::stock_list_ids方法的典型用法代码示例。如果您正苦于以下问题:PHP Gtk::stock_list_ids方法的具体用法?PHP Gtk::stock_list_ids怎么用?PHP Gtk::stock_list_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk
的用法示例。
在下文中一共展示了Gtk::stock_list_ids方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __create_box
function __create_box()
{
$iv = new GtkIconView();
$model = new GtkListStore(GdkPixbuf::gtype, GObject::TYPE_STRING);
$iv->set_model($model);
$iv->set_columns(1);
$ids = Gtk::stock_list_ids();
sort($ids);
foreach ($ids as $id) {
$pixbuf = $iv->render_icon($id, Gtk::ICON_SIZE_DIALOG);
$model->set($model->append(), 0, $pixbuf, 1, $id);
}
$iv->set_pixbuf_column(0);
$iv->set_text_column(1);
//multi select incl. zooming up an rectangle to select icons
$iv->set_selection_mode(Gtk::SELECTION_MULTIPLE);
//labels at the right side
$iv->set_orientation(Gtk::ORIENTATION_HORIZONTAL);
//enough place for the text so that it doesn't wrap
$iv->set_item_width(200);
//spacing between icon and label
$iv->set_spacing(0);
//spacing between single rows
$iv->set_row_spacing(0);
//spacing between cols
//margin from the edges of the view widget -> like the CSS margin property
$iv->set_margin(5);
//in how many columns the view will be split
//Icon order (for 3 columns):
// 1 2 3
// 4 5 6
//FIXME: is there a way to arrange it horizontally so that it's arranged that way:
// 1 4 7
// 2 5 8
// 3 6 9 ?
//0 is auto-fit
$iv->set_columns(0);
$editor = new WidgetEditor($iv, array(array('selection_mode', GtkComboBox::gtype, 'Gtk::SELECTION_'), array('orientation', GtkComboBox::gtype, 'Gtk::ORIENTATION_'), array('item_width', GtkScale::gtype, 0, 500), array('spacing', GtkScale::gtype, -100, 100), array('row_spacing', GtkScale::gtype, -100, 100), array('column_spacing', GtkScale::gtype, -100, 100), array('margin', GtkScale::gtype, -100, 200), array('columns', GtkScale::gtype, 0, 20)));
$scrollwin = new GtkScrolledWindow();
$scrollwin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
$scrollwin->add($iv);
return $scrollwin;
}
示例2: create_model
private function create_model()
{
$store = new GtkListStore(GObject::TYPE_PHP_VALUE, GObject::TYPE_STRING);
$ids = Gtk::stock_list_ids();
sort($ids);
foreach ($ids as $id) {
$info = new StockItemInfo($id);
$stock_item = Gtk::stock_lookup($id);
if ($stock_item) {
$info->stock_item = $stock_item;
} else {
$info->stock_item = array('', '', 0, 0, '');
}
$icon_set = GtkIconFactory::lookup_default($id);
if ($icon_set) {
$sizes = $icon_set->get_sizes();
$size = $sizes[0];
for ($i = 0; $i < count($sizes); $i++) {
if ($sizes[$i] == Gtk::ICON_SIZE_MENU) {
$size = Gtk::ICON_SIZE_MENU;
break;
}
}
$info->small_icon = $this->render_icon($info->stock_id, $size);
if ($size != Gtk::ICON_SIZE_MENU) {
list($width, $height) = Gtk::icon_size_lookup(Gtk::ICON_SIZE_MENU);
$info->small_icon = $info->small_icon->scale_simple($width, $height, 'bilinear');
}
} else {
$info->small_icon = null;
}
if ($info->stock_item[3] == 0) {
$info->accel_str = '';
} else {
$info->accel_str = '<' . Gtk::accelerator_get_label($info->stock_item[3], $info->stock_item[2]) . '>';
}
$iter = $store->append();
$store->set($iter, 0, $info, 1, $id);
}
return $store;
}