mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 02:07:54 -06:00
fix sidelable font
This commit is contained in:
parent
53688791af
commit
ff7fb51f41
1 changed files with 11 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include "TextInput.hpp"
|
#include "TextInput.hpp"
|
||||||
#include "Label.hpp"
|
#include "Label.hpp"
|
||||||
#include "TextCtrl.h"
|
#include "TextCtrl.h"
|
||||||
|
#include "slic3r/GUI/Widgets/Label.hpp"
|
||||||
|
|
||||||
#include <wx/dcgraph.h>
|
#include <wx/dcgraph.h>
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ void TextInput::Create(wxWindow * parent,
|
||||||
const wxSize & size,
|
const wxSize & size,
|
||||||
long style)
|
long style)
|
||||||
{
|
{
|
||||||
text_ctrl = nullptr;
|
text_ctrl = nullptr;
|
||||||
StaticBox::Create(parent, wxID_ANY, pos, size, style);
|
StaticBox::Create(parent, wxID_ANY, pos, size, style);
|
||||||
wxWindow::SetLabel(label);
|
wxWindow::SetLabel(label);
|
||||||
style &= ~wxRIGHT;
|
style &= ~wxRIGHT;
|
||||||
|
@ -209,7 +210,10 @@ void TextInput::render(wxDC& dc)
|
||||||
pt.y = (size.y + textSize.y) / 2 - labelSize.y;
|
pt.y = (size.y + textSize.y) / 2 - labelSize.y;
|
||||||
}
|
}
|
||||||
dc.SetTextForeground(label_color.colorForStates(states));
|
dc.SetTextForeground(label_color.colorForStates(states));
|
||||||
dc.SetFont(GetFont());
|
if(align_right)
|
||||||
|
dc.SetFont(GetFont());
|
||||||
|
else
|
||||||
|
dc.SetFont(Label::Body_12);
|
||||||
dc.DrawText(text, pt);
|
dc.DrawText(text, pt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,6 +222,11 @@ void TextInput::messureSize()
|
||||||
{
|
{
|
||||||
wxSize size = GetSize();
|
wxSize size = GetSize();
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
|
bool align_right = GetWindowStyle() & wxRIGHT;
|
||||||
|
if (align_right)
|
||||||
|
dc.SetFont(GetFont());
|
||||||
|
else
|
||||||
|
dc.SetFont(Label::Body_12);
|
||||||
labelSize = dc.GetTextExtent(wxWindow::GetLabel());
|
labelSize = dc.GetTextExtent(wxWindow::GetLabel());
|
||||||
wxSize textSize = text_ctrl->GetSize();
|
wxSize textSize = text_ctrl->GetSize();
|
||||||
int h = textSize.y + 8;
|
int h = textSize.y + 8;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue