GtkArrow Constructor

GtkArrow Constructor

GtkArrow ( GtkArrowType arrow_type , GtkShadowType shadow_type );

For a simple widget, there are a lot of options in the construction of the GtkArrow - twenty different combinations in all.

It may not be immediately obvious that the GtkArrow is made up entirely of lines of shadow. As a result of this, the GtkShadowType option GTK_SHADOW_NONE actually creates an invisible arrow - a potentially useful option to have, given that the parameters of the arrow can be redefined at any point using the set() method.

The syntax to create a right-pointing, etched arrow would be:

Example 2. A list of GtkArrows

<?php
if( !extension_loaded('gtk')) {	
	dl( 'php_gtk.' . PHP_SHLIB_SUFFIX); 
}

$window = &new GtkWindow();
$window->set_default_size( 600, 500);
$window->connect_object('destroy', array('gtk', 'main_quit'));

$table	= &new GtkTable( 5, 6);

$color = &new GdkColor( '#FF0000');

$arTxtArrowTypes = array( 'GTK_ARROW_UP', 'GTK_ARROW_DOWN', 'GTK_ARROW_LEFT', 'GTK_ARROW_RIGHT');
$arTxtShadowTypes = array( '', 'GTK_SHADOW_NONE', 'GTK_SHADOW_IN', 'GTK_SHADOW_OUT', 'GTK_SHADOW_ETCHED_IN', 'GTK_SHADOW_ETCHED_OUT');
for( $nA = 0; $nA < 6; $nA++) {
	$label	= &new GtkLabel( $arTxtShadowTypes[$nA]);
	$table->attach( $label, 0, 1, $nA, $nA+1);
	
    for( $nB = 0; $nB < 5; $nB++) {
		if( $nA == 0) {
			$widget	= &new GtkLabel( $arTxtArrowTypes[$nB]);
		} else {
			$widget = &new GtkArrow( $nB, $nA-1);
			$style = $widget->style;
			$style->bg[GTK_STATE_NORMAL] = $color;
//			$widget->set_style( $style);
		}
		$table->attach( $widget, $nB+1, $nB+2, $nA, $nA+1, GTK_EXPAND|GTK_FILL, GTK_EXPAND|GTK_FILL);
	}
}

$window->add( $table);
$window->show_all();
gtk::main();
?>
© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.