279 |
# if the mouse is outside the window. |
# if the mouse is outside the window. |
280 |
self.current_position = None |
self.current_position = None |
281 |
|
|
|
# If true, OnIdle will call do_redraw to do the actual |
|
|
# redrawing. Set by OnPaint to avoid some unnecessary redraws. |
|
|
# To force a redraw call full_redraw(). |
|
|
self.redraw_on_idle = 0 |
|
|
|
|
282 |
# the bitmap serving as backing store |
# the bitmap serving as backing store |
283 |
self.bitmap = None |
self.bitmap = None |
284 |
|
|
298 |
EVT_MOTION(self, self.OnMotion) |
EVT_MOTION(self, self.OnMotion) |
299 |
EVT_LEAVE_WINDOW(self, self.OnLeaveWindow) |
EVT_LEAVE_WINDOW(self, self.OnLeaveWindow) |
300 |
wx.EVT_SIZE(self, self.OnSize) |
wx.EVT_SIZE(self, self.OnSize) |
|
wx.EVT_IDLE(self, self.OnIdle) |
|
301 |
|
|
302 |
def __del__(self): |
def __del__(self): |
303 |
wxWindow.__del__(self) |
wxWindow.__del__(self) |
306 |
def OnPaint(self, event): |
def OnPaint(self, event): |
307 |
dc = wxPaintDC(self) |
dc = wxPaintDC(self) |
308 |
if self.map is not None and self.map.HasLayers(): |
if self.map is not None and self.map.HasLayers(): |
309 |
# We have a non-empty map. Redraw it in idle time |
self.do_redraw() |
|
self.redraw_on_idle = 1 |
|
310 |
else: |
else: |
311 |
# If we've got no map or if the map is empty, simply clear |
# If we've got no map or if the map is empty, simply clear |
312 |
# the screen. |
# the screen. |
576 |
def OnLeaveWindow(self, event): |
def OnLeaveWindow(self, event): |
577 |
self.set_current_position(None) |
self.set_current_position(None) |
578 |
|
|
|
def OnIdle(self, event): |
|
|
if self.redraw_on_idle: |
|
|
self.do_redraw() |
|
|
self.redraw_on_idle = 0 |
|
|
|
|
579 |
def OnSize(self, event): |
def OnSize(self, event): |
580 |
# the window's size has changed. We have to get a new bitmap. If |
# the window's size has changed. We have to get a new bitmap. If |
581 |
# we want to be clever we could try to get by without throwing |
# we want to be clever we could try to get by without throwing |