Add some initial widget functionality (prefs partly working)

This commit is contained in:
elasota
2020-01-01 20:24:46 -05:00
parent d9b5dd20d6
commit 5fe6218c28
85 changed files with 2131 additions and 1074 deletions

View File

@@ -0,0 +1,32 @@
#include "PLLabelWidget.h"
#include "PLQDraw.h"
#include "FontFamily.h"
#include "PLStandardColors.h"
#include <algorithm>
namespace PortabilityLayer
{
LabelWidget::LabelWidget(const WidgetBasicState &state)
: WidgetSpec<LabelWidget>(state)
, m_text(state.m_text)
{
}
bool LabelWidget::Init(const WidgetBasicState &state)
{
(void)state;
return true;
}
void LabelWidget::DrawControl(DrawSurface *surface)
{
surface->SetSystemFont(12, PortabilityLayer::FontFamilyFlag_Bold);
surface->SetForeColor(StdColors::Black());
const Point topLeftCorner = Point::Create(m_rect.left, m_rect.top);
const Point textStartPoint = topLeftCorner + Point::Create(0, surface->MeasureFontAscender());
surface->DrawString(textStartPoint, m_text.ToShortStr());
}
}