330 |
330 |
331 return sw; |
331 return sw; |
332 } |
332 } |
333 |
333 |
334 |
334 |
335 void ui_select_tab(UIWIDGET tabview, int tab) { |
|
336 gtk_notebook_set_current_page(GTK_NOTEBOOK(tabview), tab); |
|
337 } |
|
338 |
|
339 void ui_notebook_tab_select(UIWIDGET tabview, int tab) { |
335 void ui_notebook_tab_select(UIWIDGET tabview, int tab) { |
340 gtk_notebook_set_current_page(GTK_NOTEBOOK(tabview), tab); |
336 gtk_notebook_set_current_page(GTK_NOTEBOOK(tabview), tab); |
341 } |
337 } |
342 |
338 |
343 void ui_notebook_tab_remove(UIWIDGET tabview, int tab) { |
339 void ui_notebook_tab_remove(UIWIDGET tabview, int tab) { |
362 GtkNotebook *nb = i->obj; |
358 GtkNotebook *nb = i->obj; |
363 gtk_notebook_set_current_page(nb, value); |
359 gtk_notebook_set_current_page(nb, value); |
364 i->value = gtk_notebook_get_current_page(nb); |
360 i->value = gtk_notebook_get_current_page(nb); |
365 } |
361 } |
366 |
362 |
|
363 |
|
364 void ui_stack_tab_select(UIWIDGET tabview, int tab) { |
|
365 |
|
366 } |
|
367 |
|
368 void ui_stack_tab_remove(UIWIDGET tabview, int tab) { |
|
369 |
|
370 } |
|
371 |
|
372 void ui_stack_tab_add(UIWIDGET widget, int index, const char *name, UIWIDGET child) { |
|
373 GtkStackPage *page = gtk_stack_add_titled(GTK_STACK(widget), child, name, name); |
|
374 } |
|
375 |
|
376 int64_t ui_stack_get(UiInteger *i) { |
|
377 |
|
378 } |
|
379 |
|
380 void ui_stack_set(UiInteger *i, int64_t value) { |
|
381 |
|
382 } |
|
383 |
|
384 |
367 UiGtkTabView* ui_widget_get_tabview_data(UIWIDGET tabview) { |
385 UiGtkTabView* ui_widget_get_tabview_data(UIWIDGET tabview) { |
368 return g_object_get_data(G_OBJECT(tabview), "ui_tabview"); |
386 return g_object_get_data(G_OBJECT(tabview), "ui_tabview"); |
369 } |
387 } |
370 |
388 |
371 typedef int64_t(*ui_tabview_get_func)(UiInteger*); |
389 typedef int64_t(*ui_tabview_get_func)(UiInteger*); |
380 |
398 |
381 ui_tabview_get_func getfunc = NULL; |
399 ui_tabview_get_func getfunc = NULL; |
382 ui_tabview_set_func setfunc = NULL; |
400 ui_tabview_set_func setfunc = NULL; |
383 |
401 |
384 GtkWidget *widget = NULL; |
402 GtkWidget *widget = NULL; |
|
403 GtkWidget *data_widget = NULL; |
385 switch(args.tabview) { |
404 switch(args.tabview) { |
386 case UI_TABVIEW_DOC: { |
405 case UI_TABVIEW_DOC: { |
387 // TODO |
406 // TODO |
388 break; |
407 break; |
389 } |
408 } |
390 case UI_TABVIEW_NAVIGATION_SIDE: { |
409 case UI_TABVIEW_NAVIGATION_SIDE: { |
|
410 #if GTK_CHECK_VERSION(3, 10, 0) |
|
411 widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); |
|
412 GtkWidget *sidebar = gtk_stack_sidebar_new(); |
|
413 BOX_ADD(widget, sidebar); |
|
414 GtkWidget *stack = gtk_stack_new(); |
|
415 gtk_stack_set_transition_type (GTK_STACK(stack), GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN); |
|
416 gtk_stack_sidebar_set_stack(GTK_STACK_SIDEBAR(sidebar), GTK_STACK(stack)); |
|
417 BOX_ADD_EXPAND(widget, stack); |
|
418 data->select_tab = ui_stack_tab_select; |
|
419 data->remove_tab = ui_stack_tab_remove; |
|
420 data->add_tab = ui_stack_tab_add; |
|
421 getfunc = ui_stack_get; |
|
422 setfunc = ui_stack_set; |
|
423 data_widget = stack; |
|
424 #else |
391 // TODO |
425 // TODO |
|
426 #endif |
392 break; |
427 break; |
393 } |
428 } |
394 case UI_TABVIEW_DEFAULT: /* fall through */ |
429 case UI_TABVIEW_DEFAULT: /* fall through */ |
395 case UI_TABVIEW_NAVIGATION_TOP: /* fall through */ |
430 case UI_TABVIEW_NAVIGATION_TOP: /* fall through */ |
396 case UI_TABVIEW_NAVIGATION_TOP2: { |
431 case UI_TABVIEW_NAVIGATION_TOP2: { |
397 widget = gtk_notebook_new(); |
432 widget = gtk_notebook_new(); |
|
433 data_widget = widget; |
398 data->select_tab = ui_notebook_tab_select; |
434 data->select_tab = ui_notebook_tab_select; |
399 data->remove_tab = ui_notebook_tab_remove; |
435 data->remove_tab = ui_notebook_tab_remove; |
400 data->add_tab = ui_notebook_tab_add; |
436 data->add_tab = ui_notebook_tab_add; |
401 getfunc = ui_notebook_get; |
437 getfunc = ui_notebook_get; |
402 setfunc = ui_notebook_set; |
438 setfunc = ui_notebook_set; |
417 i->set = setfunc; |
453 i->set = setfunc; |
418 i->obj = widget; |
454 i->obj = widget; |
419 } |
455 } |
420 |
456 |
421 g_object_set_data(G_OBJECT(widget), "ui_tabview", data); |
457 g_object_set_data(G_OBJECT(widget), "ui_tabview", data); |
422 data->widget = widget; |
458 data->widget = data_widget; |
423 data->subcontainer = args.subcontainer; |
459 data->subcontainer = args.subcontainer; |
424 |
460 |
425 UI_APPLY_LAYOUT1(current, args); |
461 UI_APPLY_LAYOUT1(current, args); |
426 current->container->add(current->container, widget, TRUE); |
462 current->container->add(current->container, widget, TRUE); |
427 |
463 |