Custom controls : The width for full_width fields is updated according to the custom control width
(thanks to the @supermerill for the mention on it, 6acf6bdf21
)
+ Deleted redundant background color, as mentioned in the #5062
This commit is contained in:
parent
28b4ad92ea
commit
4eded76136
@ -205,12 +205,6 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
|
||||
|
||||
void OG_CustomCtrl::OnPaint(wxPaintEvent&)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
#else
|
||||
SetBackgroundColour(GetParent()->GetBackgroundColour());
|
||||
#endif // _WIN32
|
||||
|
||||
// case, when custom controll is destroyed but doesn't deleted from the evet loop
|
||||
if(!this->opt_group->custom_ctrl)
|
||||
return;
|
||||
@ -424,12 +418,6 @@ void OG_CustomCtrl::CtrlLine::msw_rescale()
|
||||
wxSize label_sz = ctrl->GetTextExtent(og_line.label);
|
||||
height = label_sz.y * (label_sz.GetWidth() > int(ctrl->opt_group->label_width * ctrl->m_em_unit) ? 2 : 1) + ctrl->m_v_gap;
|
||||
}
|
||||
|
||||
if (og_line.get_options().front().opt.full_width) {
|
||||
Field* field = ctrl->opt_group->get_field(og_line.get_options().front().opt_id);
|
||||
if (field->getWindow())
|
||||
field->getWindow()->SetSize(wxSize(3 * Field::def_width_wider() * ctrl->m_em_unit, -1));
|
||||
}
|
||||
|
||||
correct_items_positions();
|
||||
}
|
||||
@ -509,7 +497,10 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos)
|
||||
option_set.front().side_widget == nullptr && og_line.get_extra_widgets().size() == 0)
|
||||
{
|
||||
if (field && field->undo_to_sys_bitmap())
|
||||
draw_act_bmps(dc, wxPoint(h_pos, v_pos), field->undo_to_sys_bitmap()->bmp(), field->undo_bitmap()->bmp(), field->blink());
|
||||
h_pos = draw_act_bmps(dc, wxPoint(h_pos, v_pos), field->undo_to_sys_bitmap()->bmp(), field->undo_bitmap()->bmp(), field->blink()) + ctrl->m_h_gap;
|
||||
// update width for full_width fields
|
||||
if (option_set.front().opt.full_width && field->getWindow())
|
||||
field->getWindow()->SetSize(ctrl->GetSize().x - h_pos, -1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -296,11 +296,7 @@ void OptionsGroup::activate_line(Line& line)
|
||||
const auto& option = option_set.front();
|
||||
const auto& field = build_field(option);
|
||||
|
||||
if (custom_ctrl) {
|
||||
if (is_window_field(field) && option.opt.full_width)
|
||||
field->getWindow()->SetSize(wxSize(3 * Field::def_width_wider() * wxGetApp().em_unit(), -1));
|
||||
}
|
||||
else {
|
||||
if (!custom_ctrl) {
|
||||
if (is_window_field(field))
|
||||
sizer->Add(field->getWindow(), option.opt.full_width ? 1 : 0,
|
||||
wxBOTTOM | wxTOP | (option.opt.full_width ? wxEXPAND : wxALIGN_CENTER_VERTICAL), (wxOSX || !staticbox) ? 0 : 2);
|
||||
|
Loading…
Reference in New Issue
Block a user