mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 11:30:06 +01:00
Add wx.DragImage and wx.GenericDragImage
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71164 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
1
TODO.txt
1
TODO.txt
@@ -131,7 +131,6 @@ other dev stuff
|
||||
|
||||
* taskbar
|
||||
* print (as in print framework classes)
|
||||
* dragimag
|
||||
* datectrl
|
||||
* hyperlink
|
||||
* pickerbase, clrpicker, filepicker, fontpicker
|
||||
|
||||
@@ -236,6 +236,8 @@ wx.ListCtrl
|
||||
public. Instead use the associated getter/setter methods or the
|
||||
auto-generated properties that are using them.
|
||||
|
||||
|
||||
|
||||
wx.TreeCtrl
|
||||
-----------
|
||||
|
||||
@@ -250,3 +252,14 @@ wx.TreeCtrl
|
||||
[G|S]etItemPyData members still exist, but are now deprecated
|
||||
aliases for [G|S]etItemData.
|
||||
|
||||
|
||||
|
||||
wx.DragImage
|
||||
------------
|
||||
|
||||
Phoenix is providing both wx.DragImage and wx.GenericDragImage classes.
|
||||
Classic wxPython only provided wx.DragImage, but it was actually using
|
||||
wx.GenericDragImage internally for all platforms. wx.DragImage will now be a
|
||||
native implementation on Windows, and will still be the generic version
|
||||
elsewhere. If you would rather use the generic implementation on Window to
|
||||
then switch to using the wx.GenericDragImage class name.
|
||||
|
||||
@@ -181,6 +181,7 @@ INCLUDES = [ # core
|
||||
'settings',
|
||||
'sysopt',
|
||||
'artprov',
|
||||
'dragimag',
|
||||
]
|
||||
|
||||
|
||||
|
||||
65
etg/dragimag.py
Normal file
65
etg/dragimag.py
Normal file
@@ -0,0 +1,65 @@
|
||||
#---------------------------------------------------------------------------
|
||||
# Name: etg/dragimag.py
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 09-Apr-2012
|
||||
# Copyright: (c) 2012 by Total Control Software
|
||||
# License: wxWindows License
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
import copy
|
||||
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "dragimag" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ "wxDragImage",
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
di = module.find('wxDragImage')
|
||||
assert isinstance(di, etgtools.ClassDef)
|
||||
|
||||
# make a copy and rename it to 'wxGenericDragImage'
|
||||
gdi = copy.deepcopy(di)
|
||||
assert isinstance(gdi, etgtools.ClassDef)
|
||||
gdi.name = 'wxGenericDragImage'
|
||||
for ctor in gdi.find('wxDragImage').all():
|
||||
ctor.name = 'wxGenericDragImage'
|
||||
module.insertItemAfter(di, gdi)
|
||||
|
||||
# now add some tweaks for wxDragImage
|
||||
di.find('DoDrawImage').ignore()
|
||||
di.find('GetImageRect').ignore()
|
||||
di.find('UpdateBackingFromWindow').ignore()
|
||||
di.addPrivateCopyCtor()
|
||||
|
||||
# and for wxGenericDragImage
|
||||
gdi.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
63
unittests/test_dragimag.py
Normal file
63
unittests/test_dragimag.py
Normal file
@@ -0,0 +1,63 @@
|
||||
import imp_unittest, unittest
|
||||
import wtc
|
||||
import wx
|
||||
import os
|
||||
|
||||
pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png')
|
||||
icoFile = os.path.join(os.path.dirname(__file__), 'mondrian.ico')
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class dragimag_Tests(wtc.WidgetTestCase):
|
||||
|
||||
def test_dragimag1(self):
|
||||
di = wx.DragImage()
|
||||
|
||||
def test_dragimag2(self):
|
||||
di = wx.DragImage(wx.Bitmap(pngFile))
|
||||
|
||||
def test_dragimag3(self):
|
||||
di = wx.DragImage(wx.Icon(icoFile))
|
||||
|
||||
def test_dragimag4(self):
|
||||
di = wx.DragImage("Some draggable text")
|
||||
|
||||
def test_dragimag5(self):
|
||||
ctrl = wx.TreeCtrl(self.frame)
|
||||
root = ctrl.AddRoot('root item')
|
||||
di = wx.DragImage(ctrl, root)
|
||||
|
||||
def test_dragimag6(self):
|
||||
ctrl = wx.ListCtrl(self.frame, style=wx.LC_REPORT)
|
||||
ctrl.AppendColumn('hello')
|
||||
idx = ctrl.InsertItem(0, "a list item")
|
||||
di = wx.DragImage(ctrl, idx)
|
||||
|
||||
|
||||
def test_genericdragimag1(self):
|
||||
di = wx.GenericDragImage()
|
||||
|
||||
def test_genericdragimag2(self):
|
||||
di = wx.GenericDragImage(wx.Bitmap(pngFile))
|
||||
|
||||
def test_genericdragimag3(self):
|
||||
di = wx.GenericDragImage(wx.Icon(icoFile))
|
||||
|
||||
def test_genericdragimag4(self):
|
||||
di = wx.GenericDragImage("Some draggable text")
|
||||
|
||||
def test_genericdragimag5(self):
|
||||
ctrl = wx.TreeCtrl(self.frame)
|
||||
root = ctrl.AddRoot('root item')
|
||||
di = wx.GenericDragImage(ctrl, root)
|
||||
|
||||
def test_genericdragimag6(self):
|
||||
ctrl = wx.ListCtrl(self.frame, style=wx.LC_REPORT)
|
||||
ctrl.AppendColumn('hello')
|
||||
idx = ctrl.InsertItem(0, "a list item")
|
||||
di = wx.GenericDragImage(ctrl, idx)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user