| 1 |
#!/usr/bin/env python |
|---|
| 2 |
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 3 |
##~ License |
|---|
| 4 |
##~ |
|---|
| 5 |
##- The RuneBlade Foundation library is intended to ease some |
|---|
| 6 |
##- aspects of writing intricate Jabber, XML, and User Interface (wxPython, etc.) |
|---|
| 7 |
##- applications, while providing the flexibility to modularly change the |
|---|
| 8 |
##- architecture. Enjoy. |
|---|
| 9 |
##~ |
|---|
| 10 |
##~ Copyright (C) 2002 TechGame Networks, LLC. |
|---|
| 11 |
##~ |
|---|
| 12 |
##~ This library is free software; you can redistribute it and/or |
|---|
| 13 |
##~ modify it under the terms of the BSD style License as found in the |
|---|
| 14 |
##~ LICENSE file included with this distribution. |
|---|
| 15 |
##~ |
|---|
| 16 |
##~ TechGame Networks, LLC can be reached at: |
|---|
| 17 |
##~ 3578 E. Hartsel Drive #211 |
|---|
| 18 |
##~ Colorado Springs, Colorado, USA, 80920 |
|---|
| 19 |
##~ |
|---|
| 20 |
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 21 |
|
|---|
| 22 |
"""Provides a simple interface for creating rollover events. |
|---|
| 23 |
|
|---|
| 24 |
Note: Currently only works with Windows. |
|---|
| 25 |
""" |
|---|
| 26 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 27 |
#~ Imports |
|---|
| 28 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 29 |
|
|---|
| 30 |
from wxPython import wx |
|---|
| 31 |
from RBFoundation.BindCallable import BindCallable |
|---|
| 32 |
|
|---|
| 33 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 34 |
#~ Definitions |
|---|
| 35 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 36 |
|
|---|
| 37 |
class wxRolloverMixin: |
|---|
| 38 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 39 |
#~ Constants / Variables / Etc. |
|---|
| 40 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 41 |
|
|---|
| 42 |
_rollover_bitmap = None |
|---|
| 43 |
_nonrollover_bitmap = None |
|---|
| 44 |
|
|---|
| 45 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 46 |
#~ Public Methods |
|---|
| 47 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 48 |
|
|---|
| 49 |
def _SetupEvents(self): |
|---|
| 50 |
self._eventhandler = wx.wxEvtHandler() |
|---|
| 51 |
wx.EVT_ENTER_WINDOW(self._eventhandler, BindCallable(self._SetRolloverBitmap)) |
|---|
| 52 |
wx.EVT_LEAVE_WINDOW(self._eventhandler, BindCallable(self._SetNonRolloverBitmap)) |
|---|
| 53 |
self.PushEventHandler(self._eventhandler) |
|---|
| 54 |
return self._eventhandler |
|---|
| 55 |
|
|---|
| 56 |
def GetBitmapRollover(self): |
|---|
| 57 |
return self._rollover_bitmap |
|---|
| 58 |
def SetBitmapRollover(self, rollover): |
|---|
| 59 |
self._rollover_bitmap = rollover |
|---|
| 60 |
|
|---|
| 61 |
def GetBitmapNonRollover(self): |
|---|
| 62 |
return self._nonrollover_bitmap |
|---|
| 63 |
def SetBitmapNonRollover(self, nonrollover): |
|---|
| 64 |
self._nonrollover_bitmap = nonrollover |
|---|
| 65 |
|
|---|
| 66 |
def _SetRolloverBitmap(self, evt): |
|---|
| 67 |
raise NotImplementedError |
|---|
| 68 |
|
|---|
| 69 |
def _SetNonRolloverBitmap(self, evt): |
|---|
| 70 |
raise NotImplementedError |
|---|
| 71 |
|
|---|