use GetBoundingRect() for the in place text control positioning instead of duplicating its code (see #9591)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
136b7e61f5
commit
ce43f9e115
@ -429,45 +429,32 @@ wxTreeTextCtrl::wxTreeTextCtrl(wxGenericTreeCtrl *owner,
|
|||||||
m_owner = owner;
|
m_owner = owner;
|
||||||
m_aboutToFinish = false;
|
m_aboutToFinish = false;
|
||||||
|
|
||||||
int w = m_itemEdited->GetWidth(),
|
wxRect rect;
|
||||||
h = m_itemEdited->GetHeight();
|
m_owner->GetBoundingRect(m_itemEdited, rect, true);
|
||||||
|
|
||||||
int x, y;
|
// corrects possition and size for better apperance
|
||||||
m_owner->CalcScrolledPosition(item->GetX(), item->GetY(), &x, &y);
|
#ifdef __WXMSW__
|
||||||
|
rect.x -= 5;
|
||||||
int image_h = 0,
|
rect.width += 10;
|
||||||
image_w = 0;
|
#elif __WXGTK__
|
||||||
|
rect.x -= 5;
|
||||||
int image = item->GetCurrentImage();
|
rect.y -= 2;
|
||||||
if ( image != NO_IMAGE )
|
rect.width += 8;
|
||||||
{
|
rect.height += 4;
|
||||||
if ( m_owner->m_imageListNormal )
|
#elif __WXMAC__
|
||||||
{
|
wxSize bs = DoGetBestSize();
|
||||||
m_owner->m_imageListNormal->GetSize( image, image_w, image_h );
|
|
||||||
image_w += MARGIN_BETWEEN_IMAGE_AND_TEXT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxFAIL_MSG(_T("you must create an image list to use images!"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: what are all these hardcoded 4, 8 and 11s really?
|
|
||||||
x += image_w;
|
|
||||||
w -= image_w + 4;
|
|
||||||
#ifdef __WXMAC__
|
|
||||||
wxSize bs = DoGetBestSize() ;
|
|
||||||
// edit control height
|
// edit control height
|
||||||
if ( h > bs.y - 8 )
|
if ( rect.height > bs.y - 8 )
|
||||||
{
|
int diff = rect.height - ( bs.y - 8 );
|
||||||
int diff = h - ( bs.y - 8 ) ;
|
rect.height -= diff;
|
||||||
h -= diff ;
|
rect.y += diff / 2;
|
||||||
y += diff / 2 ;
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
(void)Create(m_owner, wxID_ANY, m_startValue,
|
(void)Create(m_owner, wxID_ANY, m_startValue,
|
||||||
wxPoint(x - 4, y - 4), wxSize(w + 11, h + 8));
|
rect.GetPosition(), rect.GetSize());
|
||||||
|
|
||||||
|
SetSelection(-1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTreeTextCtrl::EndEdit(bool discardChanges)
|
void wxTreeTextCtrl::EndEdit(bool discardChanges)
|
||||||
|
Loading…
Reference in New Issue
Block a user