Add tabs to the launcher window
This commit is contained in:
parent
762ce6f14c
commit
a0f52411d3
13 changed files with 589 additions and 328 deletions
46
src/launcher/launcherbuttonbar.cpp
Normal file
46
src/launcher/launcherbuttonbar.cpp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
#include "launcherbuttonbar.h"
|
||||
#include "launcherwindow.h"
|
||||
#include "gstrings.h"
|
||||
#include <zwidget/widgets/pushbutton/pushbutton.h>
|
||||
|
||||
LauncherButtonbar::LauncherButtonbar(LauncherWindow* parent) : Widget(parent)
|
||||
{
|
||||
PlayButton = new PushButton(this);
|
||||
ExitButton = new PushButton(this);
|
||||
|
||||
PlayButton->OnClick = [=]() { OnPlayButtonClicked(); };
|
||||
ExitButton->OnClick = [=]() { OnExitButtonClicked(); };
|
||||
}
|
||||
|
||||
void LauncherButtonbar::UpdateLanguage()
|
||||
{
|
||||
PlayButton->SetText(GStrings("PICKER_PLAY"));
|
||||
ExitButton->SetText(GStrings("PICKER_EXIT"));
|
||||
}
|
||||
|
||||
double LauncherButtonbar::GetPreferredHeight() const
|
||||
{
|
||||
return 20.0 + std::max(PlayButton->GetPreferredHeight(), ExitButton->GetPreferredHeight());
|
||||
}
|
||||
|
||||
void LauncherButtonbar::OnGeometryChanged()
|
||||
{
|
||||
PlayButton->SetFrameGeometry(20.0, 10.0, 120.0, PlayButton->GetPreferredHeight());
|
||||
ExitButton->SetFrameGeometry(GetWidth() - 20.0 - 120.0, 10.0, 120.0, PlayButton->GetPreferredHeight());
|
||||
}
|
||||
|
||||
void LauncherButtonbar::OnPlayButtonClicked()
|
||||
{
|
||||
GetLauncher()->Start();
|
||||
}
|
||||
|
||||
void LauncherButtonbar::OnExitButtonClicked()
|
||||
{
|
||||
GetLauncher()->Exit();
|
||||
}
|
||||
|
||||
LauncherWindow* LauncherButtonbar::GetLauncher() const
|
||||
{
|
||||
return static_cast<LauncherWindow*>(Parent());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue