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 3:12 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: notebook tab with other widget
PostPosted: Mon Nov 12, 2007 11:40 am 
Offline
Familiar Face

Joined: Wed Sep 19, 2007 1:30 pm
Posts: 10
Location: Hyderabad, India
hello,
i am using notebook in my application. i want to reduce the tab size and placing other widget next/near to tab(e.g search label with entry box = search box ). if i use hbox to pack the notebook with widget it is placing horizontally with notebook . how can i place my search box near to tab of notebook.
as well as reducing the size the notebook tab

also how to put button and image inside the tab (image -label -closebutton)

thank you.
sphurti


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 12, 2007 3:06 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
The second issue is easy. All you have to do is make a GtkHBox that contains (image -label -closebutton) widgets. Then, send that as the tab's label.

The first issue requires that you alter the GtkNotebook widget itself. You are going to have to go into the GtkNotebook code (the actual code that is compiled) and derive a new widget from this widget. You can find the code here: http://svn.gnome.org/viewvc/gtk%2B/trunk/gtk/

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject: Re:notebook tab with other widget
PostPosted: Tue Nov 13, 2007 12:31 pm 
Offline
Familiar Face

Joined: Wed Sep 19, 2007 1:30 pm
Posts: 10
Location: Hyderabad, India
hello,

i am able to set other widget near notebook using fixed container as :

GtkWidget *notebook = NULL;
GtkWidget *label = NULL;
GtkWidget *tab = NULL;
GtkWidget *hbox =NULL;
GtkWidget *fixed = NULL;

/*----- Notebook------*/
notebook = gtk_notebook_new ();
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
label = gtk_label_new ("tab1");
tab = gtk_frame_new("Frame1");
gtk_widget_set_size_request(tab,300,450);
gtk_notebook_append_page (GTK_NOTEBOOK(notebook ), tab, label);

label = gtk_label_new ("tab2");
tab = gtk_frame_new("Frame2");
gtk_widget_set_size_request(tab,300,450);
gtk_notebook_append_page (GTK_NOTEBOOK(notebook ), tab, label);

/*----search box -----*/
label = gtk_label_new ("Search");
tab = gtk_entry_new_with_max_length (20);

hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), tab, FALSE, FALSE, 0);

/*-----fixed --------*/
fixed= gtk_fixed_new();
gtk_fixed_put (GTK_FIXED(fixed),notebook,0,0);
gtk_fixed_put (GTK_FIXED(fixed),hbox,100,0);
gtk_container_add (GTK_CONTAINER (window), fixed);


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 14, 2007 4:54 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
Yes, this will work, but isn't a very good practice. What if the tab labels change? These will change with the system's font size. Try increasing the size of the fonts or changing your theme. This will alter the look and placement of everything.

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 15, 2007 8:10 am 
Offline
Familiar Face

Joined: Wed Sep 19, 2007 1:30 pm
Posts: 10
Location: Hyderabad, India
Thank you.

but ,i am not getting how to derive / create new widget from notebook
i am using c

i am facing one more problem with using GtkFixed and GtkVBox just now i post it
can u please looked into it

Thank you
sphurti


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 2 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group