static const int PIXELS_PER_UNIT = 10;
+// the margin between the item image and the item text
+static const int MARGIN_BETWEEN_IMAGE_AND_TEXT = 4;
+
// -----------------------------------------------------------------------------
// private classes
// -----------------------------------------------------------------------------
if ( m_owner->m_imageListNormal )
{
m_owner->m_imageListNormal->GetSize( image, image_w, image_h );
- image_w += 4;
+ image_w += MARGIN_BETWEEN_IMAGE_AND_TEXT;
}
else
{
if ( m_imageListNormal )
{
m_imageListNormal->GetSize( image, image_w, image_h );
- image_w += 4;
+ image_w += MARGIN_BETWEEN_IMAGE_AND_TEXT;
}
else
{
// get the bounding rectangle of the item (or of its label only)
bool wxGenericTreeCtrl::GetBoundingRect(const wxTreeItemId& item,
wxRect& rect,
- bool WXUNUSED(textOnly)) const
+ bool textOnly) const
{
wxCHECK_MSG( item.IsOk(), false, _T("invalid item in wxGenericTreeCtrl::GetBoundingRect") );
int startX, startY;
GetViewStart(& startX, & startY);
- rect.x = i->GetX() - startX*PIXELS_PER_UNIT;
+ if ( textOnly )
+ {
+ rect.x = i->GetX() - startX*PIXELS_PER_UNIT;
+ rect.width = i->GetWidth();
+
+ if ( m_imageListNormal )
+ {
+ int image_w, image_h;
+ m_imageListNormal->GetSize( 0, image_w, image_h );
+ rect.width += image_w + MARGIN_BETWEEN_IMAGE_AND_TEXT;
+ }
+ }
+ else // the entire line
+ {
+ rect.x = 0;
+ rect.width = GetClientSize().x;
+ }
+
rect.y = i->GetY() - startY*PIXELS_PER_UNIT;
- rect.width = i->GetWidth();
- //rect.height = i->GetHeight();
rect.height = GetLineHeight(i);
return true;
if ( m_imageListNormal )
{
m_imageListNormal->GetSize( image, image_w, image_h );
- image_w += 4;
+ image_w += MARGIN_BETWEEN_IMAGE_AND_TEXT;
}
}
}
-wxSize wxGenericTreeCtrl::DoGetBestSize() const
-{
- // something is better than nothing...
- // 100x80 is what the MSW version will get from the default
- // wxControl::DoGetBestSize
- return wxSize(100,80);
-}
-
-
// NOTE: If using the wxListBox visual attributes works everywhere then this can
// be removed, as well as the #else case below.
#define _USE_VISATTR 0