PHP-GTK
Thursday, October 23, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkMenuToolButton
GtkMenuToolButton::get_menunext

Last updated: Sun, 12 May 2013
view this page in English

GtkMenuToolButton Constructor

GtkMenuToolButton (GtkWidget icon_widget, string label);

Creates a new GtkMenuToolButton with the specified icon widget and label text. Since there is no new_from_stock static method, you should create the GtkImage widget with the new_from_stock constructor method.

Example 102. Open toolbar button with dropdown file menu

<?php
//GtkMenuToolButton example
 
//Create a new toolbar widget
$tb = new GtkToolbar();
 
//Add an "open" button
$open   = new GtkMenuToolButton(
    GtkImage::new_from_stock(
        Gtk::STOCK_OPEN,
        Gtk::ICON_SIZE_SMALL_TOOLBAR
    ),
    'Open'
);
$tb->insert($open, -1);
 
//create a menu that will be added to the toolbutton later
$menu = new GtkMenu();
$menu->add(new GtkMenuItem('File 1'));
$menu->add(new GtkMenuItem('File 2'));
$menu->add(new GtkMenuItem('File 3'));
//set the menu and all menuitem visible
$menu->show_all();
//attach the menu to the menu tool button
$open->set_menu($menu);
 
 
//Standard window that has the toolbar as only child
$window = new GtkWindow();
$window->add($tb);
$window->connect_simple('destroy', array('Gtk', 'main_quit'));
$window->show_all();
Gtk::main();
?>

User Contributed Notes
gtk.gtkmenutoolbutton.constructor.php
add a note about notes
There are no user contributed notes for this page.


previousGtkMenuToolButton
GtkMenuToolButton::get_menunext

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:50:59 2013 CEST