UITabContainer.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #include <TurboBadger/tb_widgets.h>
  2. #include <TurboBadger/tb_widgets_common.h>
  3. #include <TurboBadger/tb_tab_container.h>
  4. #include "UI.h"
  5. #include "UIEvents.h"
  6. #include "UITabContainer.h"
  7. using namespace tb;
  8. namespace Atomic
  9. {
  10. UITabContainer::UITabContainer(Context* context, bool createWidget) : UIWidget(context, false)
  11. {
  12. if (createWidget)
  13. {
  14. widget_ = new TBTabContainer();
  15. widget_->SetDelegate(this);
  16. GetSubsystem<UI>()->WrapWidget(this, widget_);
  17. }
  18. }
  19. UITabContainer::~UITabContainer()
  20. {
  21. }
  22. UIWidget* UITabContainer::GetCurrentPageWidget()
  23. {
  24. if (!widget_)
  25. return 0;
  26. TBWidget* w = ((TBTabContainer*)widget_)->GetCurrentPageWidget();
  27. return GetSubsystem<UI>()->WrapWidget(w);
  28. }
  29. int UITabContainer::GetNumPages()
  30. {
  31. if (!widget_)
  32. return 0;
  33. return ((TBTabContainer*)widget_)->GetNumPages();
  34. }
  35. void UITabContainer::SetCurrentPage(int page)
  36. {
  37. if (!widget_)
  38. return;
  39. ((TBTabContainer*)widget_)->SetCurrentPage(page);
  40. }
  41. bool UITabContainer::OnEvent(const tb::TBWidgetEvent &ev)
  42. {
  43. return false;
  44. }
  45. }