Browse Source

remove possible scrollbars from menus

JimMarlowe 9 years ago
parent
commit
b54eb2d685
2 changed files with 20 additions and 0 deletions
  1. 17 0
      Source/Atomic/UI/UIMenuWindow.cpp
  2. 3 0
      Source/Atomic/UI/UIMenuWindow.h

+ 17 - 0
Source/Atomic/UI/UIMenuWindow.cpp

@@ -57,6 +57,8 @@ void UIMenuWindow::Show(UISelectItemSource* source, int x, int y)
 
     source_ = source->GetTBItemSource();
 
+    FixMenu( (TBMenuWindow*)widget_ );  // get rid of scrollbars for menu popups
+
     if (x != -1 && y != -1)
     {
         ((TBMenuWindow*)widget_)->Show(source_, TBPopupAlignment(TBPoint(x, y)));
@@ -83,4 +85,19 @@ void UIMenuWindow::Close()
 
 }
 
+void UIMenuWindow::FixMenu( tb::TBMenuWindow *mymenu ) // get rid of scrollbars for menu popups
+{
+    if ( mymenu )
+    {
+        TBScrollContainer *mys = mymenu->GetList()->GetScrollContainer();  // this is the magic.
+        if ( mys->GetScrollMode() != SCROLL_MODE_OFF )
+        {
+            mys->SetScrollMode(SCROLL_MODE_OFF);
+            mys->SetAdaptContentSize(false);
+            mys->SetAdaptToContentSize(true);
+        }
+    }
+}
+
+
 }

+ 3 - 0
Source/Atomic/UI/UIMenuWindow.h

@@ -23,6 +23,7 @@
 #pragma once
 
 #include <TurboBadger/tb_select_item.h>
+#include <TurboBadger/tb_menu_window.h>
 #include "UIWidget.h"
 
 namespace Atomic
@@ -50,6 +51,8 @@ protected:
 private:
 
     tb::TBSelectItemSource* source_;
+    
+    void FixMenu( tb::TBMenuWindow* ); // get rid of scrollbars for menu popups
 
 };