wxScrolledWindow::Create( parent, id, pos, size,
style|wxHSCROLL|wxVSCROLL, name );
- // If the tree display has no buttons, but does have
- // connecting lines, we can use a narrower layout.
- // It may not be a good idea to force this...
+ // If the tree display has no buttons, but does have
+ // connecting lines, we can use a narrower layout.
+ // It may not be a good idea to force this...
if (!HasButtons() && !HasFlag(wxTR_NO_LINES))
{
m_indent= 10;
SetValidator( validator );
#endif
- SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ) );
+ SetForegroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT) );
+ SetBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX) );
// m_dottedPen = wxPen( "grey", 0, wxDOT ); too slow under XFree86
m_dottedPen = wxPen( wxT("grey"), 0, 0 );
if (attr && attr->HasTextColour())
colText = attr->GetTextColour();
else
- colText = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
+ colText = GetForegroundColour();
}
// prepare to draw
return wxTreeItemId();
}
- wxClientDC dc(this);
- PrepareDC(dc);
- wxCoord x = dc.DeviceToLogicalX( point.x );
- wxCoord y = dc.DeviceToLogicalY( point.y );
- wxGenericTreeItem *hit = m_anchor->HitTest(wxPoint(x, y),
- this,
- flags,
- 0 );
+ wxGenericTreeItem *hit = m_anchor->HitTest(CalcUnscrolledPosition(point),
+ this, flags, 0);
if (hit == NULL)
{
flags = wxTREE_HITTEST_NOWHERE;
if (m_dirty) wxYieldIfNeeded();
wxString s = m_currentEdit->GetText();
- int x = m_currentEdit->GetX();
- int y = m_currentEdit->GetY();
int w = m_currentEdit->GetWidth();
int h = m_currentEdit->GetHeight();
+ int x, y;
+ CalcScrolledPosition(m_currentEdit->GetX(), m_currentEdit->GetY(), &x, &y);
int image_h = 0;
int image_w = 0;
x += image_w;
w -= image_w + 4; // I don't know why +4 is needed
- wxClientDC dc(this);
- PrepareDC( dc );
- x = dc.LogicalToDeviceX( x );
- y = dc.LogicalToDeviceY( y );
-
wxTreeTextCtrl *text = new wxTreeTextCtrl(this, -1,
&m_renameAccept,
&m_renameRes,
return;
}
- wxClientDC dc(this);
- PrepareDC(dc);
- wxCoord x = dc.DeviceToLogicalX( event.GetX() );
- wxCoord y = dc.DeviceToLogicalY( event.GetY() );
+ wxPoint pt = CalcUnscrolledPosition(event.GetPosition());
int flags = 0;
- wxGenericTreeItem *item = m_anchor->HitTest( wxPoint(x,y),
- this,
- flags,
- 0 );
+ wxGenericTreeItem *item = m_anchor->HitTest(pt, this, flags, 0);
if ( event.Dragging() && !m_isDragging )
{
if (m_dragCount == 0)
- m_dragStart = wxPoint(x,y);
+ m_dragStart = pt;
m_dragCount++;
wxTreeEvent event(wxEVT_COMMAND_TREE_END_DRAG, GetId());
event.m_item = (long) item;
- event.m_pointDrag = wxPoint(x, y);
+ event.m_pointDrag = pt;
event.SetEventObject(this);
(void)GetEventHandler()->ProcessEvent(event);
{
wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, GetId());
nevent.m_item = (long) item;
- CalcScrolledPosition(x, y,
- &nevent.m_pointDrag.x,
- &nevent.m_pointDrag.y);
+ nevent.m_pointDrag = CalcScrolledPosition(pt);
nevent.SetEventObject(this);
GetEventHandler()->ProcessEvent(nevent);
}
// send activate event first
wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
nevent.m_item = (long) item;
- CalcScrolledPosition(x, y,
- &nevent.m_pointDrag.x,
- &nevent.m_pointDrag.y);
+ nevent.m_pointDrag = CalcScrolledPosition(pt);
nevent.SetEventObject( this );
if ( !GetEventHandler()->ProcessEvent( nevent ) )
{
wxCoord text_w = 0;
wxCoord text_h = 0;
- if (item->IsBold())
+ wxTreeItemAttr *attr = item->GetAttributes();
+ if ( attr && attr->HasFont() )
+ dc.SetFont(attr->GetFont());
+ else if ( item->IsBold() )
dc.SetFont(m_boldFont);
dc.GetTextExtent( item->GetText(), &text_w, &text_h );
{
if (m_dirty) return;
- wxClientDC dc(this);
- PrepareDC(dc);
-
- int cw = 0;
- int ch = 0;
- GetClientSize( &cw, &ch );
+ wxSize client = GetClientSize();
wxRect rect;
- rect.x = dc.LogicalToDeviceX( 0 );
- rect.width = cw;
- rect.y = dc.LogicalToDeviceY( item->GetY() );
- rect.height = ch;
+ CalcScrolledPosition(0, item->GetY(), &rect.x, &rect.y);
+ rect.width = client.x;
+ rect.height = client.y;
- Refresh( TRUE, &rect );
+ Refresh(TRUE, &rect);
AdjustMyScrollbars();
}
{
if (m_dirty) return;
- wxClientDC dc(this);
- PrepareDC( dc );
-
- int cw = 0;
- int ch = 0;
- GetClientSize( &cw, &ch );
-
wxRect rect;
- rect.x = dc.LogicalToDeviceX( 0 );
- rect.y = dc.LogicalToDeviceY( item->GetY() );
- rect.width = cw;
+ CalcScrolledPosition(0, item->GetY(), &rect.x, &rect.y);
+ rect.width = GetClientSize().x;
rect.height = GetLineHeight(item); //dc.GetCharHeight() + 6;
- Refresh( TRUE, &rect );
+ Refresh(TRUE, &rect);
}
void wxGenericTreeCtrl::RefreshSelected()