More window cleaning

This commit is contained in:
James Grogan 2022-11-11 14:22:31 +00:00
parent 6adc441e6f
commit 53c98a227d
29 changed files with 422 additions and 261 deletions

View file

@ -23,6 +23,7 @@ void MediaTool::initializeViews()
auto mainWindow = mDesktopManager->GetWindowManager()->GetMainWindow();
mainWindow->SetSize(800, 600);
/*
auto tabbedPanel = TabbedPanelWidget::Create();
auto textEditor = TextEditorView::Create();
@ -50,5 +51,19 @@ void MediaTool::initializeViews()
horizontalSpace->AddWidgetWithScale(std::move(tabbedPanel), 20);
horizontalSpace->AddWidgetWithScale(std::move(statusBar), 1);
mainWindow->AddWidget(std::move(horizontalSpace));
*/
auto button = Button::Create();
button->setLabel("Click!");
button->setBounds(100, 200);
button->setBackgroundColor(Color::Create(0, 0, 255, 0));
auto background_widget = Widget::Create();
background_widget->setBackgroundColor(Color::Create(0, 255, 255, 0));
auto horizontal_spacer = HorizontalSpacer::Create();
horizontal_spacer->addWidgetWithScale(std::move(button), 1);
horizontal_spacer->addWidgetWithScale(std::move(background_widget), 1);
mainWindow->AddWidget(std::move(horizontal_spacer));
}

View file

@ -6,10 +6,10 @@
AudioEditorView::AudioEditorView()
{
auto label = Label::Create();
label->SetLabel("Audio Editor");
label->SetBackgroundColor(Color::Create(200, 189, 160));
label->SetMargin(1);
AddWidget(std::move(label));
label->setLabel("Audio Editor");
label->setBackgroundColor(Color::Create(200, 189, 160));
label->setMargin(1);
addWidget(std::move(label));
}
std::unique_ptr<AudioEditorView> AudioEditorView::Create()

View file

@ -11,8 +11,9 @@ int main(int argc, char *argv[])
args->recordLaunchPath();
// Start the gui app
auto gui_app = GuiApplication(std::move(args));
gui_app.run();
auto app = MediaTool(std::move(args));
app.setUiInterfaceBackend(UiInterfaceFactory::Backend::X11_RASTER);
app.run();
return 0;
}

View file

@ -6,10 +6,10 @@
ImageEditorView::ImageEditorView()
{
auto label = Label::Create();
label->SetLabel("Image Editor");
label->SetBackgroundColor(Color::Create(200, 189, 160));
label->SetMargin(1);
AddWidget(std::move(label));
label->setLabel("Image Editor");
label->setBackgroundColor(Color::Create(200, 189, 160));
label->setMargin(1);
addWidget(std::move(label));
}
std::unique_ptr<ImageEditorView> ImageEditorView::Create()

View file

@ -18,17 +18,17 @@ TextEditorController* TextEditorView::GetController()
void TextEditorView::Initialize()
{
auto label = Label::Create();
label->SetLabel("Text Editor");
label->SetBackgroundColor(Color::Create(181, 189, 200));
label->SetMargin(1);
label->setLabel("Text Editor");
label->setBackgroundColor(Color::Create(181, 189, 200));
label->setMargin(1);
auto textBox = TextBox::Create();
mTextBox = textBox.get();
auto saveButton = Button::Create();
saveButton->SetLabel("Save");
saveButton->SetBackgroundColor(Color::Create(200, 200, 200));
saveButton->SetMargin(2);
saveButton->setLabel("Save");
saveButton->setBackgroundColor(Color::Create(200, 200, 200));
saveButton->setMargin(2);
auto onSave = [this](Widget* self){
if(this && mController && mTextBox)
{
@ -36,12 +36,12 @@ void TextEditorView::Initialize()
mController->OnSave();
};
};
saveButton->SetOnClickFunction(onSave);
saveButton->setOnClickFunction(onSave);
auto clearButton = Button::Create();
clearButton->SetLabel("Clear");
clearButton->SetBackgroundColor(Color::Create(200, 200, 200));
clearButton->SetMargin(2);
clearButton->setLabel("Clear");
clearButton->setBackgroundColor(Color::Create(200, 200, 200));
clearButton->setMargin(2);
auto onClear = [this](Widget* self){
if(this && mController && mTextBox)
{
@ -49,12 +49,12 @@ void TextEditorView::Initialize()
mTextBox->SetContent("");
};
};
clearButton->SetOnClickFunction(onClear);
clearButton->setOnClickFunction(onClear);
auto loadButton = Button::Create();
loadButton->SetLabel("Load");
loadButton->SetBackgroundColor(Color::Create(200, 200, 200));
loadButton->SetMargin(2);
loadButton->setLabel("Load");
loadButton->setBackgroundColor(Color::Create(200, 200, 200));
loadButton->setMargin(2);
auto onLoad = [this](Widget* self){
if(this && mController && mTextBox)
{
@ -62,7 +62,7 @@ void TextEditorView::Initialize()
mTextBox->SetContent(mController->GetContent());
};
};
loadButton->SetOnClickFunction(onLoad);
loadButton->setOnClickFunction(onLoad);
auto buttonSpacer = VerticalSpacer::Create();
buttonSpacer->AddWidgetWithScale(std::move(saveButton), 1);
@ -70,11 +70,11 @@ void TextEditorView::Initialize()
buttonSpacer->AddWidgetWithScale(std::move(loadButton), 1);
auto hSpacer = HorizontalSpacer::Create();
hSpacer->AddWidgetWithScale(std::move(label), 1);
hSpacer->AddWidgetWithScale(std::move(textBox), 14);
hSpacer->AddWidgetWithScale(std::move(buttonSpacer), 1);
hSpacer->addWidgetWithScale(std::move(label), 1);
hSpacer->addWidgetWithScale(std::move(textBox), 14);
hSpacer->addWidgetWithScale(std::move(buttonSpacer), 1);
AddWidget(std::move(hSpacer));
addWidget(std::move(hSpacer));
}
std::unique_ptr<TextEditorView> TextEditorView::Create()

View file

@ -6,10 +6,10 @@
WebClientView::WebClientView()
{
auto label = Label::Create();
label->SetLabel("Web Client");
label->SetBackgroundColor(Color::Create(200, 189, 160));
label->SetMargin(1);
AddWidget(std::move(label));
label->setLabel("Web Client");
label->setBackgroundColor(Color::Create(200, 189, 160));
label->setMargin(1);
addWidget(std::move(label));
}
std::unique_ptr<WebClientView> WebClientView::Create()