From 30a2bf13bc45f6244e69b1679c5be89e925b367d Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 27 Feb 2016 17:36:17 -0800 Subject: [PATCH] Add [Show|Hide]NativeCaret for MSW. --- etg/textctrl.py | 20 ++++++++++++++++++++ unittests/test_textctrl.py | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/etg/textctrl.py b/etg/textctrl.py index 21248ded..b0a09ba0 100644 --- a/etg/textctrl.py +++ b/etg/textctrl.py @@ -76,6 +76,26 @@ def parseAndTweakModule(): #endif """) + c.addCppMethod('bool', 'ShowNativeCaret', '(bool show = true)', + doc="""\ + Turn on the widget's native caret on Windows. + Ignored on other platforms. + """, + body="""\ + #ifdef __WXMSW__ + return self->ShowNativeCaret(show); + #endif + """) + c.addCppMethod('bool', 'HideNativeCaret', '()', + doc="""\ + Turn off the widget's native caret on Windows. + Ignored on other platforms. + """, + body="""\ + #ifdef __WXMSW__ + return self->HideNativeCaret(); + #endif + """) c = module.find('wxTextUrlEvent') tools.fixEventClass(c) diff --git a/unittests/test_textctrl.py b/unittests/test_textctrl.py index cb5c9059..0945a471 100644 --- a/unittests/test_textctrl.py +++ b/unittests/test_textctrl.py @@ -93,6 +93,11 @@ class textctrl_Tests(wtc.WidgetTestCase): ta.URL + def test_textctrlNativeCaret(self): + t = wx.TextCtrl(self.frame) + t.ShowNativeCaret + t.HideNativeCaret + #---------------------------------------------------------------------------