| 
      
      
      From: <kr_...@us...> - 2003-10-01 22:09:05
      
     | 
| Update of /cvsroot/htoolkit/port/src/cbits/GTK
In directory sc8-pr-cvs1:/tmp/cvs-serv28296/src/cbits/GTK
Modified Files:
	Notebook.c 
Log Message:
Thanks to the PortLayout widget the implementation of osGetNotebookReqSize
is now simple and efficient.
Index: Notebook.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Notebook.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Notebook.c	1 Oct 2003 21:47:15 -0000	1.5
--- Notebook.c	1 Oct 2003 22:09:00 -0000	1.6
***************
*** 31,62 ****
  void osGetNotebookReqSize(WindowHandle notebook, int *res)
  {
- 	int w,h;
  	GtkRequisition requisition;
- 	int i, count;
- 	GtkWidget *label;
- 
- 	w = 0; h = 0;
- 	count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook));
- 	for (i = 0; i < count; i++)
- 	{
- 		label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook),
- 		                                                    gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i));
- 		gtk_widget_size_request(label, &requisition);
  
! 		switch (gtk_notebook_get_tab_pos(GTK_NOTEBOOK(notebook)))
! 		{
! 		case GTK_POS_LEFT:
! 		case GTK_POS_RIGHT:
! 			if (w < requisition.width) w = requisition.width;
! 			break;
! 		case GTK_POS_TOP:
! 		case GTK_POS_BOTTOM:
! 			if (h < requisition.height) h = requisition.height;
! 			break;
! 		}
! 	}
  
! 	res[0] = w+12;
! 	res[1] = h+6;
  }
  
--- 31,44 ----
  void osGetNotebookReqSize(WindowHandle notebook, int *res)
  {
  	GtkRequisition requisition;
  
! 	// The size requisition of PortLayout is always 0. That means that the size request of notebook
! 	// will be equal to the external size of the notebook (i.e. the size consumed from borders and from
! 	// page labels. This is exactly what we need. In the haskell world to the external size is added
! 	// the size required to fit the pages of the notebook.
! 	gtk_widget_size_request (notebook, &requisition);
  
! 	res[0] = requisition.width;
! 	res[1] = requisition.height;
  }
  
 |