Add wxHyperlinkCtrl to wx.adv

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71166 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2012-04-10 03:23:53 +00:00
parent 4b4b9a1210
commit 2acffba5fc
4 changed files with 96 additions and 2 deletions

View File

@@ -131,7 +131,6 @@ other dev stuff
* taskbar
* print (as in print framework classes)
* hyperlink
* pickerbase, clrpicker, filepicker, fontpicker
* filectrl
* axbase (ActiveX. Need to figure out best ways to do MSW-only items...)

View File

@@ -31,6 +31,7 @@ INCLUDES = [
'dateevt',
'datectrl',
'calctrl',
'hyperlink',
# TODOs -
@@ -40,7 +41,6 @@ INCLUDES = [
#'bannerwindow',
#'bmpcbox',
#'editlbox',
#'hyperlink',
#'joystick',
#'laywin',
#'notifmsg',

63
etg/hyperlink.py Normal file
View File

@@ -0,0 +1,63 @@
#---------------------------------------------------------------------------
# Name: etg/hyperlink.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
PACKAGE = "wx"
MODULE = "_adv"
NAME = "hyperlink" # 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 = [ "wxHyperlinkEvent",
"wxHyperlinkCtrl",
]
#---------------------------------------------------------------------------
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.
module.addHeaderCode("#include <wx/hyperlink.h>")
c = module.find('wxHyperlinkEvent')
assert isinstance(c, etgtools.ClassDef)
tools.fixEventClass(c)
c.addPyCode("""\
EVT_HYPERLINK = wx.PyEventBinder( wxEVT_COMMAND_HYPERLINK, 1 )
""")
c = module.find('wxHyperlinkCtrl')
tools.fixWindowClass(c)
c.find('wxHyperlinkCtrl.label').default = 'wxEmptyString'
c.find('wxHyperlinkCtrl.url').default = 'wxEmptyString'
c.find('Create.label').default = 'wxEmptyString'
c.find('Create.url').default = 'wxEmptyString'
module.addGlobalStr('wxHyperlinkCtrlNameStr', c)
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
#---------------------------------------------------------------------------
if __name__ == '__main__':
run()

View File

@@ -0,0 +1,32 @@
import imp_unittest, unittest
import wtc
import wx
import wx.adv
#---------------------------------------------------------------------------
class hyperlink_Tests(wtc.WidgetTestCase):
def test_hyperlink1(self):
w = wx.adv.HyperlinkCtrl(self.frame, label='label', url='http://wxPython.org')
def test_hyperlink2(self):
w = wx.adv.HyperlinkCtrl()
w.Create(self.frame, label='label', url='http://wxPython.org')
def test_hyperlink3(self):
evt = wx.adv.HyperlinkCtrl(self.frame, 123, 'url')
wx.adv.HL_CONTEXTMENU
wx.adv.HL_ALIGN_LEFT
wx.adv.HL_ALIGN_RIGHT
wx.adv.HL_ALIGN_CENTRE
wx.adv.HL_DEFAULT_STYLE
wx.adv.wxEVT_COMMAND_HYPERLINK
wx.adv.EVT_HYPERLINK
#---------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()