comparison gtk/dw.c @ 345:599644ca9064

Use _get_logical_page() to get the logical page from the physical page.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 11 Apr 2003 12:26:54 +0000
parents eff674cb4935
children 81fae15885d7
comparison
equal deleted inserted replaced
344:6a374f337d1f 345:599644ca9064
547 } 547 }
548 } 548 }
549 return retval; 549 return retval;
550 } 550 }
551 551
552 /* Return the logical page id from the physical page id */
553 int _get_logical_page(HWND handle, unsigned long pageid)
554 {
555 int z;
556 GtkWidget **pagearray = gtk_object_get_data(GTK_OBJECT(handle), "pagearray");
557 GtkWidget *thispage = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), pageid);
558
559 if(pagearray && thispage)
560 {
561 for(z=0;z<256;z++)
562 {
563 if(thispage == pagearray[z])
564 return z;
565 }
566 }
567 return 256;
568 }
569
570
552 static gint _switch_page_event(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer data) 571 static gint _switch_page_event(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer data)
553 { 572 {
554 SignalHandler *work = (SignalHandler *)data; 573 SignalHandler *work = (SignalHandler *)data;
555 int retval = FALSE; 574 int retval = FALSE;
556 575
557 if(work) 576 if(work)
558 { 577 {
559 int (*switchpagefunc)(HWND, int, void *) = work->func; 578 int (*switchpagefunc)(HWND, int, void *) = work->func;
560 retval = switchpagefunc(work->window, page_num, work->data); 579 retval = switchpagefunc(work->window, _get_logical_page(GTK_WIDGET(notebook), page_num), work->data);
561 } 580 }
562 return retval; 581 return retval;
563 } 582 }
564 583
565 static gint _select_row(GtkWidget *widget, gint row, gint column, GdkEventButton *event, gpointer data) 584 static gint _select_row(GtkWidget *widget, gint row, gint column, GdkEventButton *event, gpointer data)
6307 } 6326 }
6308 } 6327 }
6309 return 256; 6328 return 256;
6310 } 6329 }
6311 6330
6312 /* Return the logical page id from the physical page id */
6313 int _get_logical_page(HWND handle, unsigned long pageid)
6314 {
6315 int z;
6316 GtkWidget **pagearray = gtk_object_get_data(GTK_OBJECT(handle), "pagearray");
6317 GtkWidget *thispage = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), pageid);
6318
6319 if(pagearray && thispage)
6320 {
6321 for(z=0;z<256;z++)
6322 {
6323 if(thispage == pagearray[z])
6324 return z;
6325 }
6326 }
6327 return 256;
6328 }
6329
6330 /* 6331 /*
6331 * Remove a page from a notebook. 6332 * Remove a page from a notebook.
6332 * Parameters: 6333 * Parameters:
6333 * handle: Handle to the notebook widget. 6334 * handle: Handle to the notebook widget.
6334 * pageid: ID of the page to be destroyed. 6335 * pageid: ID of the page to be destroyed.