diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-02-16 11:42:35 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-02-16 17:58:30 +0100 |
commit | 1607033e581ee1fc4aab5564cbf8fa89d7094ec7 (patch) | |
tree | 88695a26b9da00e466c46b5dfa4f4dd15a3f7d35 /dbaccess/source/ui/querydesign | |
parent | 2c8ffa41ec8e1ab2af95d5e033a445c17d29cf5a (diff) |
convert m_aTypeImage to weld::Image and move inside OTableWindowTitle
Change-Id: Ib3370a2a44761b2f4f5c6d0ade86d2f640c9fc48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110989
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source/ui/querydesign')
-rw-r--r-- | dbaccess/source/ui/querydesign/TableWindow.cxx | 28 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/TableWindowTitle.cxx | 2 |
2 files changed, 8 insertions, 22 deletions
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx index db0119ce89da..8a523b467e5f 100644 --- a/dbaccess/source/ui/querydesign/TableWindow.cxx +++ b/dbaccess/source/ui/querydesign/TableWindow.cxx @@ -89,7 +89,6 @@ void Draw3DBorder(vcl::RenderContext& rRenderContext, const tools::Rectangle& rR OTableWindow::OTableWindow( vcl::Window* pParent, const TTableWindowData::value_type& pTabWinData ) : ::comphelper::OContainerListener(m_aMutex) , Window( pParent, WB_3DLOOK|WB_MOVEABLE ) - , m_aTypeImage( VclPtr<FixedImage>::Create(this) ) , m_xTitle( VclPtr<OTableWindowTitle>::Create(this) ) , m_pData( pTabWinData ) , m_nMoveCount(0) @@ -128,7 +127,6 @@ void OTableWindow::dispose() if ( m_pContainerListener.is() ) m_pContainerListener->dispose(); - m_aTypeImage.disposeAndClear(); m_xTitle.disposeAndClear(); vcl::Window::dispose(); } @@ -267,19 +265,10 @@ void OTableWindow::clearListBox() void OTableWindow::impl_updateImage() { + weld::Image& rImage = m_xTitle->GetImage(); ImageProvider aImageProvider( getDesignView()->getController().getConnection() ); - - Image aImage; - aImageProvider.getImages( GetComposedName(), m_pData->isQuery() ? DatabaseObject::QUERY : DatabaseObject::TABLE, aImage ); - - if ( !aImage ) - { - OSL_FAIL( "OTableWindow::impl_updateImage: no images!" ); - return; - } - - m_aTypeImage->SetModeImage( aImage ); - m_aTypeImage->Show(); + rImage.set_from_icon_name(aImageProvider.getImageId(GetComposedName(), m_pData->isQuery() ? DatabaseObject::QUERY : DatabaseObject::TABLE)); + rImage.show(); } bool OTableWindow::Init() @@ -437,15 +426,10 @@ void OTableWindow::Resize() tools::Long nPositionX = n5Pos; tools::Long nPositionY = n5Pos; - // position the image which indicates the type - m_aTypeImage->SetPosPixel( Point( nPositionX, nPositionY ) ); - Size aImageSize( m_aTypeImage->GetImage().GetSizePixel() ); - m_aTypeImage->SetSizePixel( aImageSize ); - - if ( nTitleHeight < aImageSize.Height() ) - nTitleHeight = aImageSize.Height(); + Size aPreferredSize = m_xTitle->get_preferred_size(); + if (nTitleHeight < aPreferredSize.Height()) + nTitleHeight = aPreferredSize.Height(); - nPositionX += aImageSize.Width() + CalcZoom( 2 ); m_xTitle->SetPosSizePixel( Point( nPositionX, nPositionY ), Size( aOutSize.Width() - nPositionX - n5Pos, nTitleHeight ) ); tools::Long nTitleToList = CalcZoom( 3 ); diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx index a2a569fc8679..3d625b8bb777 100644 --- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx @@ -35,6 +35,7 @@ OTableWindowTitle::OTableWindowTitle(OTableWindow* pParent) : InterimItemWindow(pParent, "dbaccess/ui/tabletitle.ui", "TableTitle") , m_pTabWin( pParent ) , m_xLabel(m_xBuilder->weld_label("label")) + , m_xImage(m_xBuilder->weld_image("image")) { m_xLabel->connect_mouse_press(LINK(this, OTableWindowTitle, MousePressHdl)); } @@ -46,6 +47,7 @@ OTableWindowTitle::~OTableWindowTitle() void OTableWindowTitle::dispose() { + m_xImage.reset(); m_xLabel.reset(); m_pTabWin.clear(); InterimItemWindow::dispose(); |