summaryrefslogtreecommitdiff
path: root/vcl/source/window/layout.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-04 00:04:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-04 01:41:02 +0200
commitce47b1a9c68a27fc37594148f6be2661f27120ea (patch)
tree4c9b5c3da29b76c7c8eb23cdbf85c496b0efd87e /vcl/source/window/layout.cxx
parent6fc2a300ad8b1c6936b513eff94fd527ea74b469 (diff)
loplugin:flatten in vcl/window
Change-Id: I94e69e988f038e85b1fb78985211d478bb5ed9b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100033 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/window/layout.cxx')
-rw-r--r--vcl/source/window/layout.cxx240
1 files changed, 120 insertions, 120 deletions
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index f7e4a8b45324..30168a47a3f3 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -2049,19 +2049,19 @@ void VclScrolledWindow::Paint(vcl::RenderContext& rRenderContext, const tools::R
void VclViewport::setAllocation(const Size &rAllocation)
{
vcl::Window *pChild = get_child();
- if (pChild && pChild->IsVisible())
+ if (!(pChild && pChild->IsVisible()))
+ return;
+
+ Size aReq(getLayoutRequisition(*pChild));
+ aReq.setWidth( std::max(aReq.Width(), rAllocation.Width()) );
+ aReq.setHeight( std::max(aReq.Height(), rAllocation.Height()) );
+ Point aKeepPos(pChild->GetPosPixel());
+ if (m_bInitialAllocation)
{
- Size aReq(getLayoutRequisition(*pChild));
- aReq.setWidth( std::max(aReq.Width(), rAllocation.Width()) );
- aReq.setHeight( std::max(aReq.Height(), rAllocation.Height()) );
- Point aKeepPos(pChild->GetPosPixel());
- if (m_bInitialAllocation)
- {
- aKeepPos = Point(0, 0);
- m_bInitialAllocation = false;
- }
- setLayoutAllocation(*pChild, aKeepPos, aReq);
+ aKeepPos = Point(0, 0);
+ m_bInitialAllocation = false;
}
+ setLayoutAllocation(*pChild, aKeepPos, aReq);
}
const vcl::Window *VclEventBox::get_child() const
@@ -2181,126 +2181,126 @@ void MessageDialog::create_message_area()
{
setDeferredProperties();
- if (!m_pGrid)
- {
- VclContainer *pContainer = get_content_area();
- assert(pContainer);
+ if (m_pGrid)
+ return;
- m_pGrid.set( VclPtr<VclGrid>::Create(pContainer) );
- m_pGrid->reorderWithinParent(0);
- m_pGrid->set_column_spacing(12);
- m_pMessageBox.set(VclPtr<VclVBox>::Create(m_pGrid));
- m_pMessageBox->set_grid_left_attach(1);
- m_pMessageBox->set_grid_top_attach(0);
- m_pMessageBox->set_spacing(GetTextHeight());
+ VclContainer *pContainer = get_content_area();
+ assert(pContainer);
- m_pImage = VclPtr<FixedImage>::Create(m_pGrid, WB_CENTER | WB_VCENTER | WB_3DLOOK);
- switch (m_eMessageType)
- {
- case VclMessageType::Info:
- m_pImage->SetImage(GetStandardInfoBoxImage());
- break;
- case VclMessageType::Warning:
- m_pImage->SetImage(GetStandardWarningBoxImage());
- break;
- case VclMessageType::Question:
- m_pImage->SetImage(GetStandardQueryBoxImage());
- break;
- case VclMessageType::Error:
- m_pImage->SetImage(GetStandardErrorBoxImage());
- break;
- }
- m_pImage->set_grid_left_attach(0);
- m_pImage->set_grid_top_attach(0);
- m_pImage->set_valign(VclAlign::Start);
- m_pImage->Show();
+ m_pGrid.set( VclPtr<VclGrid>::Create(pContainer) );
+ m_pGrid->reorderWithinParent(0);
+ m_pGrid->set_column_spacing(12);
+ m_pMessageBox.set(VclPtr<VclVBox>::Create(m_pGrid));
+ m_pMessageBox->set_grid_left_attach(1);
+ m_pMessageBox->set_grid_top_attach(0);
+ m_pMessageBox->set_spacing(GetTextHeight());
+
+ m_pImage = VclPtr<FixedImage>::Create(m_pGrid, WB_CENTER | WB_VCENTER | WB_3DLOOK);
+ switch (m_eMessageType)
+ {
+ case VclMessageType::Info:
+ m_pImage->SetImage(GetStandardInfoBoxImage());
+ break;
+ case VclMessageType::Warning:
+ m_pImage->SetImage(GetStandardWarningBoxImage());
+ break;
+ case VclMessageType::Question:
+ m_pImage->SetImage(GetStandardQueryBoxImage());
+ break;
+ case VclMessageType::Error:
+ m_pImage->SetImage(GetStandardErrorBoxImage());
+ break;
+ }
+ m_pImage->set_grid_left_attach(0);
+ m_pImage->set_grid_top_attach(0);
+ m_pImage->set_valign(VclAlign::Start);
+ m_pImage->Show();
- WinBits nWinStyle = WB_CLIPCHILDREN | WB_LEFT | WB_VCENTER | WB_NOLABEL | WB_NOTABSTOP;
+ WinBits nWinStyle = WB_CLIPCHILDREN | WB_LEFT | WB_VCENTER | WB_NOLABEL | WB_NOTABSTOP;
- bool bHasSecondaryText = !m_sSecondaryString.isEmpty();
+ bool bHasSecondaryText = !m_sSecondaryString.isEmpty();
- m_pPrimaryMessage = VclPtr<VclMultiLineEdit>::Create(m_pMessageBox, nWinStyle);
- m_pPrimaryMessage->SetPaintTransparent(true);
- m_pPrimaryMessage->EnableCursor(false);
+ m_pPrimaryMessage = VclPtr<VclMultiLineEdit>::Create(m_pMessageBox, nWinStyle);
+ m_pPrimaryMessage->SetPaintTransparent(true);
+ m_pPrimaryMessage->EnableCursor(false);
- m_pPrimaryMessage->set_hexpand(true);
- m_pPrimaryMessage->SetText(m_sPrimaryString);
- m_pPrimaryMessage->Show(!m_sPrimaryString.isEmpty());
+ m_pPrimaryMessage->set_hexpand(true);
+ m_pPrimaryMessage->SetText(m_sPrimaryString);
+ m_pPrimaryMessage->Show(!m_sPrimaryString.isEmpty());
- m_pSecondaryMessage = VclPtr<VclMultiLineEdit>::Create(m_pMessageBox, nWinStyle);
- m_pSecondaryMessage->SetPaintTransparent(true);
- m_pSecondaryMessage->EnableCursor(false);
- m_pSecondaryMessage->set_hexpand(true);
- m_pSecondaryMessage->SetText(m_sSecondaryString);
- m_pSecondaryMessage->Show(bHasSecondaryText);
+ m_pSecondaryMessage = VclPtr<VclMultiLineEdit>::Create(m_pMessageBox, nWinStyle);
+ m_pSecondaryMessage->SetPaintTransparent(true);
+ m_pSecondaryMessage->EnableCursor(false);
+ m_pSecondaryMessage->set_hexpand(true);
+ m_pSecondaryMessage->SetText(m_sSecondaryString);
+ m_pSecondaryMessage->Show(bHasSecondaryText);
- MessageDialog::SetMessagesWidths(this, m_pPrimaryMessage, bHasSecondaryText ? m_pSecondaryMessage.get() : nullptr);
+ MessageDialog::SetMessagesWidths(this, m_pPrimaryMessage, bHasSecondaryText ? m_pSecondaryMessage.get() : nullptr);
- VclButtonBox *pButtonBox = get_action_area();
- assert(pButtonBox);
+ VclButtonBox *pButtonBox = get_action_area();
+ assert(pButtonBox);
- VclPtr<PushButton> pBtn;
- short nDefaultResponse = get_default_response();
- switch (m_eButtonsType)
- {
- case VclButtonsType::NONE:
- break;
- case VclButtonsType::Ok:
- pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
- pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
- pBtn->Show();
- pBtn->set_id("ok");
- add_button(pBtn, RET_OK, true);
- nDefaultResponse = RET_OK;
- break;
- case VclButtonsType::Close:
- pBtn.set( VclPtr<CloseButton>::Create(pButtonBox) );
- pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
- pBtn->Show();
- pBtn->set_id("close");
- add_button(pBtn, RET_CLOSE, true);
- nDefaultResponse = RET_CLOSE;
- break;
- case VclButtonsType::Cancel:
- pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
- pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
- pBtn->Show();
- pBtn->set_id("cancel");
- add_button(pBtn, RET_CANCEL, true);
- nDefaultResponse = RET_CANCEL;
- break;
- case VclButtonsType::YesNo:
- pBtn = VclPtr<PushButton>::Create(pButtonBox);
- pBtn->SetText(GetStandardText(StandardButtonType::Yes));
- pBtn->Show();
- pBtn->set_id("yes");
- add_button(pBtn, RET_YES, true);
-
- pBtn.set( VclPtr<PushButton>::Create(pButtonBox) );
- pBtn->SetText(GetStandardText(StandardButtonType::No));
- pBtn->Show();
- pBtn->set_id("no");
- add_button(pBtn, RET_NO, true);
- nDefaultResponse = RET_NO;
- break;
- case VclButtonsType::OkCancel:
- pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
- pBtn->Show();
- pBtn->set_id("ok");
- add_button(pBtn, RET_OK, true);
-
- pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
- pBtn->Show();
- pBtn->set_id("cancel");
- add_button(pBtn, RET_CANCEL, true);
- nDefaultResponse = RET_CANCEL;
- break;
- }
- set_default_response(nDefaultResponse);
- sort_native_button_order(*pButtonBox);
- m_pMessageBox->Show();
- m_pGrid->Show();
+ VclPtr<PushButton> pBtn;
+ short nDefaultResponse = get_default_response();
+ switch (m_eButtonsType)
+ {
+ case VclButtonsType::NONE:
+ break;
+ case VclButtonsType::Ok:
+ pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
+ pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
+ pBtn->Show();
+ pBtn->set_id("ok");
+ add_button(pBtn, RET_OK, true);
+ nDefaultResponse = RET_OK;
+ break;
+ case VclButtonsType::Close:
+ pBtn.set( VclPtr<CloseButton>::Create(pButtonBox) );
+ pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
+ pBtn->Show();
+ pBtn->set_id("close");
+ add_button(pBtn, RET_CLOSE, true);
+ nDefaultResponse = RET_CLOSE;
+ break;
+ case VclButtonsType::Cancel:
+ pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
+ pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
+ pBtn->Show();
+ pBtn->set_id("cancel");
+ add_button(pBtn, RET_CANCEL, true);
+ nDefaultResponse = RET_CANCEL;
+ break;
+ case VclButtonsType::YesNo:
+ pBtn = VclPtr<PushButton>::Create(pButtonBox);
+ pBtn->SetText(GetStandardText(StandardButtonType::Yes));
+ pBtn->Show();
+ pBtn->set_id("yes");
+ add_button(pBtn, RET_YES, true);
+
+ pBtn.set( VclPtr<PushButton>::Create(pButtonBox) );
+ pBtn->SetText(GetStandardText(StandardButtonType::No));
+ pBtn->Show();
+ pBtn->set_id("no");
+ add_button(pBtn, RET_NO, true);
+ nDefaultResponse = RET_NO;
+ break;
+ case VclButtonsType::OkCancel:
+ pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
+ pBtn->Show();
+ pBtn->set_id("ok");
+ add_button(pBtn, RET_OK, true);
+
+ pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
+ pBtn->Show();
+ pBtn->set_id("cancel");
+ add_button(pBtn, RET_CANCEL, true);
+ nDefaultResponse = RET_CANCEL;
+ break;
}
+ set_default_response(nDefaultResponse);
+ sort_native_button_order(*pButtonBox);
+ m_pMessageBox->Show();
+ m_pGrid->Show();
}
void MessageDialog::create_owned_areas()