Browse Source

Editor Work

Josh Engebretson 10 years ago
parent
commit
359d55e02f

+ 15 - 0
Data/AtomicEditor/Resources/EditorData/AtomicEditor/javascript/ui/hierarchyframe.js

@@ -0,0 +1,15 @@
+var UI = Atomic.UI;
+var UIWidget = Atomic.UIWidget;
+
+var mainframe = require("./mainframe").mainframe;
+
+var hierarchyframe = exports.hierarchyframe = new UIWidget();
+
+hierarchyframe.gravity = UI.GRAVITY_TOP_BOTTOM;
+
+// load the UI
+hierarchyframe.load("AtomicEditor/editor/ui/hierarchyframe.tb.txt");
+
+// snap the frame into place
+var hierarchycontainer = mainframe.getWidget("hierarchycontainer");
+hierarchycontainer.addChild(hierarchyframe);

+ 81 - 97
Data/AtomicEditor/Resources/EditorData/AtomicEditor/javascript/ui/mainframe.js

@@ -1,29 +1,29 @@
 var graphics = Atomic.getGraphics();
-
 var UI = Atomic.UI;
 var UIWidget = Atomic.UIWidget;
 var UIMenuWindow = Atomic.UIMenuWindow;
-
 var editorStrings = require("./editorStrings");
 var utils = require("./utils");
+var ui = require("./ui");
 
-var view = new Atomic.UIView();
+// Create the main frame
+var mainframe = exports.mainframe = new UIWidget();
 
-var mainframe = new UIWidget();
+ui.view.addChild(mainframe);
 
+// Set it to be the size of the entire window
 mainframe.setSize(graphics.width, graphics.height);
 
+// load the UI
 mainframe.load("AtomicEditor/editor/ui/mainframe.tb.txt");
 
-// Subscribe to graphics subsystems screen mode switching
+// Subscribe to graphics subsystems screen mode switching, so we can adjust the widget size
 mainframe.subscribeToEvent(graphics, "ScreenMode", function(data) {
 
   mainframe.setSize(data.width, data.height);
 
 });
 
-var srcLookup = {};
-
 mainframe.handleMenuAtomicEditor = function(data) {
 
   var target = data.target;
@@ -47,11 +47,7 @@ mainframe.handleMenuBarEvent = function(data) {
 
   if (data.type == UI.EVENT_TYPE_CLICK) {
 
-    if (mainframe.handleMenuAtomicEditor(data)) {
-
-      return true;
-
-    }
+    if (mainframe.handleMenuAtomicEditor(data)) return true;
 
     var target = data.target;
 
@@ -62,104 +58,92 @@ mainframe.handleMenuBarEvent = function(data) {
       var menu = new UIMenuWindow(target, target.id + " popup");
       menu.show(src);
       return true;
+
     }
 
   }
 
   return false;
 
-
 }
 
 mainframe.subscribeToEvent(mainframe, "WidgetEvent", function(data) {
 
-  if (mainframe.handleMenuBarEvent(data)) {
-
-    return true;
-
-  }
+  if (mainframe.handleMenuBarEvent(data)) return true;
 
   return false;
 
 });
 
-initializeMenuSources();
-
-function initializeMenuSources() {
-
-  var editorItems = {
-    "About Atomic Editor": "about atomic editor",
-    "-1" : null,
-    "Manage License" : "manage license",
-    "-2" : null,
-    "Check for Updates" : "check update",
-    "-3" : null,
-    "Quit" : "quit"
-  };
-
-  var editItems = {
-
-    "Undo" : ["edit undo", editorStrings.ShortcutUndo],
-    "Redo" : ["edit redo", editorStrings.ShortcutRedo],
-    "-1" : null,
-    "Cut" : ["edit cut", editorStrings.ShortcutCut],
-    "Copy" : ["edit copy", editorStrings.ShortcutCopy],
-    "Paste" : ["edit paste", editorStrings.ShortcutPaste],
-    "Select All" : ["edit select all", editorStrings.ShortcutSelectAll],
-    "-2" : null,
-    "Find" : ["edit find", editorStrings.ShortcutFind],
-    "Find Next" : ["edit find next", editorStrings.ShortcutFindNext],
-    "Find Prev" : ["edit find prev", editorStrings.ShortcutFindPrev],
-    "-3" : null,
-    "Format Code" : ["edit format code", editorStrings.ShortcutBeautify],
-    "-4" : null,
-    "Play" : ["edit play", editorStrings.ShortcutPlay]
-  };
-
-  var fileItems = {
-    "New Project" : "new project",
-    "Open Project" : "open project",
-    "Save Project" : "save project",
-    "-1" : null,
-    "Close Project" : "close project",
-    "-2" : null,
-    "Save File" : ["save file", editorStrings.ShortcutSaveFile],
-    "Close File" : ["close file", editorStrings.ShortcutCloseFile],
-
-  };
-
-  var buildItems = {
-    "Build" : ["build project", editorStrings.ShortcutBuild],
-    "-1" : null,
-    "Build Settings" : ["build project settings", editorStrings.ShortcutBuildSettings],
-  };
-
-  var toolsItems = {
-    "Tiled Map Editor" : "tools tiles"
-  };
-
-  var helpItems = {
-    "API Documentation" : "help api",
-    "-1" : null,
-    "Forums" : "help forums",
-    "-2" : null,
-    "Atomic Game Engine on GitHub" : "help github"
-  };
-
-  var developerItems = {
-    "Set 1920x1080 Resolution" : "developer resolution"
-  };
-
-  srcLookup["menu atomic editor"] = utils.createMenuItemSource(editorItems);
-  srcLookup["menu file"] = utils.createMenuItemSource(fileItems);
-  srcLookup["menu edit"] = utils.createMenuItemSource(editItems);
-  srcLookup["menu build"] = utils.createMenuItemSource(buildItems);
-  srcLookup["menu tools"] = utils.createMenuItemSource(toolsItems);
-  srcLookup["menu help"] = utils.createMenuItemSource(helpItems);
-  srcLookup["menu developer"] = utils.createMenuItemSource(developerItems);
-
-
-}
-
+var srcLookup = {};
 
-view.addChild(mainframe);
+var editorItems = {
+  "About Atomic Editor": "about atomic editor",
+  "-1" : null,
+  "Manage License" : "manage license",
+  "-2" : null,
+  "Check for Updates" : "check update",
+  "-3" : null,
+  "Quit" : "quit"
+};
+
+var editItems = {
+
+  "Undo" : ["edit undo", editorStrings.ShortcutUndo],
+  "Redo" : ["edit redo", editorStrings.ShortcutRedo],
+  "-1" : null,
+  "Cut" : ["edit cut", editorStrings.ShortcutCut],
+  "Copy" : ["edit copy", editorStrings.ShortcutCopy],
+  "Paste" : ["edit paste", editorStrings.ShortcutPaste],
+  "Select All" : ["edit select all", editorStrings.ShortcutSelectAll],
+  "-2" : null,
+  "Find" : ["edit find", editorStrings.ShortcutFind],
+  "Find Next" : ["edit find next", editorStrings.ShortcutFindNext],
+  "Find Prev" : ["edit find prev", editorStrings.ShortcutFindPrev],
+  "-3" : null,
+  "Format Code" : ["edit format code", editorStrings.ShortcutBeautify],
+  "-4" : null,
+  "Play" : ["edit play", editorStrings.ShortcutPlay]
+};
+
+var fileItems = {
+  "New Project" : "new project",
+  "Open Project" : "open project",
+  "Save Project" : "save project",
+  "-1" : null,
+  "Close Project" : "close project",
+  "-2" : null,
+  "Save File" : ["save file", editorStrings.ShortcutSaveFile],
+  "Close File" : ["close file", editorStrings.ShortcutCloseFile],
+
+};
+
+var buildItems = {
+  "Build" : ["build project", editorStrings.ShortcutBuild],
+  "-1" : null,
+  "Build Settings" : ["build project settings", editorStrings.ShortcutBuildSettings],
+};
+
+var toolsItems = {
+  "Tiled Map Editor" : "tools tiles"
+};
+
+var helpItems = {
+  "API Documentation" : "help api",
+  "-1" : null,
+  "Forums" : "help forums",
+  "-2" : null,
+  "Atomic Game Engine on GitHub" : "help github"
+};
+
+var developerItems = {
+  "Set 1920x1080 Resolution" : "developer resolution"
+};
+
+srcLookup["menu atomic editor"] = utils.createMenuItemSource(editorItems);
+srcLookup["menu file"] = utils.createMenuItemSource(fileItems);
+srcLookup["menu edit"] = utils.createMenuItemSource(editItems);
+srcLookup["menu build"] = utils.createMenuItemSource(buildItems);
+srcLookup["menu tools"] = utils.createMenuItemSource(toolsItems);
+srcLookup["menu help"] = utils.createMenuItemSource(helpItems);
+srcLookup["menu developer"] = utils.createMenuItemSource(developerItems);

+ 31 - 0
Data/AtomicEditor/Resources/EditorData/AtomicEditor/javascript/ui/projectframe.js

@@ -0,0 +1,31 @@
+var UI = Atomic.UI;
+var UIWidget = Atomic.UIWidget;
+var UIListView = Atomic.UIListView;
+var fileSystem = Atomic.getFileSystem();
+
+var mainframe = require("./mainframe").mainframe;
+
+var projectframe = exports.projectframe = new UIWidget();
+
+projectframe.gravity = UI.GRAVITY_TOP_BOTTOM;
+
+// load the UI
+projectframe.load("AtomicEditor/editor/ui/projectframe.tb.txt");
+
+// snap the project frame into place
+var projectviewcontainer = mainframe.getWidget("projectviewcontainer");
+projectviewcontainer.addChild(projectframe);
+
+var foldercontainer = projectframe.getWidget("foldercontainer");
+
+var folderList = new UIListView();
+
+folderList.id = "folderList";
+
+foldercontainer.addChild(folderList);
+
+//folderList.addItem("Resources", "Folder.icon", "myid")
+
+var folders = fileSystem.scanDir("/", "", Atomic.SCAN_DIRS, false);
+
+print(folders);

+ 6 - 2
Data/AtomicEditor/Resources/EditorData/AtomicEditor/javascript/ui/ui.js

@@ -1,4 +1,8 @@
 
-var mainframe = require("./mainframe");
+// create the view first so it exists before requiring additional modules
+var view = new Atomic.UIView();
+exports.view = view;
 
-print(mainframe);
+require("./mainframe");
+require("./projectframe");
+require("./hierarchyframe");

+ 0 - 121
Source/Atomic/Engine/DebugHud.h

@@ -1,124 +1,3 @@
 #ifdef __disabled
 
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "../Core/Object.h"
-#include "../Core/Timer.h"
-
-namespace Atomic
-{
-
-class Engine;
-class Font;
-class Text;
-class XMLFile;
-
-static const unsigned DEBUGHUD_SHOW_NONE = 0x0;
-static const unsigned DEBUGHUD_SHOW_STATS = 0x1;
-static const unsigned DEBUGHUD_SHOW_MODE = 0x2;
-static const unsigned DEBUGHUD_SHOW_PROFILER = 0x4;
-static const unsigned DEBUGHUD_SHOW_ALL = 0x7;
-
-/// Displays rendering stats and profiling information.
-class ATOMIC_API DebugHud : public Object
-{
-    OBJECT(DebugHud);
-
-public:
-    /// Construct.
-    DebugHud(Context* context);
-    /// Destruct.
-    ~DebugHud();
-
-    /// Update. Called by HandlePostUpdate().
-    void Update();
-    /// Set UI elements' style from an XML file.
-    void SetDefaultStyle(XMLFile* style);
-    /// Set elements to show.
-    void SetMode(unsigned mode);
-    /// Set maximum profiler block depth, default unlimited.
-    void SetProfilerMaxDepth(unsigned depth);
-    /// Set profiler accumulation interval in seconds.
-    void SetProfilerInterval(float interval);
-    /// Set whether to show 3D geometry primitive/batch count only. Default false.
-    void SetUseRendererStats(bool enable);
-    /// Toggle elements.
-    void Toggle(unsigned mode);
-    /// Toggle all elements.
-    void ToggleAll();
-
-    /// Return the UI style file.
-    XMLFile* GetDefaultStyle() const;
-    /// Return rendering stats text.
-    Text* GetStatsText() const { return statsText_; }
-    /// Return rendering mode text.
-    Text* GetModeText() const { return modeText_; }
-    /// Return profiler text.
-    Text* GetProfilerText() const { return profilerText_; }
-    /// Return currently shown elements.
-    unsigned GetMode() const { return mode_; }
-    /// Return maximum profiler block depth.
-    unsigned GetProfilerMaxDepth() const { return profilerMaxDepth_; }
-    /// Return profiler accumulation interval in seconds
-    float GetProfilerInterval() const;
-
-    /// Return whether showing 3D geometry primitive/batch count only.
-    bool GetUseRendererStats() const { return useRendererStats_; }
-    /// Set application-specific stats.
-    void SetAppStats(const String& label, const Variant& stats);
-    /// Set application-specific stats.
-    void SetAppStats(const String& label, const String& stats);
-    /// Reset application-specific stats. Return true if it was erased successfully.
-    bool ResetAppStats(const String& label);
-    /// Clear all application-specific stats.
-    void ClearAppStats();
-
-private:
-    /// Handle logic post-update event. The HUD texts are updated here.
-    void HandlePostUpdate(StringHash eventType, VariantMap& eventData);
-
-    /// Rendering stats text.
-    SharedPtr<Text> statsText_;
-    /// Rendering mode text.
-    SharedPtr<Text> modeText_;
-    /// Profiling information text.
-    SharedPtr<Text> profilerText_;
-    /// Hashmap containing application specific stats.
-    HashMap<String, String> appStats_;
-    /// Profiler timer.
-    Timer profilerTimer_;
-    /// Profiler max block depth.
-    unsigned profilerMaxDepth_;
-    /// Profiler accumulation interval.
-    unsigned profilerInterval_;
-    /// Show 3D geometry primitive/batch count flag.
-    bool useRendererStats_;
-    /// Current shown-element mode.
-    unsigned mode_;
-};
-
-}
-
 #endif

+ 10 - 0
Source/Atomic/UI/UI.cpp

@@ -9,6 +9,7 @@
 #include <TurboBadger/tb_widgets_reader.h>
 #include <TurboBadger/tb_window.h>
 #include <TurboBadger/tb_editfield.h>
+#include <TurboBadger/tb_select.h>
 #include <TurboBadger/image/tb_image_widget.h>
 
 void register_tbbf_font_renderer();
@@ -36,6 +37,7 @@ using namespace tb;
 #include "UIImageWidget.h"
 #include "UIClickLabel.h"
 #include "UICheckBox.h"
+#include "UISelectList.h"
 
 namespace tb
 {
@@ -514,6 +516,14 @@ UIWidget* UI::WrapWidget(tb::TBWidget* widget)
         return nwidget;
     }
 
+    if (widget->IsOfType<TBSelectList>())
+    {
+        UISelectList* nwidget = new UISelectList(context_, false);
+        nwidget->SetWidget(widget);
+        widgetWrap_[widget] = nwidget;
+        return nwidget;
+    }
+
     return 0;
 }
 

+ 226 - 0
Source/Atomic/UI/UIListView.cpp

@@ -0,0 +1,226 @@
+
+#include <TurboBadger/tb_menu_window.h>
+#include <TurboBadger/tb_select.h>
+
+#include "UIListView.h"
+
+using namespace tb;
+
+namespace Atomic
+{
+
+class ListViewItemSource;
+class ListViewItemWidget;
+
+class ListViewItem : public TBGenericStringItem
+{
+    bool expanded_;
+
+public:
+    ListViewItem(const char *str, const TBID &id, const char* icon,  ListViewItemSource* source)
+        : TBGenericStringItem(str, id), source_(source), parent_(0),
+          depth_(0), widget_(0), expanded_(false), icon_(icon)
+    {
+    }
+
+    ListViewItem* AddChild(const char* text, const char* icon, const TBID &id);
+
+    bool GetExpanded() { return expanded_; }
+
+    void SetExpanded(bool expanded)
+    {
+        expanded_ = expanded;
+        if (!expanded_)
+        {
+            for (unsigned i = 0; i < children_.Size(); i ++)
+                children_[i]->SetExpanded(expanded);
+        }
+        else
+        {
+            ListViewItem* p = parent_;
+            while (p)
+            {
+                p->expanded_ = true;
+                p = p->parent_;
+            }
+        }
+    }
+
+    ListViewItemSource* source_;
+    ListViewItem* parent_;
+    int depth_;
+    PODVector<ListViewItem*> children_;
+    ListViewItemWidget* widget_;
+    String icon_;
+};
+
+class ListViewItemWidget : public TBLayout
+{
+public:
+    ListViewItemWidget(ListViewItem *item, ListViewItemSource *source, TBSelectItemViewer *sourceviewer, int index);
+    virtual bool OnEvent(const TBWidgetEvent &ev);
+private:
+    ListViewItemSource *source_;
+    TBSelectItemViewer *sourceviewer_;
+    int index_;
+    ListViewItem* item_;
+};
+
+class ListViewItemSource : public TBSelectItemSourceList<ListViewItem>
+{
+public:
+    TBSelectList* list_;
+    ListViewItemSource(TBSelectList* list) : list_(list) {}
+    virtual ~ListViewItemSource() {}
+    virtual bool Filter(int index, const char *filter);
+    virtual TBWidget *CreateItemWidget(int index, TBSelectItemViewer *viewer);
+};
+
+// implementation
+ListViewItem* ListViewItem::AddChild(const char *text, const char* icon, const TBID &id)
+{
+    ListViewItem* child = new ListViewItem(text, id, icon, source_);
+    child->parent_ = this;
+    child->depth_ = depth_ + 1;
+    source_->AddItem(child);
+    children_.Push(child);
+    return child;
+}
+
+
+ListViewItemWidget::ListViewItemWidget(ListViewItem *item, ListViewItemSource *source,
+                                       TBSelectItemViewer *sourceviewer, int index)
+    : source_(source)
+    , sourceviewer_(sourceviewer)
+    , index_(index)
+    , item_(item)
+{
+    SetLayoutDistribution(LAYOUT_DISTRIBUTION_GRAVITY);
+    SetLayoutDistributionPosition(LAYOUT_DISTRIBUTION_POSITION_LEFT_TOP);
+    SetPaintOverflowFadeout(false);
+
+    item_->widget_ = this;
+
+    for (int i = 0; i < item->depth_; i++)
+    {
+        LayoutParams lp;
+        lp.SetWidth(6);
+        lp.SetHeight(4);
+        TBWidget* spacer = new TBWidget();
+        spacer->SetLayoutParams(lp);
+        GetContentRoot()->AddChild(spacer);
+    }
+
+    if (item->icon_.Length())
+    {
+        TBSkinImage* skinImage = new TBSkinImage(TBIDC(item->icon_.CString()));
+        skinImage->SetIgnoreInput(true);
+        GetContentRoot()->AddChild(skinImage);
+    }
+
+    TBFontDescription fd;
+    fd.SetID(TBIDC("Vera"));
+    fd.SetSize(11);
+
+    TBTextField* tfield = new TBTextField();
+    tfield->SetIgnoreInput(true);
+    tfield->SetSkinBg(TBIDC("Folder"));
+    tfield->SetText(item->str);
+    tfield->SetFontDescription(fd);
+
+    SetSkinBg(TBIDC("TBSelectItem"));
+    GetContentRoot()->AddChild(tfield);
+
+    SetID(item->id);
+}
+
+bool ListViewItemWidget::OnEvent(const TBWidgetEvent &ev)
+{
+    if (ev.type == EVENT_TYPE_WHEEL)
+    {
+        return false;
+    }
+
+    // get clicks this way, not sure we want to
+    if (ev.type == EVENT_TYPE_CLICK && ev.target->GetID() == item_->id)
+    {
+        item_->SetExpanded(!item_->GetExpanded());
+        source_->list_->InvalidateList();
+
+        // want to bubble
+        return false;
+    }
+
+    return TBLayout::OnEvent(ev);
+}
+
+
+bool ListViewItemSource::Filter(int index, const char *filter)
+{
+    ListViewItem* item = GetItem(index);
+
+    if (!item->parent_)
+        return true;
+
+    if (item->parent_->GetExpanded())
+        return true;
+
+    return false;
+
+}
+
+TBWidget *ListViewItemSource::CreateItemWidget(int index, TBSelectItemViewer *viewer)
+{
+    ListViewItem* item = GetItem(index);
+
+    if (TBLayout *layout = new ListViewItemWidget(item, this, viewer, index))
+        return layout;
+
+    return nullptr;
+}
+
+//-----------------------------------------------------------------------------------
+
+UIListView::UIListView(Context* context, bool createWidget) :
+    UIWidget(context, createWidget),
+    source_(0)
+{
+    rootList_ = new UISelectList(context);
+
+    // dummy filter so filter is called
+    rootList_->SetFilter(" ");
+
+    widget_->SetGravity(WIDGET_GRAVITY_ALL);
+    rootList_->SetGravity(WIDGET_GRAVITY_ALL);
+
+    source_ = new ListViewItemSource(rootList_->GetTBSelectList());
+
+    rootList_->GetTBSelectList()->SetSource(source_);
+
+    AddChild(rootList_);
+}
+
+UIListView::~UIListView()
+{
+
+}
+
+void UIListView::AddItem(const String& text, const String& icon, const String& id)
+{
+    ListViewItem* item = new ListViewItem(text.CString(), TBID(id.CString()), icon.CString(), source_);
+    source_->AddItem(item);
+}
+
+void UIListView::DeleteAllItems()
+{
+
+}
+
+
+void UIListView::SelectItemByID(const String& id)
+{
+
+}
+
+
+}

+ 37 - 0
Source/Atomic/UI/UIListView.h

@@ -0,0 +1,37 @@
+
+#pragma once
+
+#include "UIWidget.h"
+#include "UISelectList.h"
+
+namespace Atomic
+{
+
+class ListViewItemSource;
+
+class UIListView : public UIWidget
+{
+    OBJECT(UIListView);
+
+public:
+    /// Construct.
+    UIListView(Context* context, bool createWidget = true);
+
+    /// Destruct.
+    virtual ~UIListView();
+
+    void AddItem(const String& text, const String& icon, const String& id);
+    void DeleteAllItems();
+    void SelectItemByID(const String& id);
+
+    UISelectList* GetRootList() { return rootList_; }
+
+private:
+
+    SharedPtr<UISelectList> rootList_;
+
+    ListViewItemSource* source_;
+
+};
+
+}

+ 1 - 1
Source/Atomic/UI/UIMenubar.cpp

@@ -86,7 +86,7 @@ tb::TBGenericStringItem* UIMenuItem::GetTBItem()
 
     if (!subSource_)
     {
-         item = new MenubarItem(str_.CString(), id_, shortcut_);
+        item = new MenubarItem(str_.CString(), id_, shortcut_);
     }
     else
     {

+ 54 - 0
Source/Atomic/UI/UISelectList.cpp

@@ -0,0 +1,54 @@
+
+#include <TurboBadger/tb_select.h>
+
+#include "UI.h"
+#include "UIEvents.h"
+#include "UISelectList.h"
+
+using namespace tb;
+
+namespace Atomic
+{
+
+UISelectList::UISelectList(Context* context, bool createWidget) : UIWidget(context, false)
+{
+    if (createWidget)
+    {
+        widget_ = new TBSelectList();
+        widget_->SetDelegate(this);
+        GetSubsystem<UI>()->WrapWidget(this, widget_);
+    }
+}
+
+UISelectList::~UISelectList()
+{
+
+}
+
+tb::TBSelectList* UISelectList::GetTBSelectList()
+{
+    return (TBSelectList*) widget_;
+}
+
+void UISelectList::SetFilter(const String& filter)
+{
+    if (!widget_)
+        return;
+
+    ((TBSelectList*)widget_)->SetFilter(filter.CString());
+}
+
+void UISelectList::SetSource(UISelectItemSource* source)
+{
+    if (!widget_)
+        return;
+
+    ((TBSelectList*)widget_)->SetSource(source ? source->GetTBItemSource() : NULL);
+}
+
+bool UISelectList::OnEvent(const tb::TBWidgetEvent &ev)
+{
+    return false;
+}
+
+}

+ 39 - 0
Source/Atomic/UI/UISelectList.h

@@ -0,0 +1,39 @@
+
+#pragma once
+
+#include "UIWidget.h"
+#include "UISelectItem.h"
+
+namespace tb
+{
+    class TBSelectList;
+}
+
+namespace Atomic
+{
+
+class UISelectList : public UIWidget
+{
+    OBJECT(UISelectList)
+
+public:
+
+    UISelectList(Context* context, bool createWidget = true);
+    virtual ~UISelectList();
+
+    void SetFilter(const String& filter);
+
+    void SetSource(UISelectItemSource* source);
+
+    tb::TBSelectList* GetTBSelectList();
+
+protected:
+
+    virtual bool OnEvent(const tb::TBWidgetEvent &ev);
+
+private:
+
+};
+
+
+}

+ 19 - 4
Source/Atomic/UI/UIWidget.cpp

@@ -24,8 +24,6 @@ UIWidget::UIWidget(Context* context, bool createWidget) : Object(context),
         GetSubsystem<UI>()->WrapWidget(this, widget_);
     }
 
-    UI* ui = GetSubsystem<UI>();
-
 }
 
 UIWidget::~UIWidget()
@@ -38,7 +36,7 @@ bool UIWidget::Load(const String& filename)
     UI* ui = GetSubsystem<UI>();
 
     if  (!ui->LoadResourceFile(widget_ , filename))
-        return false;    
+        return false;
 
     VariantMap eventData;
     eventData[WidgetLoaded::P_WIDGET] = this;
@@ -159,12 +157,29 @@ IntRect UIWidget::GetRect()
     return rect;
 }
 
+void UIWidget::SetRect(IntRect rect)
+{
+    if (!widget_)
+        return;
+
+    tb::TBRect tbrect;
+
+    tbrect.y = rect.top_;
+    tbrect.x = rect.left_;
+    tbrect.w = rect.right_ - rect.left_;
+    tbrect.h = rect.bottom_ - rect.top_;
+
+    widget_->SetRect(tbrect);
+
+}
+
+
 void UIWidget::SetSize(int width, int height)
 {
     if (!widget_)
         return;
 
-    widget_->SetSize(width, height);       
+    widget_->SetSize(width, height);
 }
 
 void UIWidget::Invalidate()

+ 1 - 0
Source/Atomic/UI/UIWidget.h

@@ -28,6 +28,7 @@ public:
     bool Load(const String& filename);
 
     IntRect GetRect();
+    void SetRect(IntRect r);
 
     void SetSize(int width, int height);
     void SetPosition(int x, int y);

+ 13 - 1
Source/AtomicJS/JSBind/JSBHeaderVisitor.h

@@ -343,7 +343,11 @@ public:
     // global var decl or function
     virtual bool visit(Declaration* decl)
     {
+        if (decl->isTypedef())
+            return true;
+
         FullySpecifiedType dtype = decl->type();
+
         Type* type = dtype.type();
 
         if (type->isPointerType() || type->isReferenceType())
@@ -352,8 +356,16 @@ public:
         if (type->asEnumType())
             return true;
 
-        if (!type->asFloatType() && !type->asIntegerType())
+        bool _unsigned = false;
+
+        if (dtype.isUnsigned())
+            _unsigned = true;
+
+
+        if (!type->asFloatType() && !type->asIntegerType() && !_unsigned)
+        {
             return true;
+        }
 
         module_->RegisterConstant(getNameString(decl->name()).CString());
 

+ 4 - 2
Source/AtomicJS/JSBind/modules/UI.json

@@ -1,10 +1,12 @@
 {
 	"name" : "UI",
 	"sources" : ["UI"],
-	"includes" : ["<Atomic/Graphics/Material.h>", "<Atomic/Scene/Node.h>", "<Atomic/Scene/Scene.h>", "<Atomic/Graphics/Texture2D.h>"],
+	"includes" : ["<Atomic/Graphics/Material.h>", "<Atomic/Scene/Node.h>", "<Atomic/Scene/Scene.h>", "<Atomic/Graphics/Texture2D.h>",
+								"<Atomic/UI/UIBatch.h>"],
 	"classes" : ["UIWidget", "UILayout", "UIView", "UIWindow", "UIButton", "UITextField",
 								"UISelectItem", "UISelectItemSource", "UIMenuWindow", "UIEditField",
-								"UIImageWidget", "UIClickLabel", "UICheckBox", "UIMenuItem", "UIMenuItemSource"],
+								"UIImageWidget", "UIClickLabel", "UICheckBox", "UIMenuItem", "UIMenuItemSource",
+								"UISelectList", "UIListView"],
 	"overloads" : {
 	}
 }

+ 11 - 0
Source/AtomicJS/Javascript/JSAtomic.cpp

@@ -136,6 +136,14 @@ static int js_atomic_GetInput(duk_context* ctx)
     return 1;
 }
 
+static int js_atomic_GetFileSystem(duk_context* ctx)
+{
+    JSVM* vm = JSVM::GetJSVM(ctx);
+    js_push_class_object_instance(ctx, vm->GetSubsystem<FileSystem>());
+    return 1;
+}
+
+
 static int js_atomic_script(duk_context* ctx)
 {
     JSVM* vm = JSVM::GetJSVM(ctx);
@@ -304,6 +312,9 @@ void jsapi_init_atomic(JSVM* vm)
     duk_push_c_function(ctx, js_atomic_GetInput, 0);
     duk_put_prop_string(ctx, -2, "getInput");
 
+    duk_push_c_function(ctx, js_atomic_GetFileSystem, 0);
+    duk_put_prop_string(ctx, -2, "getFileSystem");
+
     duk_push_c_function(ctx, js_atomic_script, 1);
     duk_put_prop_string(ctx, -2, "script");
 

+ 1 - 1
Source/AtomicJS/Javascript/JSEventHelper.cpp

@@ -15,7 +15,7 @@ JSEventHelper::JSEventHelper(Context* context) :
 
 JSEventHelper::~JSEventHelper()
 {
-    LOGINFO("Boom");
+
 }
 
 void JSEventHelper::AddEventHandler(StringHash eventType)

+ 39 - 0
Source/AtomicJS/Javascript/JSIO.cpp

@@ -22,6 +22,39 @@ static int File_ReadText(duk_context* ctx)
     return 1;
 }
 
+static int FileSystem_ScanDir(duk_context* ctx)
+{
+    duk_push_this(ctx);
+
+    FileSystem* fs = js_to_class_instance<FileSystem>(ctx, -1, 0);
+
+    if ( !duk_is_string(ctx, 0) || !duk_is_string(ctx, 1) ||
+            !duk_is_number(ctx, 2) || !duk_is_boolean(ctx, 3))
+    {
+        duk_push_string(ctx, "FileSystem::ScanDir bad args");
+        duk_throw(ctx);
+    }
+
+    const char* pathName = duk_to_string(ctx, 0);
+    const char* filter = duk_to_string(ctx, 1);
+    unsigned flags = duk_to_number(ctx, 2);
+    bool recursive = duk_to_boolean(ctx, 3) ? true : false;
+
+    Vector<String> result;
+
+    fs->ScanDir(result, pathName, filter, flags, recursive);
+
+    duk_push_array(ctx);
+
+    for (unsigned i = 0; i < result.Size(); i++)
+    {
+        duk_push_string(ctx, result[i].CString());
+        duk_put_prop_index(ctx, -2, i);
+    }
+
+    return 1;
+}
+
 void jsapi_init_io(JSVM* vm)
 {
     duk_context* ctx = vm->GetJSContext();
@@ -30,6 +63,12 @@ void jsapi_init_io(JSVM* vm)
     duk_push_c_function(ctx, File_ReadText, 0);
     duk_put_prop_string(ctx, -2, "readText");
     duk_pop(ctx);
+
+    js_class_get_prototype(ctx, "FileSystem");
+    duk_push_c_function(ctx, FileSystem_ScanDir, 4);
+    duk_put_prop_string(ctx, -2, "scanDir");
+    duk_pop(ctx);
+
 }
 
 }

+ 2 - 0
Source/AtomicJS/Javascript/JSUI.cpp

@@ -46,6 +46,8 @@ JSUI::JSUI(Context* context) : Object(context),
     uiTypes_["UIWindow"] = true;
     uiTypes_["UIClickLabel"] = true;
     uiTypes_["UICheckBox"] = true;
+    uiTypes_["UISelectLost"] = true;
+    uiTypes_["UIListView"] = true;
 }
 
 JSUI::~JSUI()