test1.pl
changeset 3 689bf4b363c3
parent 2 46f2fcdca04f
child 5 89516833532f
equal deleted inserted replaced
2:46f2fcdca04f 3:689bf4b363c3
    12 use Data::Dumper;
    12 use Data::Dumper;
    13 
    13 
    14 my $glade;
    14 my $glade;
    15 my $label;
    15 my $label;
    16 my $field;
    16 my $field;
       
    17 my $eventbox;
    17 my $window_about;
    18 my $window_about;
    18 
    19 
    19 # load UI
    20 # load UI
    20 $glade = Gtk2::GladeXML->new("test1.glade");
    21 $glade = Gtk2::GladeXML->new("test1.glade");
    21 #$glade = Gtk2::GladeXML->new("/tmp/glade/hello-world.glade");
    22 #$glade = Gtk2::GladeXML->new("/tmp/glade/hello-world.glade");
    23 # connect signals
    24 # connect signals
    24 $glade->signal_autoconnect_from_package('main');
    25 $glade->signal_autoconnect_from_package('main');
    25 
    26 
    26 $label = $glade->get_widget('main_text1');
    27 $label = $glade->get_widget('main_text1');
    27 $field = $glade->get_widget('entry');
    28 $field = $glade->get_widget('entry');
       
    29 $eventbox = $glade->get_widget('eventbox1');
    28 $window_about = $glade->get_widget('aboutdialog1');
    30 $window_about = $glade->get_widget('aboutdialog1');
    29 
    31 
    30 print "firing up\n";
    32 print "firing up\n";
    31 Gtk2->main;
    33 Gtk2->main;
    32 
    34 
    38     my $color = $button->get_color();
    40     my $color = $button->get_color();
    39     my $alpha = $button->get_alpha();
    41     my $alpha = $button->get_alpha();
    40     print "Color is: ", $color->to_string(), "\n";
    42     print "Color is: ", $color->to_string(), "\n";
    41     print "Alpha is: ", $alpha, "\n";
    43     print "Alpha is: ", $alpha, "\n";
    42     
    44     
    43     # Gtk2::StateType?!
    45     # Gtk2::StateType?! (man gtk2::widget)
    44     #  FATAL: invalid enum GtkStateType value what, expecting: normal / GTK_STATE_NORMAL, 
    46     #  FATAL: invalid enum GtkStateType value what, expecting: normal / GTK_STATE_NORMAL, 
    45     # active / GTK_STATE_ACTIVE, prelight / GTK_STATE_PRELIGHT, selected / GTK_STATE_SELECTED, 
    47     # active / GTK_STATE_ACTIVE, prelight / GTK_STATE_PRELIGHT, selected / GTK_STATE_SELECTED, 
    46     # insensitive / GTK_STATE_INSENSITIVE 
    48     # insensitive / GTK_STATE_INSENSITIVE 
    47     $label->modify_bg( 'prelight', $color);
    49     #$label->modify_bg( 'prelight', $color);
    48     $label->modify_fg( 'active', $color);
    50     #$label->modify_fg( 'active', $color);
    49     $label->modify_text( 'normal', $color);
    51     #$label->modify_text( 'normal', $color);
       
    52     
       
    53     $eventbox->modify_bg( 'normal', $color);
       
    54     #$glade->get_widget('frame1')->modify_bg( 'normal', $color);
       
    55     
       
    56     $window_about->modify_bg( 'prelight', $color);
    50 }
    57 }
    51 
    58 
    52 
    59 
    53 sub on_main_about_button_clicked {
    60 sub on_main_about_button_clicked {
    54     $window_about->show();
    61     $window_about->show();