518 |
518 |
519 FrameworkElement UiMainTabView::GetFrameworkElement() { |
519 FrameworkElement UiMainTabView::GetFrameworkElement() { |
520 return tabview; |
520 return tabview; |
521 } |
521 } |
522 |
522 |
523 static UiTabView* tabview_doc_create(UiObject* obj, UiTabViewArgs args) { |
523 static UiTabView* tabview_main_create(UiObject* obj, UiTabViewArgs args) { |
524 TabView tabview = TabView(); |
524 TabView tabview = TabView(); |
525 tabview.IsAddTabButtonVisible(false); |
525 tabview.IsAddTabButtonVisible(false); |
526 tabview.CanDragTabs(false); |
526 tabview.CanDragTabs(false); |
527 tabview.CanReorderTabs(false); |
527 tabview.CanReorderTabs(false); |
528 UiMainTabView* uitabview = new UiMainTabView(obj, tabview, args); |
528 UiMainTabView* uitabview = new UiMainTabView(obj, tabview, args); |
529 |
529 |
530 return uitabview; |
530 return uitabview; |
531 } |
531 } |
532 |
532 |
|
533 UiNavigationTabView::UiNavigationTabView(UiObject* obj, NavigationView NavigationView, UiTabViewArgs args, enum UiNavigationViewType type) { |
|
534 this->current = obj; |
|
535 this->navigationview = navigationview; |
|
536 this->type = type; |
|
537 this->margin = args.margin; |
|
538 this->spacing = args.spacing; |
|
539 this->columnspacing = args.columnspacing; |
|
540 this->rowspacing = args.rowspacing; |
|
541 } |
|
542 |
|
543 UiObject* UiNavigationTabView::AddTab(const char* label) { |
|
544 TextBlock text = TextBlock(); |
|
545 wchar_t* wlabel = str2wstr(label, nullptr); |
|
546 winrt::hstring hstr(wlabel); |
|
547 text.Text(hstr); |
|
548 free(wlabel); |
|
549 |
|
550 NavigationViewItem item = NavigationViewItem(); |
|
551 item.Content(text); |
|
552 |
|
553 // sub container |
|
554 Grid subcontainer = Grid(); |
|
555 //item.Content(subcontainer); |
|
556 navigationview.MenuItems().Append(item); |
|
557 |
|
558 Button b1 = Button(); |
|
559 b1.Content(box_value(L"Test")); |
|
560 navigationview.Content(b1); |
|
561 |
|
562 return create_subcontainer_obj(current, subcontainer, this->subcontainer, margin, spacing, columnspacing, rowspacing); |
|
563 } |
|
564 |
|
565 FrameworkElement UiNavigationTabView::GetFrameworkElement() { |
|
566 return navigationview; |
|
567 } |
|
568 |
|
569 static UiTabView* tabview_navigationview_create(UiObject* obj, UiTabViewArgs args) { |
|
570 NavigationView navigationview = NavigationView(); |
|
571 UiNavigationTabView* tabview = new UiNavigationTabView(obj, navigationview, args, UI_NAVIGATIONVIEW_SIDE); |
|
572 |
|
573 return tabview; |
|
574 } |
|
575 |
533 UIWIDGET ui_tabview_create(UiObject* obj, UiTabViewArgs args) { |
576 UIWIDGET ui_tabview_create(UiObject* obj, UiTabViewArgs args) { |
534 UiTabViewType type = args.tabview == UI_TABVIEW_DEFAULT ? UI_TABVIEW_NAVIGATION_TOP2 : args.tabview; |
577 UiTabViewType type = args.tabview == UI_TABVIEW_DEFAULT ? UI_TABVIEW_NAVIGATION_TOP2 : args.tabview; |
535 UiTabView *tabview = tabview_doc_create(obj, args); |
578 UiTabView *tabview = tabview_navigationview_create(obj, args); |
536 UiTabViewContainer* ctn = new UiTabViewContainer(tabview); |
579 UiTabViewContainer* ctn = new UiTabViewContainer(tabview); |
537 |
580 |
538 // add frame to the parent container |
581 // add frame to the parent container |
539 UiObject* current = uic_current_obj(obj); |
582 UiObject* current = uic_current_obj(obj); |
540 UI_APPLY_LAYOUT1(current, args); |
583 UI_APPLY_LAYOUT1(current, args); |