stuff-from-scratch/apps/sample-gui/MediaTool.cpp

72 lines
2.2 KiB
C++
Raw Normal View History

2022-11-11 11:48:42 +00:00
#include "MediaTool.h"
#include "TextEditorView.h"
#include "AudioEditorView.h"
#include "ImageEditorView.h"
#include "WebClientView.h"
#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"
MediaTool::MediaTool(std::unique_ptr<CommandLineArgs> args)
: GuiApplication(std::move(args))
{
}
void MediaTool::initializeViews()
{
2022-11-14 11:19:51 +00:00
auto mainWindow = mDesktopManager->getWindowManager()->getMainWindow();
mainWindow->setSize(800, 600);
2022-11-11 11:48:42 +00:00
2022-11-11 14:22:31 +00:00
/*
2022-11-11 11:48:42 +00:00
auto tabbedPanel = TabbedPanelWidget::Create();
auto textEditor = TextEditorView::Create();
auto path = mMainApplication->GetCommandLineArgs()->getLaunchPath();
path /= "out.txt";
textEditor->GetController()->SetSavePath(path);
textEditor->GetController()->SetLoadPath(path);
textEditor->Initialize();
tabbedPanel->AddPanel(std::move(textEditor), "Text Editor");
auto audioEditor = AudioEditorView::Create();
tabbedPanel->AddPanel(std::move(audioEditor), "Audio Editor");
auto imageEditor = ImageEditorView::Create();
tabbedPanel->AddPanel(std::move(imageEditor), "Image Editor");
auto webClient = WebClientView::Create();
tabbedPanel->AddPanel(std::move(webClient), "Web Client");
auto topBar = TopBar::Create();
auto statusBar = StatusBar::Create();
auto horizontalSpace = HorizontalSpacer::Create();
horizontalSpace->AddWidgetWithScale(std::move(topBar), 1);
horizontalSpace->AddWidgetWithScale(std::move(tabbedPanel), 20);
horizontalSpace->AddWidgetWithScale(std::move(statusBar), 1);
2022-11-11 14:22:31 +00:00
*/
auto button = Button::Create();
button->setLabel("Click!");
button->setBounds(100, 200);
2022-11-16 17:00:55 +00:00
button->setBackgroundColor(Color(255, 0, 255, 1));
2022-11-11 14:22:31 +00:00
auto background_widget = Widget::Create();
2022-11-16 17:00:55 +00:00
background_widget->setName("BackgroundWidget");
background_widget->setBackgroundColor(Color(0, 255, 255, 1));
2022-11-11 14:22:31 +00:00
auto horizontal_spacer = HorizontalSpacer::Create();
horizontal_spacer->addWidgetWithScale(std::move(button), 1);
horizontal_spacer->addWidgetWithScale(std::move(background_widget), 1);
2022-11-14 11:19:51 +00:00
mainWindow->setWidget(std::move(horizontal_spacer));
2022-11-11 11:48:42 +00:00
}