Set up stacked widget.
This commit is contained in:
parent
4e85edacc8
commit
ee51f3ee09
51 changed files with 808 additions and 195 deletions
|
@ -1,18 +1,20 @@
|
|||
#include "GuiApplication.h"
|
||||
|
||||
#include "Widget.h"
|
||||
#include "HorizontalSpacer.h"
|
||||
#include "VerticalSpacer.h"
|
||||
#include "TextBox.h"
|
||||
#include "Button.h"
|
||||
#include "Label.h"
|
||||
#include "XcbInterface.h"
|
||||
#include "XcbKeyboard.h"
|
||||
#include "Window.h"
|
||||
#include "TextElement.h"
|
||||
#include "WindowManager.h"
|
||||
#include "TextEditorPanel.h"
|
||||
#include <iostream>
|
||||
#include "TextEditorView.h"
|
||||
#include "AudioEditorView.h"
|
||||
#include "ImageEditorView.h"
|
||||
#include "WebClientView.h"
|
||||
#include "TabbedPanelWidget.h"
|
||||
#include "TopBar.h"
|
||||
#include "StatusBar.h"
|
||||
#include "HorizontalSpacer.h"
|
||||
|
||||
GuiApplication::GuiApplication()
|
||||
: AbstractDesktopApp(),
|
||||
|
@ -37,43 +39,34 @@ void GuiApplication::SetUpWidget()
|
|||
auto mainWindow = mDesktopManager->GetWindowManager()->GetMainWindow();
|
||||
mainWindow->SetSize(800, 600);
|
||||
|
||||
// Left panel
|
||||
auto textEditorButton = Button::Create();
|
||||
textEditorButton->SetLabel("Text Editor");
|
||||
textEditorButton->SetBackgroundColor(Color::Create(156, 156, 156));
|
||||
auto tabbedPanel = TabbedPanelWidget::Create();
|
||||
|
||||
auto imageEditorButton = Button::Create();
|
||||
imageEditorButton->SetLabel("Image Editor");
|
||||
imageEditorButton->SetBackgroundColor(Color::Create(156, 156, 156));
|
||||
|
||||
auto audioEditorButton = Button::Create();
|
||||
audioEditorButton->SetLabel("Audio Editor");
|
||||
audioEditorButton->SetBackgroundColor(Color::Create(156, 156, 156));
|
||||
|
||||
auto webClientButton = Button::Create();
|
||||
webClientButton->SetLabel("Web Client");
|
||||
webClientButton->SetBackgroundColor(Color::Create(156, 156, 156));
|
||||
|
||||
auto leftSpacer = HorizontalSpacer::Create();
|
||||
leftSpacer->AddWidget(std::move(textEditorButton));
|
||||
leftSpacer->AddWidget(std::move(imageEditorButton));
|
||||
leftSpacer->AddWidget(std::move(audioEditorButton));
|
||||
leftSpacer->AddWidget(std::move(webClientButton));
|
||||
leftSpacer->SetMaxHeight(200);
|
||||
|
||||
// Right panel
|
||||
auto textEditor = TextEditorPanel::Create();
|
||||
textEditor->SetOnSaveFunction([](const std::string& content)
|
||||
{
|
||||
std::cout << content << std::endl;
|
||||
});
|
||||
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 vertSpacer = VerticalSpacer::Create();
|
||||
vertSpacer->AddWidgetWithScale(std::move(leftSpacer), 1);
|
||||
vertSpacer->AddWidgetWithScale(std::move(textEditor), 4);
|
||||
auto audioEditor = AudioEditorView::Create();
|
||||
tabbedPanel->AddPanel(std::move(audioEditor), "Audio Editor");
|
||||
|
||||
mainWindow->AddWidget(std::move(vertSpacer));
|
||||
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);
|
||||
|
||||
mainWindow->AddWidget(std::move(horizontalSpace));
|
||||
}
|
||||
|
||||
void GuiApplication::Run()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue