Skip to content

Commit

Permalink
#6 Add ProgressBar, #119 Add import ui
Browse files Browse the repository at this point in the history
  • Loading branch information
ducphamhong committed Feb 27, 2021
1 parent afdcb06 commit 2ffba23
Show file tree
Hide file tree
Showing 18 changed files with 327 additions and 50 deletions.
15 changes: 11 additions & 4 deletions Projects/Editor/Source/Editor/CEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ This file is part of the "Skylicht Engine".
#include "CWindowConfig.h"
#include "Utils/CStringImp.h"

#include "Space/Import/CSpaceImport.h"
#include "Space/Scene/CSpaceScene.h"
#include "Space/Assets/CSpaceAssets.h"
#include "Space/Console/CSpaceConsole.h"
Expand Down Expand Up @@ -75,10 +76,12 @@ namespace Skylicht

void CEditor::initImportGUI()
{
m_importDialog = new GUI::CDialogWindow(m_canvas, 0.0f, 0.0f, 400.0f, 140.0f);
m_importDialog = new GUI::CDialogWindow(m_canvas, 0.0f, 0.0f, 400.0f, 120.0f);
m_importDialog->setCaption(L"Import Assets");
m_importDialog->showCloseButton(false);
m_importDialog->bringToFront();

initWorkspace(m_importDialog, m_importDialog->getCaption());
}

void CEditor::initEditorGUI()
Expand Down Expand Up @@ -304,17 +307,21 @@ namespace Skylicht
initWorkspace(property, property->getCaption());
}

void CEditor::initWorkspace(GUI::CDockableWindow* window, const std::wstring& workspace)
void CEditor::initWorkspace(GUI::CWindow* window, const std::wstring& workspace)
{
if (workspace == L"Scene")
{
m_workspaces.push_back(new CSpaceScene(window, this));
}
if (workspace == L"GUI Design")
else if (workspace == L"Import Assets")
{
m_workspaces.push_back(new CSpaceImport(window, this));
}
else if (workspace == L"GUI Design")
{

}
if (workspace == L"Animation")
else if (workspace == L"Animation")
{

}
Expand Down
2 changes: 1 addition & 1 deletion Projects/Editor/Source/Editor/CEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace Skylicht

void initSessionLayout(const std::string& data);

void initWorkspace(GUI::CDockableWindow* window, const std::wstring& workspace);
void initWorkspace(GUI::CWindow* window, const std::wstring& workspace);

void removeWorkspace(CSpace* space);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Skylicht
{
namespace Editor
{
CSpaceAssets::CSpaceAssets(GUI::CDockableWindow* window, CEditor* editor) :
CSpaceAssets::CSpaceAssets(GUI::CWindow* window, CEditor* editor) :
CSpace(window, editor)
{
GUI::CToolbar* toolbar = new GUI::CToolbar(window);
Expand Down
6 changes: 3 additions & 3 deletions Projects/Editor/Source/Editor/Space/Assets/CSpaceAssets.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ namespace Skylicht
class CSpaceAssets : public CSpace
{
protected:
GUI::CTreeControl *m_folder;
GUI::CTextBox *m_search;
GUI::CTreeControl* m_folder;
GUI::CTextBox* m_search;

public:
CSpaceAssets(GUI::CDockableWindow *window, CEditor *editor);
CSpaceAssets(GUI::CWindow* window, CEditor* editor);

virtual ~CSpaceAssets();
};
Expand Down
6 changes: 3 additions & 3 deletions Projects/Editor/Source/Editor/Space/CSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Skylicht
{
namespace Editor
{
CSpace::CSpace(GUI::CDockableWindow *window, CEditor* editor) :
CSpace::CSpace(GUI::CWindow* window, CEditor* editor) :
m_window(window),
m_editor(editor)
{
Expand All @@ -48,12 +48,12 @@ namespace Skylicht

}

void CSpace::onDestroy(GUI::CBase *base)
void CSpace::onDestroy(GUI::CBase* base)
{
m_editor->removeWorkspace(this);
}

void CSpace::onWindowResize(GUI::CBase *base)
void CSpace::onWindowResize(GUI::CBase* base)
{
if (base == m_window)
{
Expand Down
10 changes: 5 additions & 5 deletions Projects/Editor/Source/Editor/Space/CSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ namespace Skylicht
class CSpace
{
protected:
GUI::CDockableWindow *m_window;
CEditor *m_editor;
GUI::CWindow* m_window;
CEditor* m_editor;

public:
CSpace(GUI::CDockableWindow *window, CEditor* editor);
CSpace(GUI::CWindow* window, CEditor* editor);

virtual ~CSpace();

virtual void update();

virtual void onDestroy(GUI::CBase *base);
virtual void onDestroy(GUI::CBase* base);

virtual void onWindowResize(GUI::CBase *base);
virtual void onWindowResize(GUI::CBase* base);

virtual void onResize(float w, float h) {}
};
Expand Down
4 changes: 2 additions & 2 deletions Projects/Editor/Source/Editor/Space/Console/CSpaceConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Skylicht
{
namespace Editor
{
CSpaceConsole::CSpaceConsole(GUI::CDockableWindow *window, CEditor *editor) :
CSpaceConsole::CSpaceConsole(GUI::CWindow* window, CEditor* editor) :
CSpace(window, editor),
m_lastID(0)
{
Expand All @@ -52,7 +52,7 @@ namespace Skylicht
{
CSpace::update();

CConsoleLog *console = CConsoleLog::getInstance();
CConsoleLog* console = CConsoleLog::getInstance();
if (console->getLogCount() > 0)
{
const CConsoleLog::SLogInfo& log = console->getLast();
Expand Down
4 changes: 2 additions & 2 deletions Projects/Editor/Source/Editor/Space/Console/CSpaceConsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ namespace Skylicht
class CSpaceConsole : public CSpace
{
protected:
GUI::CTextBox *m_textControl;
GUI::CTextBox* m_textControl;

u32 m_lastID;

public:
CSpaceConsole(GUI::CDockableWindow *window, CEditor *editor);
CSpaceConsole(GUI::CWindow* window, CEditor* editor);

virtual ~CSpaceConsole();

Expand Down
63 changes: 63 additions & 0 deletions Projects/Editor/Source/Editor/Space/Import/CSpaceImport.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
!@
MIT License
CopyRight (c) 2020 Skylicht Technology CO., LTD
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.
This file is part of the "Skylicht Engine".
https://github.com/skylicht-lab/skylicht-engine
!#
*/

#include "pch.h"
#include "CSpaceImport.h"

namespace Skylicht
{
namespace Editor
{
CSpaceImport::CSpaceImport(GUI::CWindow* window, CEditor* editor) :
CSpace(window, editor)
{
m_progressBar = new GUI::CProgressBar(window);
m_progressBar->dock(GUI::EPosition::Top);
m_progressBar->setMargin(GUI::SMargin(14.0f, 14.0, 14.0, 0.0f));

m_statusText = new GUI::CLabel(window);
m_statusText->dock(GUI::EPosition::Fill);
m_statusText->setMargin(GUI::SMargin(14.0f, 5.0, 14.0, 0.0f));
m_statusText->setWrapMultiline(true);
m_statusText->setString(L"Resolving...\nAssets/BuildIn");
}

CSpaceImport::~CSpaceImport()
{

}

void CSpaceImport::update()
{
m_progressBar->setPercent(0.3f);

CSpace::update();
}

void CSpaceImport::onDestroy(GUI::CBase* base)
{
CSpace::onDestroy(base);
}
}
}
50 changes: 50 additions & 0 deletions Projects/Editor/Source/Editor/Space/Import/CSpaceImport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
!@
MIT License
CopyRight (c) 2021 Skylicht Technology CO., LTD
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.
This file is part of the "Skylicht Engine".
https://github.com/skylicht-lab/skylicht-engine
!#
*/

#pragma once

#include "SkylichtEngine.h"
#include "Editor/Space/CSpace.h"

namespace Skylicht
{
namespace Editor
{
class CSpaceImport : public CSpace
{
protected:
GUI::CProgressBar* m_progressBar;
GUI::CLabel* m_statusText;

public:
CSpaceImport(GUI::CWindow* window, CEditor* editor);

virtual ~CSpaceImport();

virtual void update();

virtual void onDestroy(GUI::CBase* base);
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Skylicht
{
namespace Editor
{
CSpaceProperty::CSpaceProperty(GUI::CDockableWindow* window, CEditor* editor) :
CSpaceProperty::CSpaceProperty(GUI::CWindow* window, CEditor* editor) :
CSpace(window, editor)
{
GUI::CScrollControl* scrollWindow = new GUI::CScrollControl(window);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace Skylicht
protected:

public:
CSpaceProperty(GUI::CDockableWindow* window, CEditor* editor);
CSpaceProperty(GUI::CWindow* window, CEditor* editor);

virtual ~CSpaceProperty();

Expand Down
Loading

0 comments on commit 2ffba23

Please sign in to comment.