stuff-from-scratch/src/ui/client/TopBar.cpp
2023-01-18 11:17:41 +00:00

39 lines
858 B
C++

#include "TopBar.h"
#include "Color.h"
#include "ITheme.h"
#include "Button.h"
#include "TopBarMenu.h"
TopBar::TopBar()
{
setBackground(Theme::Sys::Color::Secondary);
auto fileButton = Button::Create();
fileButton->setLabel("File");
fileButton->setBackground(Theme::Sys::Color::Primary);
fileButton->setMargin(2);
fileButton->setMaxWidth(60);
auto onClick = [this](Widget* self){
if(this)
{
auto menu = std::make_unique<TopBarMenu>();
auto window = getTopLevelWindow();
window->addPopup(std::move(menu));
};
};
fileButton->setOnClickFunction(onClick);
addWidget(std::move(fileButton));
}
TopBar::~TopBar()
{
}
std::unique_ptr<TopBar> TopBar::Create()
{
return std::make_unique<TopBar>();
}