
function createInventoryWidget()

   local rootWidget = WidgetAlignedBox:new();
   rootWidget:setMinWidth(64);
   rootWidget:setMinHeight(64);
   rootWidget:setName("inventory");


   local mainBox = WidgetPaddedBox:new();
   mainBox:setMinWidth(256);
   mainBox:setMinHeight(256);
   mainBox:setBackgroundImage("editordata/np_ff1.ninepatch");

   rootWidget:setChild(mainBox);

   return rootWidget;

end

function toggleInventoryScreen()

   for i = 1, #widgetStack do

      --writeConsole(widgetStack[i]:getName().."\n");

      if widgetStack[i]:getName() == "inventory" then

         while #widgetStack >= i do
            Widget:delete(widgetStack[i]);
            widgetStack[i] = nil;
         end

         return;

      end

   end

   local widget = createInventoryWidget();
   ui_push(widget);

end

