1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780
|
/*
* $Id: ctknotebook.c,v 1.25 2000/07/25 03:14:43 terpstra Exp $
*
* CTK - Console Toolkit
*
* Copyright (C) 1998-2000 Stormix Technologies Inc.
*
* License: LGPL
*
* Authors: Kevin Lindsay, Wesley Terpstra
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ctk.h"
#include "ctkstack.h"
#include "ctkcolor.h"
gboolean ctk_notebook_key_press (CtkWidget* widget, CdkEventKey* event, gpointer data);
gboolean ctk_notebook_button_press(CtkWidget* widget, CdkEventButton* event, gpointer data);
gboolean ctk_notebook_focus_in (CtkWidget* widget, CdkEventFocus* event, gpointer data);
gboolean ctk_notebook_focus_out (CtkWidget* widget, CdkEventFocus* event, gpointer data);
gpointer ctk_notebook_destroy(CtkObject *object);
/* Calculate the minimum size the notebook needs */
void ctk_notebook_min_size(CtkWidget* widget)
{
GSList* tab_list;
CtkNotebook* notebook;
CtkNotebookTab* tab;
gint tab_accum_x = 0;
gint tab_accum_y = 0;
gint page_biggest_x = 0;
gint page_biggest_y = 0;
notebook = CTK_NOTEBOOK(widget);
for (tab_list = notebook->tab_labels; tab_list; tab_list = tab_list->next)
{
tab = (CtkNotebookTab*)tab_list->data;
if (tab->label)
{
if (notebook->show_tabs && tab->label->show)
{
switch (notebook->tab_pos)
{
case CTK_POS_TOP:
case CTK_POS_BOTTOM:
tab_accum_x += tab->label->min_width + 3;
if (tab->label->min_height > tab_accum_y)
tab_accum_y = tab->label->min_height;
break;
case CTK_POS_LEFT:
case CTK_POS_RIGHT:
tab_accum_y += tab->label->min_height + 1;
if (tab->label->min_width > tab_accum_x)
tab_accum_x = tab->label->min_width;
break;
}
}
}
if (tab->page)
{
if (tab->page->min_height > page_biggest_y)
page_biggest_y = tab->page->min_height;
if (tab->page->min_width > page_biggest_x)
page_biggest_x = tab->page->min_width;
}
}
switch (notebook->tab_pos)
{
case CTK_POS_TOP:
case CTK_POS_BOTTOM:
widget->min_height = page_biggest_y + tab_accum_y +
CTK_CONTAINER(widget)->border_width * 2;
widget->min_width = ctk_helper_max(
page_biggest_x + CTK_CONTAINER(widget)->border_width*2,
tab_accum_x);
break;
case CTK_POS_LEFT:
case CTK_POS_RIGHT:
widget->min_width = page_biggest_x + tab_accum_x +
CTK_CONTAINER(widget)->border_width * 2;
widget->min_height = ctk_helper_max(
page_biggest_y + CTK_CONTAINER(widget)->border_width*2,
tab_accum_y);
break;
}
notebook->tab_width = tab_accum_x;
notebook->tab_height = tab_accum_y;
}
/* Assumption: min_size was already called to set the tab_width & height */
void ctk_notebook_real_size(CtkWidget* widget)
{
GSList* tab_list;
CtkContainer* container;
CtkNotebook* notebook;
CtkNotebookTab* tab;
CtkWidget* child;
gint tab_accum_x = 0;
gint tab_accum_y = 0;
container = CTK_CONTAINER(widget);
notebook = CTK_NOTEBOOK(widget);
notebook->tab_row = widget->row;
notebook->tab_col = widget->col;
notebook->page_col = widget->col + container->border_width;
notebook->page_row = widget->row + container->border_width;
notebook->page_width = widget->width - container->border_width * 2;
notebook->page_height = widget->height - container->border_width * 2;
switch (notebook->tab_pos)
{
case CTK_POS_TOP:
notebook->page_height -= notebook->tab_height;
notebook->page_row += notebook->tab_height;
break;
case CTK_POS_BOTTOM:
notebook->page_height -= notebook->tab_height;
notebook->tab_row = widget->row + widget->height - notebook->tab_height;
break;
case CTK_POS_LEFT:
notebook->page_width -= notebook->tab_width;
notebook->page_col += notebook->tab_width;
break;
case CTK_POS_RIGHT:
notebook->page_width -= notebook->tab_width;
notebook->tab_col = widget->col + widget->width - notebook->tab_width;
break;
}
for (tab_list = notebook->tab_labels; tab_list; tab_list = tab_list->next)
{
tab = (CtkNotebookTab*)tab_list->data;
if (tab->label)
{
child = CTK_WIDGET(tab->label);
if (notebook->show_tabs && tab->label->show)
{
switch (notebook->tab_pos)
{
case CTK_POS_TOP:
case CTK_POS_BOTTOM:
child->row = notebook->tab_row;
child->col = notebook->tab_col + tab_accum_x;
child->width = child->min_width;
child->height = notebook->tab_height;
tab_accum_x += tab->label->width + 3;
break;
case CTK_POS_LEFT:
case CTK_POS_RIGHT:
child->row = notebook->tab_row + tab_accum_y;
child->col = notebook->tab_col;
child->width = notebook->tab_width;
child->height = child->min_height;
tab_accum_y += tab->label->height + 1;
break;
}
}
else
{
child->width = 0;
child->height = 0;
}
}
if (tab->page)
{
child = CTK_WIDGET(tab->page);
if (tab->selected)
{
child->col = notebook->page_col;
child->row = notebook->page_row;
child->width = notebook->page_width;
child->height = notebook->page_height;
}
else
{
child->width = 0;
child->height = 0;
}
}
}
}
/* CTK Notebook Initializer */
void ctk_notebook_init(CtkNotebook* notebook)
{
CtkContainer* container;
ctk_container_init(¬ebook->container);
((CtkObject *)notebook)->type = CtkTypeNotebook;
container = CTK_CONTAINER(notebook);
container->set_child_flags = &ctk_notebook_set_default_child_flags;
container->lost_child = &ctk_notebook_lost_child;
container->border_width = 1;
notebook->tab_labels = NULL;
notebook->tab_pos = CTK_POS_TOP;
notebook->show_tabs = TRUE;
ctk_signal_new("switch_page",CtkTypeNotebook);
/* Initialize Other Variables */
((CtkWidget *)notebook)->width = 2;
((CtkWidget *)notebook)->height = 2;
((CtkWidget *)notebook)->orig_width = 2;
((CtkWidget *)notebook)->orig_height = 2;
CTK_WIDGET(notebook)->sensitive = TRUE;
/* Also setup Colors */
((CtkWidget *)notebook)->main_col =
ctk_calculate_palette(CTK_COLOR_BLACK,CTK_COLOR_LIGHT_GRAY);
((CtkWidget *)notebook)->title_col =
ctk_calculate_palette(CTK_COLOR_BLACK,CTK_COLOR_LIGHT_GRAY);
((CtkWidget *)notebook)->selected_col =
ctk_calculate_palette(CTK_COLOR_LIGHT_GRAY,CTK_COLOR_BLUE);
((CtkWidget *)notebook)->inverse_col =
ctk_calculate_palette(CTK_COLOR_WHITE,CTK_COLOR_RED);
((CtkObject *)notebook)->destroy_func = ctk_notebook_destroy;
CTK_WIDGET(notebook)->set_min_size = &ctk_notebook_min_size;
CTK_WIDGET(notebook)->set_real_size = &ctk_notebook_real_size;
ctk_signal_connect(CTK_OBJECT(notebook), "focus_in_event",
CTK_SIGNAL_FUNC(&ctk_notebook_focus_in), NULL);
ctk_signal_connect(CTK_OBJECT(notebook), "focus_out_event",
CTK_SIGNAL_FUNC(&ctk_notebook_focus_out), NULL);
ctk_signal_connect(CTK_OBJECT(notebook), "button_press_event",
CTK_SIGNAL_FUNC(&ctk_notebook_button_press), NULL);
ctk_signal_connect(CTK_OBJECT(notebook), "key_press_event",
CTK_SIGNAL_FUNC(&ctk_notebook_key_press), NULL);
}
void ctk_notebook_set_default_child_flags_noop(CtkContainer* container, CtkWidget* child)
{
// noop
}
void ctk_notebook_set_default_child_flags(CtkContainer* container, CtkWidget* child)
{
CtkWidget* self = CTK_WIDGET(container);
CtkNotebook* notebook = CTK_NOTEBOOK(container);
CtkNotebookTab* tab;
child->xexpand = TRUE;
child->yexpand = TRUE;
child->xfill = TRUE;
child->yfill = TRUE;
tab = g_malloc(sizeof(CtkNotebookTab));
tab->page = child;
tab->label = NULL;
if (!self->node || !self->node->children)
{
tab->selected = TRUE;
}
else
{
tab->selected = FALSE;
}
notebook->tab_labels = g_slist_append(notebook->tab_labels, tab);
}
void ctk_notebook_lost_child(CtkContainer* container, CtkWidget* widget)
{
CtkNotebook* notebook;
CtkNotebookTab* tab;
GSList* tab_list;
gint i;
gint kill_page;
notebook = CTK_NOTEBOOK(container);
kill_page = -1;
i = 0;
for (tab_list = notebook->tab_labels; tab_list; tab_list = tab_list->next)
{
tab = (CtkNotebookTab *)tab_list->data;
if (tab->page == widget)
{
tab->page = NULL;
kill_page = i;
}
if (tab->label == widget)
{
tab->label = NULL;
}
i++;
}
if (kill_page != -1)
{
ctk_notebook_remove_page(notebook, kill_page);
}
}
/* CTK Notebook New - Constructor */
CtkWidget* ctk_notebook_new(void)
{
CtkNotebook *notebook;
/* Init CtkBin */
notebook = g_malloc(sizeof(CtkNotebook));
ctk_notebook_init(notebook);
return((CtkWidget *)notebook);
}
/* Get Notebook Page Number */
gint ctk_notebook_page_num(CtkNotebook* notebook, CtkWidget* child)
{
CtkNotebookTab* tab;
GSList* tab_list;
gint page_num;
if (!notebook || !notebook->tab_labels)
return 0;
page_num = 0;
for (tab_list = notebook->tab_labels; tab_list; tab_list = tab_list->next)
{
tab = (CtkNotebookTab *)tab_list->data;
if (tab->page == child)
break;
page_num++;
}
return page_num;
}
CtkWidget* ctk_notebook_get_nth_page(CtkNotebook* notebook, gint page_num)
{
CtkNotebookTab* tab;
GSList* tab_list;
if (!notebook || !notebook->tab_labels)
return NULL;
for (tab_list = notebook->tab_labels; tab_list; tab_list = tab_list->next)
{
tab = (CtkNotebookTab *)tab_list->data;
if (page_num == 0)
return tab->page;
page_num--;
}
return NULL;
}
/* Set the page label */
void ctk_notebook_set_tab_label(CtkNotebook* notebook,
CtkWidget* child,
CtkWidget* tab_label)
{
GSList *tab_list;
CtkNotebookTab *tab;
if (!notebook || !child || !notebook->tab_labels)
return;
for (tab_list = notebook->tab_labels; tab_list; tab_list = tab_list->next)
{
tab = (CtkNotebookTab *)tab_list->data;
if (tab->page == child)
{
if (tab->label)
{
ctk_container_remove(CTK_CONTAINER(notebook), tab->label);
}
tab->label = tab_label;
CTK_CONTAINER(notebook)->set_child_flags =
&ctk_notebook_set_default_child_flags_noop;
ctk_container_add(CTK_CONTAINER(notebook), tab->label);
CTK_CONTAINER(notebook)->set_child_flags =
&ctk_notebook_set_default_child_flags;
tab->label->selected = tab->selected;
}
}
ctk_size_mark_changed(CTK_WIDGET(notebook));
}
/* Set the page */
void ctk_notebook_set_page(CtkNotebook* notebook, gint page_num)
{
GSList* tab_list;
CtkNotebookTab* tab;
gint i;
CtkNotebookTab* cur_sel;
CtkNotebookTab* new_sel;
CtkWindow* window;
CtkWidget* widget;
if (!notebook || !notebook->tab_labels)
return;
i = 0;
widget = CTK_WIDGET(notebook);
window = ctk_window_container(widget);
if (window && window == ctk_window_get_focus_window() &&
window->focus_widget == widget)
{
ctk_notebook_focus_out(CTK_WIDGET(notebook), NULL, NULL);
}
cur_sel = NULL;
new_sel = NULL;
for (tab_list = notebook->tab_labels; tab_list; tab_list = tab_list->next)
{
tab = (CtkNotebookTab *)tab_list->data;
if (i == page_num)
new_sel = tab;
else if (tab->selected)
cur_sel = tab;
i++;
}
if (new_sel)
{
if (cur_sel)
{
cur_sel->selected = FALSE;
if (cur_sel->label)
cur_sel->label->selected = FALSE;
}
new_sel->selected = TRUE;
if (new_sel->label)
new_sel->label->selected = TRUE;
ctk_signal_emit_by_name(CTK_OBJECT(notebook),"switch_page");
ctk_draw_mark_changed(CTK_WIDGET(notebook));
}
if (window && window == ctk_window_get_focus_window() &&
window->focus_widget == widget)
{
ctk_notebook_focus_in(CTK_WIDGET(notebook), NULL, NULL);
}
}
/* Get Label from x y coord's */
CtkNotebookTab* ctk_notebook_get_yx_label(CtkNotebook* notebook, gint y, gint x)
{
CtkNotebookTab* tab;
GSList* tab_list;
CtkWidget* widget;
gint cur_col;
gint cur_row;
if (!notebook || !notebook->tab_labels)
return NULL;
widget = CTK_WIDGET(notebook);
cur_col = widget->col;
cur_row = widget->row;
for (tab_list = notebook->tab_labels; tab_list; tab_list = tab_list->next)
{
tab = (CtkNotebookTab*)tab_list->data;
/* Did the user click on this label? */
if (tab->label && ctk_check_clipping_xy(tab->label, x, y))
break;
}
if (!tab_list)
tab = NULL;
return tab;
}
/* Next Page - Switch to next page. Does nothing if current page is the
* last page */
void ctk_notebook_next_page(CtkNotebook* notebook)
{
CtkNotebookTab* tab;
GSList* tab_list;
if (!notebook || !notebook->tab_labels)
return;
for (tab_list = notebook->tab_labels; tab_list; tab_list = tab_list->next)
{
tab = (CtkNotebookTab*)tab_list->data;
if (tab->selected)
{
if (!tab_list->next)
break;
tab = (CtkNotebookTab*)tab_list->next->data;
ctk_notebook_set_page(notebook,
ctk_notebook_page_num(notebook, tab->page));
break;
}
}
}
/* Previous Page - Switch to previous page. Does nothing if current page is the
* first page */
void ctk_notebook_prev_page(CtkNotebook* notebook)
{
CtkNotebookTab* tab;
CtkNotebookTab* tab_next;
GSList* tab_list;
if (!notebook || !notebook->tab_labels)
return;
for (tab_list = notebook->tab_labels; tab_list; tab_list = tab_list->next)
{
tab = (CtkNotebookTab *)tab_list->data;
if (tab_list->next)
tab_next = (CtkNotebookTab *)tab_list->next->data;
else
tab_next = NULL;
if (tab_next && tab_next->selected)
{
ctk_notebook_set_page(notebook,
ctk_notebook_page_num(notebook, tab->page));
break;
}
}
}
/* Button key handle events */
gboolean ctk_notebook_key_press(CtkWidget* widget, CdkEventKey* event, gpointer data)
{
if ((event->keyval == AK_ARROW_RIGHT) || (event->keyval == AK_ARROW_DOWN))
ctk_notebook_next_page(CTK_NOTEBOOK(widget));
else if ((event->keyval == AK_ARROW_LEFT) || (event->keyval==AK_ARROW_UP))
ctk_notebook_prev_page(CTK_NOTEBOOK(widget));
return TRUE;
}
/* Button mouse handle events */
gboolean ctk_notebook_button_press(CtkWidget* widget, CdkEventButton* event, gpointer data)
{
CtkNotebookTab* tab;
tab = ctk_notebook_get_yx_label(CTK_NOTEBOOK(widget), event->y, event->x);
if (tab)
{
ctk_notebook_set_page(CTK_NOTEBOOK(widget),
ctk_notebook_page_num(CTK_NOTEBOOK(widget),tab->page));
}
return TRUE;
}
/* Set Tab Position */
void ctk_notebook_set_tab_pos(CtkNotebook* notebook, CtkPositionType pos)
{
notebook->tab_pos = pos;
ctk_size_mark_changed(CTK_WIDGET(notebook));
}
/* Append a Page */
void ctk_notebook_append_page(CtkNotebook* notebook,
CtkWidget* child,
CtkWidget* tab_label)
{
if (!notebook || !child || !tab_label)
return;
ctk_container_add(CTK_CONTAINER(notebook), child);
ctk_notebook_set_tab_label(notebook, child, tab_label);
}
/* Prepend a Page
* Not yet implemented so just appending it for now */
void ctk_notebook_prepend_page(CtkNotebook* notebook,
CtkWidget* child,
CtkWidget* tab_label)
{
ctk_notebook_append_page(notebook,child,tab_label);
}
/* Insert a Page
* Note yet implemented so just appending it for now */
void ctk_notebook_insert_page(CtkNotebook* notebook,
CtkWidget* child,
CtkWidget* tab_label,
gint position)
{
ctk_notebook_append_page(notebook,child,tab_label);
}
/* Remove a Page */
void ctk_notebook_remove_page(CtkNotebook* notebook, gint page_num)
{
GSList* tab_list;
CtkNotebookTab* tab_item;
gint i;
if (!notebook)
return;
i = 0;
for (tab_list = notebook->tab_labels; tab_list; tab_list = tab_list->next)
{
if (i == page_num) break;
i++;
}
if (!tab_list)
return;
tab_item = (CtkNotebookTab*)tab_list->data;
if (tab_item->selected)
{
if (tab_list->next)
{
ctk_notebook_next_page(notebook);
}
else
{
ctk_notebook_prev_page(notebook);
}
}
notebook->tab_labels = g_slist_remove_link(notebook->tab_labels, tab_list);
g_slist_free_1(tab_list);
if (tab_item->label) ctk_widget_destroy(tab_item->label);
if (tab_item->page) ctk_widget_destroy(tab_item->page);
ctk_size_mark_changed(CTK_WIDGET(notebook));
}
/* Set Show Tabs */
void ctk_notebook_set_show_tabs(CtkNotebook* notebook, gboolean show_tabs)
{
if (!notebook)
return;
notebook->show_tabs = show_tabs;
ctk_size_mark_changed(CTK_WIDGET(notebook));
}
/* Set Show Border */
void ctk_notebook_set_show_border(CtkNotebook* notebook, gboolean show_border)
{
if (!notebook)
return;
if (show_border)
CTK_CONTAINER(notebook)->border_width = 1;
else
CTK_CONTAINER(notebook)->border_width = 0;
ctk_size_mark_changed(CTK_WIDGET(notebook));
}
/* Set Tabs Scrollable */
void ctk_notebook_set_scrollable(CtkNotebook* notebook, gboolean scrollable)
{
if (!notebook)
return;
// Not implemented:
// notebook->tabs_scrollable = scrollable;
// ctk_size_mark_changed(CTK_WIDGET(notebook));
}
/* Destroy notebook data */
gpointer ctk_notebook_destroy(CtkObject* object)
{
GSList* list;
CtkNotebook* notebook;
notebook = CTK_NOTEBOOK(object);
for (list = notebook->tab_labels; list; list = list->next)
g_free(list->data);
if (notebook->tab_labels)
g_slist_free(notebook->tab_labels);
return NULL;
}
gboolean ctk_notebook_focus_in(CtkWidget* widget, CdkEventFocus* event, gpointer data)
{
CtkNotebook* notebook;
CtkNotebookTab* tab;
GSList* tab_list;
notebook = CTK_NOTEBOOK(widget);
if (!notebook || !notebook->tab_labels)
return FALSE;
for (tab_list = notebook->tab_labels; tab_list; tab_list = tab_list->next)
{
tab = (CtkNotebookTab *)tab_list->data;
if (tab->selected)
tab->label->inversed = TRUE;
}
ctk_draw_mark_changed(CTK_WIDGET(notebook));
return TRUE;
}
gboolean ctk_notebook_focus_out(CtkWidget* widget, CdkEventFocus* event, gpointer data)
{
CtkNotebook* notebook;
CtkNotebookTab* tab;
GSList* tab_list;
notebook = CTK_NOTEBOOK(widget);
if (!notebook || !notebook->tab_labels)
return FALSE;
for (tab_list = notebook->tab_labels; tab_list; tab_list = tab_list->next)
{
tab = (CtkNotebookTab *)tab_list->data;
if (tab->selected)
tab->label->inversed = FALSE;
}
ctk_draw_mark_changed(CTK_WIDGET(notebook));
return TRUE;
}
|