Move windows to uptr. Add simple text editing.
This commit is contained in:
parent
2bcc7b3d83
commit
b99708e7d3
55 changed files with 1257 additions and 994 deletions
|
@ -1,8 +1,8 @@
|
|||
#include "GuiApplication.h"
|
||||
|
||||
#include <iostream>
|
||||
#include "Widget.h"
|
||||
#include "HorizontalSpacer.h"
|
||||
#include "TextBox.h"
|
||||
#include "Button.h"
|
||||
#include "Label.h"
|
||||
#include "XcbInterface.h"
|
||||
|
@ -12,11 +12,11 @@
|
|||
#include "WindowManager.h"
|
||||
|
||||
GuiApplication::GuiApplication()
|
||||
: AbstractDesktopApp(),
|
||||
mMainApplication(),
|
||||
mDesktopManager()
|
||||
: AbstractDesktopApp(),
|
||||
mMainApplication(),
|
||||
mDesktopManager(DesktopManager::Create())
|
||||
{
|
||||
mDesktopManager = DesktopManager::Create();
|
||||
|
||||
}
|
||||
|
||||
GuiApplication::~GuiApplication()
|
||||
|
@ -26,45 +26,46 @@ GuiApplication::~GuiApplication()
|
|||
|
||||
void GuiApplication::SetMainApplication(MainApplicationPtr app)
|
||||
{
|
||||
mMainApplication = app;
|
||||
//mDesktopManager->SetMainApp(shared_from_this());
|
||||
mMainApplication = app;
|
||||
}
|
||||
|
||||
void GuiApplication::Run()
|
||||
{
|
||||
auto mainWindow = mDesktopManager->GetWindowManager()->GetMainWindow();
|
||||
auto mainWindow = mDesktopManager->GetWindowManager()->GetMainWindow();
|
||||
|
||||
mainWindow->SetSize(800, 600);
|
||||
mainWindow->SetSize(800, 600);
|
||||
|
||||
auto label = Label::Create();
|
||||
label->SetLabel("Click the button!!");
|
||||
label->SetBackgroundColor(Color::Create(0, 200, 200));
|
||||
auto label = Label::Create();
|
||||
label->SetLabel("Type text!!");
|
||||
label->SetBackgroundColor(Color::Create(0, 200, 200));
|
||||
|
||||
auto button = Button::Create();
|
||||
button->SetLabel("Ok");
|
||||
button->SetBackgroundColor(Color::Create(0, 0, 200));
|
||||
auto textBox = TextBox::Create();
|
||||
|
||||
auto spacer = HorizontalSpacer::Create();
|
||||
spacer->AddWidget(label);
|
||||
spacer->AddWidget(button);
|
||||
auto button = Button::Create();
|
||||
button->SetLabel("Save");
|
||||
button->SetBackgroundColor(Color::Create(0, 0, 200));
|
||||
|
||||
mainWindow->AddWidget(spacer);
|
||||
auto spacer = HorizontalSpacer::Create();
|
||||
spacer->AddWidget(std::move(label));
|
||||
spacer->AddWidget(std::move(textBox));
|
||||
spacer->AddWidget(std::move(button));
|
||||
|
||||
mDesktopManager->SetKeyboard(XcbKeyboard::Create());
|
||||
mainWindow->AddWidget(std::move(spacer));
|
||||
mDesktopManager->SetKeyboard(XcbKeyboard::Create());
|
||||
|
||||
bool useOpenGl = false;
|
||||
XcbInterface window_interface;
|
||||
window_interface.SetUseOpenGl(useOpenGl);
|
||||
window_interface.Initialize();
|
||||
window_interface.AddWindow(mainWindow);
|
||||
window_interface.ShowWindow(mainWindow);
|
||||
if(useOpenGl)
|
||||
{
|
||||
window_interface.CreateOpenGlDrawable(mainWindow);
|
||||
}
|
||||
bool useOpenGl = false;
|
||||
XcbInterface window_interface;
|
||||
window_interface.SetUseOpenGl(useOpenGl);
|
||||
window_interface.Initialize();
|
||||
window_interface.AddWindow(mainWindow);
|
||||
window_interface.ShowWindow(mainWindow);
|
||||
if(useOpenGl)
|
||||
{
|
||||
window_interface.CreateOpenGlDrawable(mainWindow);
|
||||
}
|
||||
|
||||
window_interface.Loop(mDesktopManager);
|
||||
window_interface.Loop(mDesktopManager.get());
|
||||
|
||||
window_interface.ShutDown();
|
||||
window_interface.ShutDown();
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue