GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Oct 22, 2014 1:38 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Text below the Image
PostPosted: Wed Jan 18, 2012 2:08 am 
Offline

Joined: Wed Jan 18, 2012 2:04 am
Posts: 2
Hi

how can i putt the text below the image of button , right now i am getting text right side of the image like first image and then text .


Top
 Profile  
 
 Post subject: Re: Text below the Image
PostPosted: Wed Jan 18, 2012 12:05 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 764
Location: UK
Hi, you will need to you the function gtk_button_set_image_position() to set the position of the image. This was introduced in GTK 2.10. See http://developer.gnome.org/gtk3/stable/GtkButton.html#gtk-button-set-image-position

This is a very minimal example showing this.
Code:
/*
* compile with gcc example.c -o example `pkg-config --libs --cflags gtk+-3.0`
*/
#include <gtk/gtk.h>

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

    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    button = gtk_button_new_from_stock(GTK_STOCK_OK);
    gtk_button_set_image_position(GTK_BUTTON(button), GTK_POS_TOP);
    gtk_container_add(GTK_CONTAINER(window), button);

    g_signal_connect(window, "destroy", gtk_main_quit, NULL);

    gtk_widget_show_all(window);

    gtk_main ();

    return 0;
}

_________________
E.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group