void wxGenericDragImage::Init()
{
- m_isDirty = FALSE;
- m_isShown = FALSE;
+ m_isDirty = false;
+ m_isShown = false;
m_windowDC = (wxDC*) NULL;
m_window = (wxWindow*) NULL;
- m_fullScreen = FALSE;
+ m_fullScreen = false;
m_pBackingBitmap = (wxBitmap*) NULL;
}
{
m_cursor = cursor;
- return TRUE;
+ return true;
}
// Create a drag image from a bitmap and optional cursor
m_cursor = cursor;
m_bitmap = image;
- return TRUE ;
+ return true ;
}
// Create a drag image from an icon and optional cursor
m_cursor = cursor;
m_icon = image;
- return TRUE ;
+ return true ;
}
// Create a drag image from a string and optional cursor
if (rect)
m_boundingRect = * rect;
- m_isDirty = FALSE;
- m_isDirty = FALSE;
+ m_isDirty = false;
+ m_isDirty = false;
if (window)
{
// dragged.
wxSize clientSize;
- wxPoint pt(0, 0);
+ wxPoint pt;
if (!m_fullScreen)
{
clientSize = window->GetClientSize();
m_boundingRect.width, m_boundingRect.height);
}
- return TRUE;
+ return true;
}
// Begin drag. hotspot is the location of the drag position relative to the upper-left
int x = fullScreenRect->GetPosition().x;
int y = fullScreenRect->GetPosition().y;
-
+
wxSize sz = fullScreenRect->GetSize();
if (fullScreenRect->GetParent() && !fullScreenRect->IsKindOf(CLASSINFO(wxFrame)))
rect.x = x; rect.y = y;
rect.width = sz.x; rect.height = sz.y;
- return BeginDrag(hotspot, window, TRUE, & rect);
+ return BeginDrag(hotspot, window, true, & rect);
}
// End drag
m_repairBitmap = wxNullBitmap;
- return TRUE;
+ return true;
}
// Move the image: call from OnMouseMove. Pt is in window client coordinates if window
wxPoint oldPos = m_position;
bool eraseOldImage = (m_isDirty && m_isShown);
-
+
if (m_isShown)
- RedrawImage(oldPos - m_offset, pt2 - m_offset, eraseOldImage, TRUE);
+ RedrawImage(oldPos - m_offset, pt2 - m_offset, eraseOldImage, true);
m_position = pt2;
if (m_isShown)
- m_isDirty = TRUE;
+ m_isDirty = true;
- return TRUE;
+ return true;
}
bool wxGenericDragImage::Show()
{
wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), wxT("No window DC in wxGenericDragImage::Show()") );
-
+
// Show at the current position
if (!m_isShown)
//memDC.Blit(0, 0, m_boundingRect.width, m_boundingRect.height, m_windowDC, m_boundingRect.x, m_boundingRect.y);
memDC.SelectObject(wxNullBitmap);
- RedrawImage(m_position - m_offset, m_position - m_offset, FALSE, TRUE);
+ RedrawImage(m_position - m_offset, m_position - m_offset, false, true);
}
- m_isShown = TRUE;
- m_isDirty = TRUE;
+ m_isShown = true;
+ m_isDirty = true;
- return TRUE;
+ return true;
}
bool wxGenericDragImage::UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC,
if (m_isShown && m_isDirty)
{
- RedrawImage(m_position - m_offset, m_position - m_offset, TRUE, FALSE);
+ RedrawImage(m_position - m_offset, m_position - m_offset, true, false);
}
- m_isShown = FALSE;
- m_isDirty = FALSE;
+ m_isShown = false;
+ m_isDirty = false;
- return TRUE;
+ return true;
}
// More efficient: erase and redraw simultaneously if possible
bool eraseOld, bool drawNew)
{
if (!m_windowDC)
- return FALSE;
+ return false;
wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap);
if (!backing->Ok())
- return FALSE;
+ return false;
wxRect oldRect(GetImageRect(oldPos));
wxRect newRect(GetImageRect(newPos));
memDCTemp.SelectObject(wxNullBitmap);
memDC.SelectObject(wxNullBitmap);
- return TRUE;
+ return true;
}
// Override this if you are using a virtual image (drawing your own image)
if (m_bitmap.Ok())
{
dc.DrawBitmap(m_bitmap, pos.x, pos.y, (m_bitmap.GetMask() != 0));
- return TRUE;
+ return true;
}
else if (m_icon.Ok())
{
dc.DrawIcon(m_icon, pos.x, pos.y);
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
// Override this if you are using a virtual image (drawing your own image)