OxyScripts.com
Menu spacer Home Tutorials Articles Code Forums irc.freenode.net #oxyscripts
Main (PHP)
Home Forums PHP News PHP Tutorials Articles PHP Code Snippets Contact Us Sysadmin Resources Books Template Shop
3rd Party Streams
SlashDot PHPDeveloper.org PHP.Net
Resources
PHP Manual MySQL Manual Smarty Manual PEAR Manual PHP-GTK Manual Symfony Manual
Code Snippets
Authentication Database Graphics HTTP Miscellaneous Time/Date
Affiliates
Scripts TutorialMan TutorialGuide CodingForums.com PHP Scripts Cheap Web Hosting Affordable Web Hosting Dreamweaver Templates

Search This Site :     PHP Function Reference :
 
GtkStyle Constructor

GtkStyle Constructor

GtkStyle (void);

There are several ways to define the style across an application, but only two ways to directly set the style on a given widget.

Example 42. Writing to a widget's style property.

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

$window = &new GtkWindow();
$window->set_position(GTK_WIN_POS_CENTER);
$window->connect_object('destroy', array('gtk', 'main_quit'));

/* set up a few buttons just to prove we're only changing one of them */
$bbox = &new GtkVButtonBox();
$window->add($bbox);

for($i = 0; $i < 8; $i++) {
  $button[$i] = &new GtkButton("This is Button $i");
  $bbox->pack_start($button[$i], false);
  $button[$i]->show();
}

/* method 1 : set up a new style and define the parts you want to define. 
   The remaining style elements retain the application's default settings. */
$newstyle = &new GtkStyle();
$cyan = &new GdkColor('#00FFFF');
$newstyle->fg[GTK_STATE_PRELIGHT] = $cyan;
$label = $button[5]->child;
$label->set_style($newstyle);

/* gdk::color_parse() uses a color that is defined on your system to fill
   a GdkColor structure.  It can be more convenient than manually creating
   a new GdkColor, particularly if you're only assigning the color once. */
$newstyle->bg[GTK_STATE_NORMAL] = gdk::color_parse('ivory');
$button[5]->set_style($newstyle);

/* method 2 : copy the existing style from a widget and alter it.  Defining
   a new style would overwrite the existing non-default style settings. */
$style2 = $label->style;
$newstyle2 = $style2->copy();
$font = gdk::font_load('-*-Arial-bold-r-normal--*-160-*-*-p-0-iso8859-1');
$newstyle2->font = $font;
$label->set_style($newstyle2);

$window->show_all();

gtk::main();
?>

 
   Print this page

Top Sponsor
Symantec\'s Norton SystemWorks 2006
Sponsors
CA
Sponsors
AdWords Dominator 125*125
Advertisting

Affiliates
VertexTemplates PHPFreaks CodeWalkers StarGeek DevScripts CGI & PHP Scripts PHP CMS

Shopping Rebates   Sell It 4 You   Flash Page Counters   Get Insured
GPS Tracking Service   Charity Donate Info   Web Site Hosting   VOIP Service

Privacy Policy | Links | Site Map | Advertising

All content on OxyScripts.com is (©)2002-2007

 
Powered by Adrastea - Version 1.0.0. Copyright © Rune Solutions, 2004-2005