use Calc(Un)ScrolledPosition instead of wxClientDC
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14658 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2917,14 +2917,10 @@ void wxListMainWindow::EditLabel( long item )
|
|||||||
if (m_dirty)
|
if (m_dirty)
|
||||||
wxSafeYield();
|
wxSafeYield();
|
||||||
|
|
||||||
wxClientDC dc(this);
|
|
||||||
PrepareDC( dc );
|
|
||||||
|
|
||||||
wxString s = data->GetText(0);
|
wxString s = data->GetText(0);
|
||||||
wxRect rectLabel = GetLineLabelRect(m_currentEdit);
|
wxRect rectLabel = GetLineLabelRect(m_currentEdit);
|
||||||
|
|
||||||
rectLabel.x = dc.LogicalToDeviceX( rectLabel.x );
|
CalcScrolledPosition(rectLabel.x, rectLabel.y, &rectLabel.x, &rectLabel.y);
|
||||||
rectLabel.y = dc.LogicalToDeviceY( rectLabel.y );
|
|
||||||
|
|
||||||
wxListTextCtrl *text = new wxListTextCtrl
|
wxListTextCtrl *text = new wxListTextCtrl
|
||||||
(
|
(
|
||||||
|
@@ -2543,14 +2543,8 @@ wxTreeItemId wxGenericTreeCtrl::HitTest(const wxPoint& point, int& flags)
|
|||||||
return wxTreeItemId();
|
return wxTreeItemId();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxClientDC dc(this);
|
wxGenericTreeItem *hit = m_anchor->HitTest(CalcUnscrolledPosition(point),
|
||||||
PrepareDC(dc);
|
this, flags, 0);
|
||||||
wxCoord x = dc.DeviceToLogicalX( point.x );
|
|
||||||
wxCoord y = dc.DeviceToLogicalY( point.y );
|
|
||||||
wxGenericTreeItem *hit = m_anchor->HitTest(wxPoint(x, y),
|
|
||||||
this,
|
|
||||||
flags,
|
|
||||||
0 );
|
|
||||||
if (hit == NULL)
|
if (hit == NULL)
|
||||||
{
|
{
|
||||||
flags = wxTREE_HITTEST_NOWHERE;
|
flags = wxTREE_HITTEST_NOWHERE;
|
||||||
@@ -2601,10 +2595,10 @@ void wxGenericTreeCtrl::Edit( const wxTreeItemId& item )
|
|||||||
if (m_dirty) wxYieldIfNeeded();
|
if (m_dirty) wxYieldIfNeeded();
|
||||||
|
|
||||||
wxString s = m_currentEdit->GetText();
|
wxString s = m_currentEdit->GetText();
|
||||||
int x = m_currentEdit->GetX();
|
|
||||||
int y = m_currentEdit->GetY();
|
|
||||||
int w = m_currentEdit->GetWidth();
|
int w = m_currentEdit->GetWidth();
|
||||||
int h = m_currentEdit->GetHeight();
|
int h = m_currentEdit->GetHeight();
|
||||||
|
int x, y;
|
||||||
|
CalcScrolledPosition(m_currentEdit->GetX(), m_currentEdit->GetY(), &x, &y);
|
||||||
|
|
||||||
int image_h = 0;
|
int image_h = 0;
|
||||||
int image_w = 0;
|
int image_w = 0;
|
||||||
@@ -2625,11 +2619,6 @@ void wxGenericTreeCtrl::Edit( const wxTreeItemId& item )
|
|||||||
x += image_w;
|
x += image_w;
|
||||||
w -= image_w + 4; // I don't know why +4 is needed
|
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,
|
wxTreeTextCtrl *text = new wxTreeTextCtrl(this, -1,
|
||||||
&m_renameAccept,
|
&m_renameAccept,
|
||||||
&m_renameRes,
|
&m_renameRes,
|
||||||
@@ -2678,21 +2667,15 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxClientDC dc(this);
|
wxPoint pt = CalcUnscrolledPosition(event.GetPosition());
|
||||||
PrepareDC(dc);
|
|
||||||
wxCoord x = dc.DeviceToLogicalX( event.GetX() );
|
|
||||||
wxCoord y = dc.DeviceToLogicalY( event.GetY() );
|
|
||||||
|
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
wxGenericTreeItem *item = m_anchor->HitTest( wxPoint(x,y),
|
wxGenericTreeItem *item = m_anchor->HitTest(pt, this, flags, 0);
|
||||||
this,
|
|
||||||
flags,
|
|
||||||
0 );
|
|
||||||
|
|
||||||
if ( event.Dragging() && !m_isDragging )
|
if ( event.Dragging() && !m_isDragging )
|
||||||
{
|
{
|
||||||
if (m_dragCount == 0)
|
if (m_dragCount == 0)
|
||||||
m_dragStart = wxPoint(x,y);
|
m_dragStart = pt;
|
||||||
|
|
||||||
m_dragCount++;
|
m_dragCount++;
|
||||||
|
|
||||||
@@ -2769,7 +2752,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
|
|||||||
wxTreeEvent event(wxEVT_COMMAND_TREE_END_DRAG, GetId());
|
wxTreeEvent event(wxEVT_COMMAND_TREE_END_DRAG, GetId());
|
||||||
|
|
||||||
event.m_item = (long) item;
|
event.m_item = (long) item;
|
||||||
event.m_pointDrag = wxPoint(x, y);
|
event.m_pointDrag = pt;
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
(void)GetEventHandler()->ProcessEvent(event);
|
(void)GetEventHandler()->ProcessEvent(event);
|
||||||
@@ -2795,9 +2778,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
|
|||||||
{
|
{
|
||||||
wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, GetId());
|
wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, GetId());
|
||||||
nevent.m_item = (long) item;
|
nevent.m_item = (long) item;
|
||||||
CalcScrolledPosition(x, y,
|
nevent.m_pointDrag = CalcScrolledPosition(pt);
|
||||||
&nevent.m_pointDrag.x,
|
|
||||||
&nevent.m_pointDrag.y);
|
|
||||||
nevent.SetEventObject(this);
|
nevent.SetEventObject(this);
|
||||||
GetEventHandler()->ProcessEvent(nevent);
|
GetEventHandler()->ProcessEvent(nevent);
|
||||||
}
|
}
|
||||||
@@ -2858,9 +2839,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
|
|||||||
// send activate event first
|
// send activate event first
|
||||||
wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
|
wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
|
||||||
nevent.m_item = (long) item;
|
nevent.m_item = (long) item;
|
||||||
CalcScrolledPosition(x, y,
|
nevent.m_pointDrag = CalcScrolledPosition(pt);
|
||||||
&nevent.m_pointDrag.x,
|
|
||||||
&nevent.m_pointDrag.y);
|
|
||||||
nevent.SetEventObject( this );
|
nevent.SetEventObject( this );
|
||||||
if ( !GetEventHandler()->ProcessEvent( nevent ) )
|
if ( !GetEventHandler()->ProcessEvent( nevent ) )
|
||||||
{
|
{
|
||||||
@@ -2993,16 +2972,12 @@ void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item)
|
|||||||
{
|
{
|
||||||
if (m_dirty) return;
|
if (m_dirty) return;
|
||||||
|
|
||||||
wxClientDC dc(this);
|
wxSize client = GetClientSize();
|
||||||
PrepareDC(dc);
|
|
||||||
|
|
||||||
wxRect client = GetClientRect();
|
|
||||||
|
|
||||||
wxRect rect;
|
wxRect rect;
|
||||||
rect.x = dc.LogicalToDeviceX(-client.x);
|
CalcScrolledPosition(0, item->GetY(), &rect.x, &rect.y);
|
||||||
rect.width = client.width;
|
rect.width = client.x;
|
||||||
rect.y = dc.LogicalToDeviceY(-client.y + item->GetY());
|
rect.height = client.y;
|
||||||
rect.height = client.height;
|
|
||||||
|
|
||||||
Refresh(TRUE, &rect);
|
Refresh(TRUE, &rect);
|
||||||
|
|
||||||
@@ -3013,15 +2988,9 @@ void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item )
|
|||||||
{
|
{
|
||||||
if (m_dirty) return;
|
if (m_dirty) return;
|
||||||
|
|
||||||
wxClientDC dc(this);
|
|
||||||
PrepareDC(dc);
|
|
||||||
|
|
||||||
wxRect client = GetClientRect();
|
|
||||||
|
|
||||||
wxRect rect;
|
wxRect rect;
|
||||||
rect.x = dc.LogicalToDeviceX(-client.x);
|
CalcScrolledPosition(0, item->GetY(), &rect.x, &rect.y);
|
||||||
rect.y = dc.LogicalToDeviceY(-client.y + item->GetY());
|
rect.width = GetClientSize().x;
|
||||||
rect.width = client.width;
|
|
||||||
rect.height = GetLineHeight(item); //dc.GetCharHeight() + 6;
|
rect.height = GetLineHeight(item); //dc.GetCharHeight() + 6;
|
||||||
|
|
||||||
Refresh(TRUE, &rect);
|
Refresh(TRUE, &rect);
|
||||||
|
Reference in New Issue
Block a user