stuff-from-scratch/apps/notes_tk/NotesTk.cpp

72 lines
2.2 KiB
C++
Raw Normal View History

2022-12-02 11:50:15 +00:00
#include "NotesTk.h"
2022-11-11 11:48:42 +00:00
#include "TextEditorView.h"
#include "AudioEditorView.h"
#include "ImageEditorView.h"
#include "WebClientView.h"
2022-11-18 15:11:54 +00:00
#include "CanvasView.h"
2022-11-18 17:05:33 +00:00
#include "MeshViewerView.h"
2022-11-18 15:11:54 +00:00
2022-11-11 11:48:42 +00:00
#include "TabbedPanelWidget.h"
#include "TopBar.h"
2022-11-16 15:06:08 +00:00
#include "TextNode.h"
2022-11-11 11:48:42 +00:00
#include "StatusBar.h"
#include "HorizontalSpacer.h"
#include "DesktopManager.h"
#include "MainApplication.h"
2023-01-03 20:33:18 +00:00
NotesTk::NotesTk(std::unique_ptr<CommandLineArgs> args, std::unique_ptr<MainApplication> mainApp)
: GuiApplication(std::move(args), std::move(mainApp))
2022-11-11 11:48:42 +00:00
{
}
2022-12-02 11:50:15 +00:00
void NotesTk::initializeViews()
2022-11-11 11:48:42 +00:00
{
2022-11-14 11:19:51 +00:00
auto mainWindow = mDesktopManager->getWindowManager()->getMainWindow();
mainWindow->setSize(800, 600);
2022-12-02 11:50:15 +00:00
mainWindow->setTitle("NotesTK");
2022-11-11 11:48:42 +00:00
auto tabbedPanel = TabbedPanelWidget::Create();
auto textEditor = TextEditorView::Create();
2022-11-16 17:27:19 +00:00
auto path = mMainApplication->getCommandLineArgs()->getLaunchPath();
2022-11-11 11:48:42 +00:00
path /= "out.txt";
2022-11-17 08:39:49 +00:00
textEditor->setName("TextEditor");
2022-11-18 15:11:54 +00:00
textEditor->getController()->SetSavePath(path);
textEditor->getController()->SetLoadPath(path);
textEditor->initialize();
2022-11-16 17:27:19 +00:00
tabbedPanel->addPanel(std::move(textEditor), "Text Editor");
2022-11-11 11:48:42 +00:00
auto audioEditor = AudioEditorView::Create();
2022-11-17 08:39:49 +00:00
audioEditor->setName("audioEditor");
2022-12-02 11:50:15 +00:00
tabbedPanel->addPanel(std::move(audioEditor), "Audio Editor");
2022-11-11 11:48:42 +00:00
auto imageEditor = ImageEditorView::Create();
2022-11-17 08:39:49 +00:00
imageEditor->setName("imageEditor");
2022-11-16 17:27:19 +00:00
tabbedPanel->addPanel(std::move(imageEditor), "Image Editor");
2022-11-11 11:48:42 +00:00
auto webClient = WebClientView::Create();
2022-11-17 08:39:49 +00:00
webClient->setName("webClient");
2022-11-16 17:27:19 +00:00
tabbedPanel->addPanel(std::move(webClient), "Web Client");
2022-11-11 11:48:42 +00:00
2022-11-18 15:11:54 +00:00
auto canvas = CanvasView::Create();
canvas->setName("CanvasView");
tabbedPanel->addPanel(std::move(canvas), "Canvas");
2022-11-18 17:05:33 +00:00
auto mesh = MeshViewerView::Create();
mesh->setName("MeshViewer");
tabbedPanel->addPanel(std::move(mesh), "Mesh Viewer");
2022-11-11 11:48:42 +00:00
auto topBar = TopBar::Create();
2022-12-02 11:50:15 +00:00
//auto statusBar = StatusBar::Create();
2022-11-11 11:48:42 +00:00
2022-11-16 17:27:19 +00:00
auto horizontal_spacer = HorizontalSpacer::Create();
horizontal_spacer->addWidgetWithScale(std::move(topBar), 1);
horizontal_spacer->addWidgetWithScale(std::move(tabbedPanel), 20);
2022-12-02 11:50:15 +00:00
//horizontal_spacer->addWidgetWithScale(std::move(statusBar), 1);
2022-11-11 14:22:31 +00:00
2022-11-14 11:19:51 +00:00
mainWindow->setWidget(std::move(horizontal_spacer));
2022-11-11 11:48:42 +00:00
}