Browse Source

change return strings

JimMarlowe 8 years ago
parent
commit
e925918e6e
2 changed files with 7 additions and 15 deletions
  1. 5 11
      Source/Atomic/UI/UISelectList.cpp
  2. 2 4
      Source/Atomic/UI/UISelectList.h

+ 5 - 11
Source/Atomic/UI/UISelectList.cpp

@@ -35,7 +35,7 @@ using namespace tb;
 namespace Atomic
 namespace Atomic
 {
 {
 
 
-UISelectList::UISelectList(Context* context, bool createWidget) : UIWidget(context, false), transferStr()
+UISelectList::UISelectList(Context* context, bool createWidget) : UIWidget(context, false)
 {
 {
     if (createWidget)
     if (createWidget)
     {
     {
@@ -124,7 +124,7 @@ String UISelectList::GetSelectedItemID()
 }
 }
 
 
 /// Returns the string of the selected item from the list widget
 /// Returns the string of the selected item from the list widget
-const String& UISelectList::GetSelectedItemString()
+String UISelectList::GetSelectedItemString()
 {
 {
     int selected = ((TBSelectList*)widget_)->GetValue();
     int selected = ((TBSelectList*)widget_)->GetValue();
     TBSelectItemSource *tbsource = (TBSelectItemSource*)((TBSelectList*)widget_)->GetSource();
     TBSelectItemSource *tbsource = (TBSelectItemSource*)((TBSelectList*)widget_)->GetSource();
@@ -132,10 +132,7 @@ const String& UISelectList::GetSelectedItemString()
     {
     {
         const char *strx = tbsource->GetItemString(selected);
         const char *strx = tbsource->GetItemString(selected);
         if (strx )
         if (strx )
-        {
-            transferStr = (String)strx;
-            return (transferStr);
-        }
+            return ( tbsource->GetItemString(selected) );
     }
     }
     return String::EMPTY;
     return String::EMPTY;
 }
 }
@@ -164,17 +161,14 @@ String UISelectList::GetItemID(int index)
 }
 }
 
 
 /// Returns the string of item at the requested index from the list widget
 /// Returns the string of item at the requested index from the list widget
-const String& UISelectList::GetItemString(int index)
+String UISelectList::GetItemString(int index)
 {
 {
     TBSelectItemSource *tbsource = (TBSelectItemSource*)((TBSelectList*)widget_)->GetSource();
     TBSelectItemSource *tbsource = (TBSelectItemSource*)((TBSelectList*)widget_)->GetSource();
     if ( tbsource && index >= 0 && index < tbsource->GetNumItems() )
     if ( tbsource && index >= 0 && index < tbsource->GetNumItems() )
     {
     {
         const char *strx = tbsource->GetItemString(index);
         const char *strx = tbsource->GetItemString(index);
         if (strx != NULL)
         if (strx != NULL)
-        {
-            transferStr = (String)strx;
-            return (transferStr);
-        }
+            return ( tbsource->GetItemString(index) );
     }
     }
     return String::EMPTY;
     return String::EMPTY;
 }
 }

+ 2 - 4
Source/Atomic/UI/UISelectList.h

@@ -71,9 +71,9 @@ public:
     void SetUIListView(bool value);
     void SetUIListView(bool value);
 
 
     /// Returns the string of item at the requested index
     /// Returns the string of item at the requested index
-    const String& GetItemString(int index);
+    String GetItemString(int index);
     /// Returns the string of the selected item
     /// Returns the string of the selected item
-    const String& GetSelectedItemString();
+    String GetSelectedItemString();
 
 
 protected:
 protected:
 
 
@@ -83,8 +83,6 @@ protected:
 
 
 private:
 private:
 
 
-    String transferStr;
-
 };
 };