GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need small help on ZOOM label

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
gopik



Joined: 16 Apr 2008
Posts: 1

PostPosted: Wed Apr 16, 2008 4:30 am    Post subject: Need small help on ZOOM label Reply with quote

I'm not a gtk+ programmer. I don't even know C.

I need small help. I spent a week on google and learned few things.

My requirement: I need a button which does Zoom Out of Label.

I tried using Struct , but I'm not able to pass it to callback.

Please look at code. It contains a label and a button. When a button is clicked , label font size should be increased.

Quote:



#include <gtk/gtk.h>

gint delete_event( GtkWidget *widget,
GdkEvent *event,
gpointer data )
{
gtk_main_quit();
return(FALSE);
}

void callback_( GtkWidget *widget,
gpointer data )
{
// Incriment label font size
}


int main( int argc,
char *argv[] )
{
GtkWidget *window;
GtkWidget *button;
GtkWidget *box1;
GtkWidget *label;

gtk_init (&argc, &argv);

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

gtk_window_set_title (GTK_WINDOW (window), "Hello Buttons!");

gtk_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (delete_event), NULL);

gtk_container_set_border_width (GTK_CONTAINER (window), 10);

box1 = gtk_hbox_new(FALSE, 0);
label = gtk_label_new ("I Want to ZOOM this text ");

gtk_container_add (GTK_CONTAINER (window), box1);

gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0);

gtk_widget_show(label);

button = gtk_button_new_with_label (" Click me to ZOOM that text ");

gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (callback_), NULL);

gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);

gtk_widget_show(button);

gtk_widget_show(box1);

gtk_widget_show (window);

gtk_main ();

return(0);
}




Please Add the extra logic to change the font size or point a relent example.

Thanks in Advance
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP