Added Python wrappers for wxRTTI for the wxVScrolledWindow,
wxVListBox, and wxHtmlListBox classes. Removed the calls to wxClassInfo::Cleanup and Initialize. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22713 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
0c8392cac2
commit
3628e08886
@ -32,6 +32,8 @@ wxPython's setup.py script now expects to use existing libraries for
|
|||||||
the contribs (gizmos, stc, xrc, etc.) rather than building local
|
the contribs (gizmos, stc, xrc, etc.) rather than building local
|
||||||
copies of them.
|
copies of them.
|
||||||
|
|
||||||
|
Added Python wrappers for the new wxVScrolledWindow, wxVListBox, and
|
||||||
|
wxHtmlListBox classes.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,9 +109,6 @@ public:
|
|||||||
|
|
||||||
%init %{
|
%init %{
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6533,9 +6533,6 @@ SWIGEXPORT(void) initgizmosc() {
|
|||||||
PyDict_SetItemString(d,"wxTREE_HITTEST_ONITEMCOLUMN", PyInt_FromLong((long) wxTREE_HITTEST_ONITEMCOLUMN));
|
PyDict_SetItemString(d,"wxTREE_HITTEST_ONITEMCOLUMN", PyInt_FromLong((long) wxTREE_HITTEST_ONITEMCOLUMN));
|
||||||
|
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
|
|
||||||
wxPyPtrTypeMap_Add("wxTreeCompanionWindow", "wxPyTreeCompanionWindow");
|
wxPyPtrTypeMap_Add("wxTreeCompanionWindow", "wxPyTreeCompanionWindow");
|
||||||
wxPyPtrTypeMap_Add("wxTreeListCtrl", "wxPyTreeListCtrl");
|
wxPyPtrTypeMap_Add("wxTreeListCtrl", "wxPyTreeListCtrl");
|
||||||
{
|
{
|
||||||
|
@ -925,9 +925,6 @@ public:
|
|||||||
|
|
||||||
%init %{
|
%init %{
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
|
|
||||||
wxPyPtrTypeMap_Add("wxTreeCompanionWindow", "wxPyTreeCompanionWindow");
|
wxPyPtrTypeMap_Add("wxTreeCompanionWindow", "wxPyTreeCompanionWindow");
|
||||||
wxPyPtrTypeMap_Add("wxTreeListCtrl", "wxPyTreeListCtrl");
|
wxPyPtrTypeMap_Add("wxTreeListCtrl", "wxPyTreeListCtrl");
|
||||||
%}
|
%}
|
||||||
|
@ -169,9 +169,6 @@ public:
|
|||||||
|
|
||||||
%init %{
|
%init %{
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -939,9 +939,6 @@ SWIGEXPORT(void) initglcanvasc() {
|
|||||||
PyDict_SetItemString(d,"WX_GL_MIN_ACCUM_ALPHA", PyInt_FromLong((long) WX_GL_MIN_ACCUM_ALPHA));
|
PyDict_SetItemString(d,"WX_GL_MIN_ACCUM_ALPHA", PyInt_FromLong((long) WX_GL_MIN_ACCUM_ALPHA));
|
||||||
|
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; _swig_mapping[i].n1; i++)
|
for (i = 0; _swig_mapping[i].n1; i++)
|
||||||
|
@ -127,9 +127,6 @@ public:
|
|||||||
|
|
||||||
%init %{
|
%init %{
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -463,9 +463,6 @@ SWIGEXPORT(void) initoglc() {
|
|||||||
initoglcanvasc();
|
initoglcanvasc();
|
||||||
|
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
|
|
||||||
wxPyPtrTypeMap_Add("wxControlPoint", "wxPyControlPoint");
|
wxPyPtrTypeMap_Add("wxControlPoint", "wxPyControlPoint");
|
||||||
wxPyPtrTypeMap_Add("wxShapeCanvas", "wxPyShapeCanvas");
|
wxPyPtrTypeMap_Add("wxShapeCanvas", "wxPyShapeCanvas");
|
||||||
wxPyPtrTypeMap_Add("wxShapeEvtHandler", "wxPyShapeEvtHandler");
|
wxPyPtrTypeMap_Add("wxShapeEvtHandler", "wxPyShapeEvtHandler");
|
||||||
|
@ -292,9 +292,6 @@ extern "C" SWIGEXPORT(void) initoglcanvasc();
|
|||||||
initoglcanvasc();
|
initoglcanvasc();
|
||||||
|
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
|
|
||||||
wxPyPtrTypeMap_Add("wxControlPoint", "wxPyControlPoint");
|
wxPyPtrTypeMap_Add("wxControlPoint", "wxPyControlPoint");
|
||||||
wxPyPtrTypeMap_Add("wxShapeCanvas", "wxPyShapeCanvas");
|
wxPyPtrTypeMap_Add("wxShapeCanvas", "wxPyShapeCanvas");
|
||||||
wxPyPtrTypeMap_Add("wxShapeEvtHandler", "wxPyShapeEvtHandler");
|
wxPyPtrTypeMap_Add("wxShapeEvtHandler", "wxPyShapeEvtHandler");
|
||||||
|
@ -13254,9 +13254,6 @@ SWIGEXPORT(void) initstc_c() {
|
|||||||
PyDict_SetItemString(d,"wxEVT_STC_CALLTIP_CLICK", PyInt_FromLong((long) wxEVT_STC_CALLTIP_CLICK));
|
PyDict_SetItemString(d,"wxEVT_STC_CALLTIP_CLICK", PyInt_FromLong((long) wxEVT_STC_CALLTIP_CLICK));
|
||||||
|
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; _swig_mapping[i].n1; i++)
|
for (i = 0; _swig_mapping[i].n1; i++)
|
||||||
|
@ -128,9 +128,6 @@ def EVT_STC_CALLTIP_CLICK(win, id, func):
|
|||||||
|
|
||||||
%init %{
|
%init %{
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5308,9 +5308,6 @@ SWIGEXPORT(void) initxrcc() {
|
|||||||
PyDict_SetItemString(d,"wxXML_HTML_DOCUMENT_NODE", PyInt_FromLong((long) wxXML_HTML_DOCUMENT_NODE));
|
PyDict_SetItemString(d,"wxXML_HTML_DOCUMENT_NODE", PyInt_FromLong((long) wxXML_HTML_DOCUMENT_NODE));
|
||||||
|
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
|
|
||||||
wxXmlInitResourceModule();
|
wxXmlInitResourceModule();
|
||||||
wxXmlResource::Get()->InitAllHandlers();
|
wxXmlResource::Get()->InitAllHandlers();
|
||||||
|
|
||||||
|
@ -677,9 +677,6 @@ public:
|
|||||||
|
|
||||||
%init %{
|
%init %{
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
|
|
||||||
wxXmlInitResourceModule();
|
wxXmlInitResourceModule();
|
||||||
wxXmlResource::Get()->InitAllHandlers();
|
wxXmlResource::Get()->InitAllHandlers();
|
||||||
|
|
||||||
|
@ -25,14 +25,7 @@ import images
|
|||||||
_treeList = [
|
_treeList = [
|
||||||
# new stuff
|
# new stuff
|
||||||
('Recent Additions', [
|
('Recent Additions', [
|
||||||
'wxScrolledPanel',
|
'wxVListBox',
|
||||||
'ShapedWindow',
|
|
||||||
'NewNamespace',
|
|
||||||
'PopupMenu',
|
|
||||||
'AnalogClockWindow',
|
|
||||||
'MaskedEditControls',
|
|
||||||
'wxTreeListCtrl',
|
|
||||||
'wxGrid_MegaExample',
|
|
||||||
]),
|
]),
|
||||||
|
|
||||||
# managed windows == things with a (optional) caption you can close
|
# managed windows == things with a (optional) caption you can close
|
||||||
@ -138,6 +131,7 @@ _treeList = [
|
|||||||
'wxStyledTextCtrl_2',
|
'wxStyledTextCtrl_2',
|
||||||
'wxTimeCtrl',
|
'wxTimeCtrl',
|
||||||
'wxTreeListCtrl',
|
'wxTreeListCtrl',
|
||||||
|
'wxVListBox',
|
||||||
]),
|
]),
|
||||||
|
|
||||||
# How to lay out the controls in a frame/dialog
|
# How to lay out the controls in a frame/dialog
|
||||||
@ -187,7 +181,9 @@ _treeList = [
|
|||||||
'DialogUnits',
|
'DialogUnits',
|
||||||
'DrawXXXList',
|
'DrawXXXList',
|
||||||
'FontEnumerator',
|
'FontEnumerator',
|
||||||
|
'NewNamespace',
|
||||||
'PrintFramework',
|
'PrintFramework',
|
||||||
|
'ShapedWindow',
|
||||||
'Throbber',
|
'Throbber',
|
||||||
'Unicode',
|
'Unicode',
|
||||||
'wxFileHistory',
|
'wxFileHistory',
|
||||||
@ -394,9 +390,8 @@ class wxPythonDemo(wx.Frame):
|
|||||||
# Create a TreeCtrl
|
# Create a TreeCtrl
|
||||||
tID = wx.NewId()
|
tID = wx.NewId()
|
||||||
self.treeMap = {}
|
self.treeMap = {}
|
||||||
self.tree = wx.TreeCtrl(splitter, tID,
|
self.tree = wx.TreeCtrl(splitter, tID, style =
|
||||||
style=wx.TR_HAS_BUTTONS |
|
wx.TR_DEFAULT_STYLE #| wx.TR_HAS_VARIABLE_ROW_HEIGHT
|
||||||
wx.TR_HAS_VARIABLE_ROW_HEIGHT
|
|
||||||
)
|
)
|
||||||
|
|
||||||
root = self.tree.AddRoot("wxPython Overview")
|
root = self.tree.AddRoot("wxPython Overview")
|
||||||
|
BIN
wxPython/demo/bmp_source/copy2.bmp
Normal file
BIN
wxPython/demo/bmp_source/copy2.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 246 B |
@ -38,6 +38,7 @@ command_lines = [
|
|||||||
"-a -u -n New -m #C0C0C0 bmp_source/new.bmp images.py",
|
"-a -u -n New -m #C0C0C0 bmp_source/new.bmp images.py",
|
||||||
"-a -u -n Open -m #C0C0C0 bmp_source/open.bmp images.py",
|
"-a -u -n Open -m #C0C0C0 bmp_source/open.bmp images.py",
|
||||||
"-a -u -n Copy -m #C0C0C0 bmp_source/copy.bmp images.py",
|
"-a -u -n Copy -m #C0C0C0 bmp_source/copy.bmp images.py",
|
||||||
|
"-a -u -n Copy2 -m #C0C0C0 bmp_source/copy2.bmp images.py",
|
||||||
"-a -u -n Paste -m #C0C0C0 bmp_source/paste.bmp images.py",
|
"-a -u -n Paste -m #C0C0C0 bmp_source/paste.bmp images.py",
|
||||||
"-a -u -n Tog1 -m #C0C0C0 bmp_source/tog1.bmp images.py",
|
"-a -u -n Tog1 -m #C0C0C0 bmp_source/tog1.bmp images.py",
|
||||||
"-a -u -n Tog2 -m #C0C0C0 bmp_source/tog2.bmp images.py",
|
"-a -u -n Tog2 -m #C0C0C0 bmp_source/tog2.bmp images.py",
|
||||||
|
@ -3439,6 +3439,26 @@ def getCopyImage():
|
|||||||
stream = cStringIO.StringIO(getCopyData())
|
stream = cStringIO.StringIO(getCopyData())
|
||||||
return wxImageFromStream(stream)
|
return wxImageFromStream(stream)
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
def getCopy2Data():
|
||||||
|
return \
|
||||||
|
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\
|
||||||
|
\x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\
|
||||||
|
\x00\x00\x9fIDATx\x9c\xa5\x93\xdb\x0e\x830\x0cC\xed\x84\xdfF\xeb\xb4\xef\xa6\
|
||||||
|
\xde\x030z\t\x94\tK\x91z\xcb\x01\xbb*i\x8e\'\x9a\x00@yQ\xb4Is\x8e\x00\xb6\
|
||||||
|
\x0f$Uu\x05\x0e\x01\x91$\r!\xa49\x94\x17I\x02\xc9_\xe3:Nq\x93}XL|\xeb\xe9\
|
||||||
|
\x05\xa4p\rH\xa29h^[ Y\xd5\xb9\xb5\x17\x94gu\x19DA\x96\xe0c\xfe^\xcf\xe7Y\
|
||||||
|
\x95\x05\x00M\xf5\x16Z;\x7f\xfdAd\xcf\xee\x1cj\xc1%|\xdan"LL\x19\xda\xe1}\
|
||||||
|
\x90:\x00#\x95_l5\x04\xec\x89\x9f\xef?|\x8d\x97o\xe1\x8e\xbeJ\xfc\xb1\xde\
|
||||||
|
\xf4x\xe1\x1d\x00\x00\x00\x00IEND\xaeB`\x82'
|
||||||
|
|
||||||
|
def getCopy2Bitmap():
|
||||||
|
return wxBitmapFromImage(getCopy2Image())
|
||||||
|
|
||||||
|
def getCopy2Image():
|
||||||
|
stream = cStringIO.StringIO(getCopy2Data())
|
||||||
|
return wxImageFromStream(stream)
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def getPasteData():
|
def getPasteData():
|
||||||
return \
|
return \
|
||||||
|
33
wxPython/demo/templateold.py
Normal file
33
wxPython/demo/templateold.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
from wxPython.wx import *
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
class TestPanel(wxPanel):
|
||||||
|
def __init__(self, parent, log):
|
||||||
|
self.log = log
|
||||||
|
wxPanel.__init__(self, parent, -1)
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
def runTest(frame, nb, log):
|
||||||
|
win = TestPanel(nb, log)
|
||||||
|
return win
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overview = """<html><body>
|
||||||
|
<h2><center>Say something nice here</center></h2>
|
||||||
|
|
||||||
|
</body></html>
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import sys,os
|
||||||
|
import run
|
||||||
|
run.main(['', os.path.basename(sys.argv[0])])
|
||||||
|
|
@ -138,7 +138,7 @@ class PythonSTC(wxStyledTextCtrl):
|
|||||||
# register some images for use in the AutoComplete box.
|
# register some images for use in the AutoComplete box.
|
||||||
self.RegisterImage(1, images.getSmilesBitmap())
|
self.RegisterImage(1, images.getSmilesBitmap())
|
||||||
self.RegisterImage(2, images.getFile1Bitmap())
|
self.RegisterImage(2, images.getFile1Bitmap())
|
||||||
self.RegisterImage(3, images.getCopyBitmap())
|
self.RegisterImage(3, images.getCopy2Bitmap())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,13 +110,25 @@ class TestPanel(wxPanel):
|
|||||||
text = self.tc.GetValue()
|
text = self.tc.GetValue()
|
||||||
if wxPlatform == "__WXMSW__": # This is why GetStringSelection was added
|
if wxPlatform == "__WXMSW__": # This is why GetStringSelection was added
|
||||||
text = text.replace('\n', '\r\n')
|
text = text.replace('\n', '\r\n')
|
||||||
self.log.write("GetSelection(): (%d, %d)\n"
|
self.log.write("multi-line GetSelection(): (%d, %d)\n"
|
||||||
"\tGetStringSelection(): %s\n"
|
"\tGetStringSelection(): %s\n"
|
||||||
"\tSelectedText: %s\n" %
|
"\tSelectedText: %s\n" %
|
||||||
(start, end,
|
(start, end,
|
||||||
self.tc.GetStringSelection(),
|
self.tc.GetStringSelection(),
|
||||||
repr(text[start:end])))
|
repr(text[start:end])))
|
||||||
|
|
||||||
|
start, end = self.tc1.GetSelection()
|
||||||
|
text = self.tc1.GetValue()
|
||||||
|
if wxPlatform == "__WXMSW__": # This is why GetStringSelection was added
|
||||||
|
text = text.replace('\n', '\r\n')
|
||||||
|
self.log.write("single-line GetSelection(): (%d, %d)\n"
|
||||||
|
"\tGetStringSelection(): %s\n"
|
||||||
|
"\tSelectedText: %s\n" %
|
||||||
|
(start, end,
|
||||||
|
self.tc1.GetStringSelection(),
|
||||||
|
repr(text[start:end])))
|
||||||
|
|
||||||
|
|
||||||
def OnT5LeftDown(self, evt):
|
def OnT5LeftDown(self, evt):
|
||||||
evt.Skip()
|
evt.Skip()
|
||||||
wxCallAfter(self.LogT5Position, evt)
|
wxCallAfter(self.LogT5Position, evt)
|
||||||
|
124
wxPython/demo/wxVListBox.py
Normal file
124
wxPython/demo/wxVListBox.py
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
|
||||||
|
from wxPython.wx import *
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# The wxVListBox is much like a regular wxListBox except you draw the
|
||||||
|
# items yourself and the items can vary in height.
|
||||||
|
class MyVListBox(wxVListBox):
|
||||||
|
|
||||||
|
# This method must be overridden. When called it should draw the
|
||||||
|
# n'th item on the dc within the rect. How it is drawn, and what
|
||||||
|
# is drawn is entirely up to you.
|
||||||
|
def OnDrawItem(self, dc, rect, n):
|
||||||
|
dc.DrawLabel(self._getItemText(n), rect,
|
||||||
|
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL)
|
||||||
|
|
||||||
|
# This method must be overridden. It should return the height
|
||||||
|
# required to draw the n'th item.
|
||||||
|
def OnMeasureItem(self, n):
|
||||||
|
height = 0
|
||||||
|
for line in self._getItemText(n).split('\n'):
|
||||||
|
w, h = self.GetTextExtent(line)
|
||||||
|
height += h
|
||||||
|
return height + 5
|
||||||
|
|
||||||
|
|
||||||
|
# These are also overridable:
|
||||||
|
#
|
||||||
|
# OnDrawSeparator(dc, rect, n)
|
||||||
|
# Draw a separator between items. Note that rect may be reduced
|
||||||
|
# in size if desired so OnDrawItem gets a smaller rect.
|
||||||
|
#
|
||||||
|
# OnDrawBackground(dc, rect, n)
|
||||||
|
# Draw the background and maybe a border if desired.
|
||||||
|
|
||||||
|
|
||||||
|
def _getItemText(self, item):
|
||||||
|
if item % 2 == 0:
|
||||||
|
return "This is item# %d" % item
|
||||||
|
else:
|
||||||
|
return "This is item# %d\n with an extra line" % item
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# The wxHtmlListBox derives from wxVListBox, but draws each item
|
||||||
|
# itself as a wxHtmlCell.
|
||||||
|
class MyHtmlListBox(wxHtmlListBox):
|
||||||
|
|
||||||
|
def OnGetItem(self, n):
|
||||||
|
if n % 2 == 0:
|
||||||
|
return "This is item# <b>%d</b>" % n
|
||||||
|
else:
|
||||||
|
return "This is item# <b>%d</b> <br>Any <font color='RED'>HTML</font> is okay." % n
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
class TestPanel(wxPanel):
|
||||||
|
def __init__(self, parent, log):
|
||||||
|
self.log = log
|
||||||
|
wxPanel.__init__(self, parent, -1)
|
||||||
|
spacer = 50
|
||||||
|
|
||||||
|
vlb = MyVListBox(self, -1, size=(150, 250), style=wxBORDER_SUNKEN)
|
||||||
|
vlb.SetItemCount(50)
|
||||||
|
vlb.SetSelection(0)
|
||||||
|
vlb.SetFocus()
|
||||||
|
vlbSizer = wxBoxSizer(wxVERTICAL)
|
||||||
|
vlbSizer.Add((spacer, spacer))
|
||||||
|
vlbSizer.Add(wxStaticText(self, -1, "wxVListBox"), 0, 5, wxALL)
|
||||||
|
vlbSizer.Add(vlb)
|
||||||
|
|
||||||
|
hlb = MyHtmlListBox(self, -1, size=(150, 250), style=wxBORDER_SUNKEN)
|
||||||
|
hlb.SetItemCount(50)
|
||||||
|
hlb.SetSelection(0)
|
||||||
|
hlbSizer = wxBoxSizer(wxVERTICAL)
|
||||||
|
hlbSizer.Add((spacer, spacer))
|
||||||
|
hlbSizer.Add(wxStaticText(self, -1, "wxHtmlListBox"), 0, 5, wxALL)
|
||||||
|
hlbSizer.Add(hlb)
|
||||||
|
|
||||||
|
sizer = wxBoxSizer(wxHORIZONTAL)
|
||||||
|
sizer.Add((spacer, spacer))
|
||||||
|
sizer.Add(vlbSizer)
|
||||||
|
sizer.Add((spacer, spacer))
|
||||||
|
sizer.Add((spacer, spacer))
|
||||||
|
sizer.Add(hlbSizer)
|
||||||
|
|
||||||
|
self.SetSizer(sizer)
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
def runTest(frame, nb, log):
|
||||||
|
win = TestPanel(nb, log)
|
||||||
|
return win
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overview = """<html><body>
|
||||||
|
<h2><center>wxVListBox and wxHtmlListBox</center></h2>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
The "V" in wxVListBox stands for both "virtual" because it can have an
|
||||||
|
unlimited number of items since it doesn't store them itself, and
|
||||||
|
"variable" since items can vary in height. It has much the same
|
||||||
|
interface as wxListBox and also emits the same events so you can use
|
||||||
|
the same EVT_LISTBOX function to connect a handler.
|
||||||
|
<p>
|
||||||
|
|
||||||
|
The wxHtmlListBox derives from wxVListBox, but draws each item itself
|
||||||
|
as a wxHtmlCell. This means that you just need to provide a snippet
|
||||||
|
of HTML for each item when requested.
|
||||||
|
|
||||||
|
</body></html>
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import sys,os
|
||||||
|
import run
|
||||||
|
run.main(['', os.path.basename(sys.argv[0])])
|
||||||
|
|
@ -42,7 +42,7 @@ public:
|
|||||||
virtual ~MyApp();
|
virtual ~MyApp();
|
||||||
void Init_wxPython();
|
void Init_wxPython();
|
||||||
private:
|
private:
|
||||||
PyThreadState* main_tstate;
|
PyThreadState* m_mainTState;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -83,16 +83,22 @@ void MyApp::Init_wxPython()
|
|||||||
// module and sets a pointer to a function table located there.
|
// module and sets a pointer to a function table located there.
|
||||||
wxPyCoreAPI_IMPORT();
|
wxPyCoreAPI_IMPORT();
|
||||||
|
|
||||||
|
// Ensure that the new classes defined in the wxPython wrappers are
|
||||||
|
// recognised by the wx RTTI system. (If you don't use wxWindow in
|
||||||
|
// your C++ app you won't need to do this.)
|
||||||
|
wxClassInfo::CleanUpClasses();
|
||||||
|
wxClassInfo::InitializeClasses();
|
||||||
|
|
||||||
// Save the current Python thread state and release the
|
// Save the current Python thread state and release the
|
||||||
// Global Interpreter Lock.
|
// Global Interpreter Lock.
|
||||||
main_tstate = wxPyBeginAllowThreads();
|
m_mainTState = wxPyBeginAllowThreads();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MyApp::~MyApp()
|
MyApp::~MyApp()
|
||||||
{
|
{
|
||||||
// Restore the thread state and tell Python to cleanup after itself.
|
// Restore the thread state and tell Python to cleanup after itself.
|
||||||
wxPyEndAllowThreads(main_tstate);
|
wxPyEndAllowThreads(m_mainTState);
|
||||||
Py_Finalize();
|
Py_Finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,8 +263,6 @@ public:
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
%init %{
|
%init %{
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -2038,8 +2038,6 @@ def EVT_GRID_EDITOR_CREATED(win, fn):
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
%init %{
|
%init %{
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -2155,8 +2155,6 @@ SWIGEXPORT(void) initcalendarc() {
|
|||||||
PyDict_SetItemString(d,"wxEVT_CALENDAR_YEAR_CHANGED", PyInt_FromLong((long) wxEVT_CALENDAR_YEAR_CHANGED));
|
PyDict_SetItemString(d,"wxEVT_CALENDAR_YEAR_CHANGED", PyInt_FromLong((long) wxEVT_CALENDAR_YEAR_CHANGED));
|
||||||
PyDict_SetItemString(d,"wxEVT_CALENDAR_WEEKDAY_CLICKED", PyInt_FromLong((long) wxEVT_CALENDAR_WEEKDAY_CLICKED));
|
PyDict_SetItemString(d,"wxEVT_CALENDAR_WEEKDAY_CLICKED", PyInt_FromLong((long) wxEVT_CALENDAR_WEEKDAY_CLICKED));
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; _swig_mapping[i].n1; i++)
|
for (i = 0; _swig_mapping[i].n1; i++)
|
||||||
|
@ -15733,8 +15733,6 @@ SWIGEXPORT(void) initgridc() {
|
|||||||
PyDict_SetItemString(d,"wxEVT_GRID_EDITOR_HIDDEN", PyInt_FromLong((long) wxEVT_GRID_EDITOR_HIDDEN));
|
PyDict_SetItemString(d,"wxEVT_GRID_EDITOR_HIDDEN", PyInt_FromLong((long) wxEVT_GRID_EDITOR_HIDDEN));
|
||||||
PyDict_SetItemString(d,"wxEVT_GRID_EDITOR_CREATED", PyInt_FromLong((long) wxEVT_GRID_EDITOR_CREATED));
|
PyDict_SetItemString(d,"wxEVT_GRID_EDITOR_CREATED", PyInt_FromLong((long) wxEVT_GRID_EDITOR_CREATED));
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
PyDict_SetItemString(d,"wxGridCellAttr_Any", PyInt_FromLong((long) wxGridCellAttr::Any));
|
PyDict_SetItemString(d,"wxGridCellAttr_Any", PyInt_FromLong((long) wxGridCellAttr::Any));
|
||||||
PyDict_SetItemString(d,"wxGridCellAttr_Default", PyInt_FromLong((long) wxGridCellAttr::Default));
|
PyDict_SetItemString(d,"wxGridCellAttr_Default", PyInt_FromLong((long) wxGridCellAttr::Default));
|
||||||
PyDict_SetItemString(d,"wxGridCellAttr_Cell", PyInt_FromLong((long) wxGridCellAttr::Cell));
|
PyDict_SetItemString(d,"wxGridCellAttr_Cell", PyInt_FromLong((long) wxGridCellAttr::Cell));
|
||||||
|
@ -8670,9 +8670,6 @@ SWIGEXPORT(void) inithtmlc() {
|
|||||||
|
|
||||||
inithtmlhelpc();
|
inithtmlhelpc();
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
|
|
||||||
wxPyPtrTypeMap_Add("wxHtmlTagHandler", "wxPyHtmlTagHandler");
|
wxPyPtrTypeMap_Add("wxHtmlTagHandler", "wxPyHtmlTagHandler");
|
||||||
wxPyPtrTypeMap_Add("wxHtmlWinTagHandler", "wxPyHtmlWinTagHandler");
|
wxPyPtrTypeMap_Add("wxHtmlWinTagHandler", "wxPyHtmlWinTagHandler");
|
||||||
wxPyPtrTypeMap_Add("wxHtmlWindow", "wxPyHtmlWindow");
|
wxPyPtrTypeMap_Add("wxHtmlWindow", "wxPyHtmlWindow");
|
||||||
|
@ -835,6 +835,24 @@ static PyObject *_wrap_wxGetProcessId(PyObject *self, PyObject *args, PyObject *
|
|||||||
return _resultobj;
|
return _resultobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *_wrap_wxTrap(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
char *_kwnames[] = { NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxTrap",_kwnames))
|
||||||
|
return NULL;
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
wxTrap();
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} Py_INCREF(Py_None);
|
||||||
|
_resultobj = Py_None;
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *_wrap_wxGetAccelFromString(PyObject *self, PyObject *args, PyObject *kwargs) {
|
static PyObject *_wrap_wxGetAccelFromString(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
PyObject * _resultobj;
|
PyObject * _resultobj;
|
||||||
wxAcceleratorEntry * _result;
|
wxAcceleratorEntry * _result;
|
||||||
@ -5586,6 +5604,7 @@ static PyMethodDef misccMethods[] = {
|
|||||||
{ "wxObject_Destroy", (PyCFunction) _wrap_wxObject_Destroy, METH_VARARGS | METH_KEYWORDS },
|
{ "wxObject_Destroy", (PyCFunction) _wrap_wxObject_Destroy, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "wxObject_GetClassName", (PyCFunction) _wrap_wxObject_GetClassName, METH_VARARGS | METH_KEYWORDS },
|
{ "wxObject_GetClassName", (PyCFunction) _wrap_wxObject_GetClassName, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "wxGetAccelFromString", (PyCFunction) _wrap_wxGetAccelFromString, METH_VARARGS | METH_KEYWORDS },
|
{ "wxGetAccelFromString", (PyCFunction) _wrap_wxGetAccelFromString, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxTrap", (PyCFunction) _wrap_wxTrap, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "wxGetProcessId", (PyCFunction) _wrap_wxGetProcessId, METH_VARARGS | METH_KEYWORDS },
|
{ "wxGetProcessId", (PyCFunction) _wrap_wxGetProcessId, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "wxGetUserHome", (PyCFunction) _wrap_wxGetUserHome, METH_VARARGS | METH_KEYWORDS },
|
{ "wxGetUserHome", (PyCFunction) _wrap_wxGetUserHome, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "wxGetHomeDir", (PyCFunction) _wrap_wxGetHomeDir, METH_VARARGS | METH_KEYWORDS },
|
{ "wxGetHomeDir", (PyCFunction) _wrap_wxGetHomeDir, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
@ -811,6 +811,8 @@ wxGetUserHome = miscc.wxGetUserHome
|
|||||||
|
|
||||||
wxGetProcessId = miscc.wxGetProcessId
|
wxGetProcessId = miscc.wxGetProcessId
|
||||||
|
|
||||||
|
wxTrap = miscc.wxTrap
|
||||||
|
|
||||||
def wxGetAccelFromString(*_args, **_kwargs):
|
def wxGetAccelFromString(*_args, **_kwargs):
|
||||||
val = miscc.wxGetAccelFromString(*_args,**_kwargs)
|
val = miscc.wxGetAccelFromString(*_args,**_kwargs)
|
||||||
if val: val = wxAcceleratorEntryPtr(val)
|
if val: val = wxAcceleratorEntryPtr(val)
|
||||||
|
@ -7860,9 +7860,6 @@ SWIGEXPORT(void) initutilsc() {
|
|||||||
PyDict_SetItemString(d,"wxCONFIG_USE_RELATIVE_PATH", PyInt_FromLong((long) wxCONFIG_USE_RELATIVE_PATH));
|
PyDict_SetItemString(d,"wxCONFIG_USE_RELATIVE_PATH", PyInt_FromLong((long) wxCONFIG_USE_RELATIVE_PATH));
|
||||||
PyDict_SetItemString(d,"wxCONFIG_USE_NO_ESCAPE_CHARACTERS", PyInt_FromLong((long) wxCONFIG_USE_NO_ESCAPE_CHARACTERS));
|
PyDict_SetItemString(d,"wxCONFIG_USE_NO_ESCAPE_CHARACTERS", PyInt_FromLong((long) wxCONFIG_USE_NO_ESCAPE_CHARACTERS));
|
||||||
|
|
||||||
// These are no longer needed since utils is back in the core
|
|
||||||
// wxClassInfo::CleanUpClasses();
|
|
||||||
// wxClassInfo::InitializeClasses();
|
|
||||||
PyDict_SetItemString(d,"wxConfigBase_Type_Unknown", PyInt_FromLong((long) wxConfigBase::Type_Unknown));
|
PyDict_SetItemString(d,"wxConfigBase_Type_Unknown", PyInt_FromLong((long) wxConfigBase::Type_Unknown));
|
||||||
PyDict_SetItemString(d,"wxConfigBase_Type_String", PyInt_FromLong((long) wxConfigBase::Type_String));
|
PyDict_SetItemString(d,"wxConfigBase_Type_String", PyInt_FromLong((long) wxConfigBase::Type_String));
|
||||||
PyDict_SetItemString(d,"wxConfigBase_Type_Boolean", PyInt_FromLong((long) wxConfigBase::Type_Boolean));
|
PyDict_SetItemString(d,"wxConfigBase_Type_Boolean", PyInt_FromLong((long) wxConfigBase::Type_Boolean));
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -350,6 +350,200 @@ class wxTipWindow(wxTipWindowPtr):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class wxVScrolledWindowPtr(wxPanelPtr):
|
||||||
|
def __init__(self,this):
|
||||||
|
self.this = this
|
||||||
|
self.thisown = 0
|
||||||
|
def _setCallbackInfo(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow__setCallbackInfo(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def Create(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow_Create(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def SetLineCount(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow_SetLineCount(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def ScrollToLine(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow_ScrollToLine(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def ScrollLines(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow_ScrollLines(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def ScrollPages(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow_ScrollPages(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def RefreshLine(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow_RefreshLine(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def RefreshLines(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow_RefreshLines(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def HitTestXT(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow_HitTestXT(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def HitTest(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow_HitTest(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def RefreshAll(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow_RefreshAll(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def GetLineCount(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow_GetLineCount(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def GetFirstVisibleLine(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow_GetFirstVisibleLine(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def GetLastVisibleLine(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow_GetLastVisibleLine(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def IsVisible(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVScrolledWindow_IsVisible(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def __repr__(self):
|
||||||
|
return "<%s.%s instance; proxy of C++ wxVScrolledWindow instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this)
|
||||||
|
class wxVScrolledWindow(wxVScrolledWindowPtr):
|
||||||
|
def __init__(self,*_args,**_kwargs):
|
||||||
|
self.this = windows3c.new_wxVScrolledWindow(*_args,**_kwargs)
|
||||||
|
self.thisown = 1
|
||||||
|
self._setCallbackInfo(self, wxVScrolledWindow)
|
||||||
|
self._setOORInfo(self)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def wxPreVScrolledWindow(*_args,**_kwargs):
|
||||||
|
val = wxVScrolledWindowPtr(windows3c.new_wxPreVScrolledWindow(*_args,**_kwargs))
|
||||||
|
val.thisown = 1
|
||||||
|
val._setOORInfo(val)
|
||||||
|
return val
|
||||||
|
|
||||||
|
|
||||||
|
class wxVListBoxPtr(wxVScrolledWindowPtr):
|
||||||
|
def __init__(self,this):
|
||||||
|
self.this = this
|
||||||
|
self.thisown = 0
|
||||||
|
def _setCallbackInfo(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox__setCallbackInfo(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def Create(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_Create(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def GetItemCount(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_GetItemCount(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def HasMultipleSelection(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_HasMultipleSelection(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def GetSelection(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_GetSelection(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def IsCurrent(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_IsCurrent(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def IsSelected(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_IsSelected(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def GetSelectedCount(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_GetSelectedCount(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def GetFirstSelected(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_GetFirstSelected(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def GetNextSelected(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_GetNextSelected(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def GetMargins(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_GetMargins(self, *_args, **_kwargs)
|
||||||
|
if val: val = wxPointPtr(val) ; val.thisown = 1
|
||||||
|
return val
|
||||||
|
def GetSelectionBackground(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_GetSelectionBackground(self, *_args, **_kwargs)
|
||||||
|
if val: val = wxColourPtr(val)
|
||||||
|
return val
|
||||||
|
def SetItemCount(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_SetItemCount(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def Clear(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_Clear(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def SetSelection(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_SetSelection(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def Select(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_Select(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def SelectRange(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_SelectRange(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def Toggle(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_Toggle(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def SelectAll(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_SelectAll(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def DeselectAll(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_DeselectAll(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def SetMargins(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_SetMargins(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def SetMarginsXY(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_SetMarginsXY(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def SetSelectionBackground(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxVListBox_SetSelectionBackground(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def __repr__(self):
|
||||||
|
return "<%s.%s instance; proxy of C++ wxVListBox instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this)
|
||||||
|
class wxVListBox(wxVListBoxPtr):
|
||||||
|
def __init__(self,*_args,**_kwargs):
|
||||||
|
self.this = windows3c.new_wxVListBox(*_args,**_kwargs)
|
||||||
|
self.thisown = 1
|
||||||
|
self._setCallbackInfo(self, wxVListBox)
|
||||||
|
self._setOORInfo(self)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def wxPreVListBox(*_args,**_kwargs):
|
||||||
|
val = wxVListBoxPtr(windows3c.new_wxPreVListBox(*_args,**_kwargs))
|
||||||
|
val.thisown = 1
|
||||||
|
val._setOORInfo(val)
|
||||||
|
return val
|
||||||
|
|
||||||
|
|
||||||
|
class wxHtmlListBoxPtr(wxVListBoxPtr):
|
||||||
|
def __init__(self,this):
|
||||||
|
self.this = this
|
||||||
|
self.thisown = 0
|
||||||
|
def _setCallbackInfo(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxHtmlListBox__setCallbackInfo(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def Create(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxHtmlListBox_Create(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def RefreshAll(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxHtmlListBox_RefreshAll(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def SetItemCount(self, *_args, **_kwargs):
|
||||||
|
val = windows3c.wxHtmlListBox_SetItemCount(self, *_args, **_kwargs)
|
||||||
|
return val
|
||||||
|
def __repr__(self):
|
||||||
|
return "<%s.%s instance; proxy of C++ wxHtmlListBox instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this)
|
||||||
|
class wxHtmlListBox(wxHtmlListBoxPtr):
|
||||||
|
def __init__(self,*_args,**_kwargs):
|
||||||
|
self.this = windows3c.new_wxHtmlListBox(*_args,**_kwargs)
|
||||||
|
self.thisown = 1
|
||||||
|
self._setCallbackInfo(self, wxHtmlListBox)
|
||||||
|
self._setOORInfo(self)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def wxPreHtmlListBox(*_args,**_kwargs):
|
||||||
|
val = wxHtmlListBoxPtr(windows3c.new_wxPreHtmlListBox(*_args,**_kwargs))
|
||||||
|
val.thisown = 1
|
||||||
|
val._setOORInfo(val)
|
||||||
|
return val
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------- FUNCTION WRAPPERS ------------------
|
#-------------- FUNCTION WRAPPERS ------------------
|
||||||
|
@ -2389,8 +2389,6 @@ SWIGEXPORT(void) initwizardc() {
|
|||||||
PyDict_SetItemString(d,"wxEVT_WIZARD_HELP", PyInt_FromLong((long) wxEVT_WIZARD_HELP));
|
PyDict_SetItemString(d,"wxEVT_WIZARD_HELP", PyInt_FromLong((long) wxEVT_WIZARD_HELP));
|
||||||
PyDict_SetItemString(d,"wxEVT_WIZARD_FINISHED", PyInt_FromLong((long) wxEVT_WIZARD_FINISHED));
|
PyDict_SetItemString(d,"wxEVT_WIZARD_FINISHED", PyInt_FromLong((long) wxEVT_WIZARD_FINISHED));
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; _swig_mapping[i].n1; i++)
|
for (i = 0; _swig_mapping[i].n1; i++)
|
||||||
|
@ -384,7 +384,7 @@ void __wxPreStart(PyObject* moduleDict)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Ensure that the build options in the DLL (or whatever) match this build
|
// Ensure that the build options in the DLL (or whatever) match this build
|
||||||
wxApp::CheckBuildOptions(wxBuildOptions());
|
wxApp::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, "wxPython");
|
||||||
|
|
||||||
// Create an exception object to use for wxASSERTions
|
// Create an exception object to use for wxASSERTions
|
||||||
wxPyAssertionError = PyErr_NewException("wxPython.wxc.wxPyAssertionError",
|
wxPyAssertionError = PyErr_NewException("wxPython.wxc.wxPyAssertionError",
|
||||||
|
@ -790,13 +790,13 @@ extern wxPyApp *wxPythonApp;
|
|||||||
#define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
|
#define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
|
||||||
void CLASS::CBNAME(wxDC& a) { \
|
void CLASS::CBNAME(wxDC& a) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* obj = wxPyMake_wxObject(&a); \
|
PyObject* obj = wxPyMake_wxObject(&a); \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
|
||||||
Py_DECREF(obj); \
|
Py_DECREF(obj); \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(a); \
|
PCLASS::CBNAME(a); \
|
||||||
} \
|
} \
|
||||||
@ -2103,4 +2103,163 @@ extern wxPyApp *wxPythonApp;
|
|||||||
} \
|
} \
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
|
||||||
|
wxCoord CBNAME(size_t a) const
|
||||||
|
|
||||||
|
|
||||||
|
#define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
|
||||||
|
wxCoord CLASS::CBNAME(size_t a) const { \
|
||||||
|
wxCoord rval=0; \
|
||||||
|
bool found; \
|
||||||
|
wxPyBeginBlockThreads(); \
|
||||||
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
|
PyObject* ro; \
|
||||||
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
|
||||||
|
} \
|
||||||
|
wxPyEndBlockThreads(); \
|
||||||
|
return rval; \
|
||||||
|
} \
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
|
||||||
|
void CBNAME(size_t a, size_t b) const; \
|
||||||
|
void base_##CBNAME(size_t a, size_t b) const
|
||||||
|
|
||||||
|
|
||||||
|
#define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
|
||||||
|
void CLASS::CBNAME(size_t a, size_t b) const { \
|
||||||
|
bool found; \
|
||||||
|
wxPyBeginBlockThreads(); \
|
||||||
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
|
||||||
|
wxPyEndBlockThreads(); \
|
||||||
|
if (! found) \
|
||||||
|
PCLASS::CBNAME(a,b); \
|
||||||
|
} \
|
||||||
|
void CLASS::base_##CBNAME(size_t a, size_t b) const { \
|
||||||
|
PCLASS::CBNAME(a,b); \
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define DEC_PYCALLBACK_COORD_const(CBNAME) \
|
||||||
|
wxCoord CBNAME() const; \
|
||||||
|
wxCoord base_##CBNAME() const
|
||||||
|
|
||||||
|
|
||||||
|
#define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
|
||||||
|
wxCoord CLASS::CBNAME() const { \
|
||||||
|
wxCoord rval=0; \
|
||||||
|
bool found; \
|
||||||
|
wxPyBeginBlockThreads(); \
|
||||||
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
|
||||||
|
wxPyEndBlockThreads(); \
|
||||||
|
if (! found) \
|
||||||
|
rval = PCLASS::CBNAME(); \
|
||||||
|
return rval; \
|
||||||
|
} \
|
||||||
|
wxCoord CLASS::base_##CBNAME() const { \
|
||||||
|
return PCLASS::CBNAME(); \
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
|
||||||
|
void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
|
||||||
|
|
||||||
|
|
||||||
|
#define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
|
||||||
|
void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
|
||||||
|
bool found; \
|
||||||
|
wxPyBeginBlockThreads(); \
|
||||||
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
|
PyObject* obj = wxPyMake_wxObject(&a); \
|
||||||
|
PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
|
||||||
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
|
||||||
|
Py_DECREF(obj); \
|
||||||
|
} \
|
||||||
|
wxPyEndBlockThreads(); \
|
||||||
|
} \
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
|
||||||
|
void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
|
||||||
|
void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
|
||||||
|
|
||||||
|
|
||||||
|
#define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
|
||||||
|
void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
|
||||||
|
bool found; \
|
||||||
|
wxPyBeginBlockThreads(); \
|
||||||
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
|
PyObject* obj = wxPyMake_wxObject(&a); \
|
||||||
|
PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
|
||||||
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
|
||||||
|
Py_DECREF(obj); \
|
||||||
|
} \
|
||||||
|
wxPyEndBlockThreads(); \
|
||||||
|
if (! found) \
|
||||||
|
PCLASS::CBNAME(a,b,c); \
|
||||||
|
} \
|
||||||
|
void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
|
||||||
|
PCLASS::CBNAME(a,b,c); \
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
#define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
|
||||||
|
wxString CBNAME(size_t a) const; \
|
||||||
|
wxString base_##CBNAME(size_t a) const
|
||||||
|
|
||||||
|
#define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
|
||||||
|
wxString CLASS::CBNAME(size_t a) const { \
|
||||||
|
wxString rval; \
|
||||||
|
bool found; \
|
||||||
|
wxPyBeginBlockThreads(); \
|
||||||
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
|
PyObject* ro; \
|
||||||
|
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
|
||||||
|
if (ro) { \
|
||||||
|
rval = Py2wxString(ro); \
|
||||||
|
Py_DECREF(ro); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
wxPyEndBlockThreads(); \
|
||||||
|
if (! found) \
|
||||||
|
rval = PCLASS::CBNAME(a); \
|
||||||
|
return rval; \
|
||||||
|
} \
|
||||||
|
wxString CLASS::base_##CBNAME(size_t a) const { \
|
||||||
|
return PCLASS::CBNAME(a); \
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
|
||||||
|
wxString CBNAME(size_t a) const
|
||||||
|
|
||||||
|
#define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
|
||||||
|
wxString CLASS::CBNAME(size_t a) const { \
|
||||||
|
wxString rval; \
|
||||||
|
bool found; \
|
||||||
|
wxPyBeginBlockThreads(); \
|
||||||
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
|
PyObject* ro; \
|
||||||
|
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
|
||||||
|
if (ro) { \
|
||||||
|
rval = Py2wxString(ro); \
|
||||||
|
Py_DECREF(ro); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
wxPyEndBlockThreads(); \
|
||||||
|
return rval; \
|
||||||
|
} \
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -991,7 +991,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -1004,9 +1003,6 @@ public:
|
|||||||
|
|
||||||
inithtmlhelpc();
|
inithtmlhelpc();
|
||||||
|
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
|
|
||||||
wxPyPtrTypeMap_Add("wxHtmlTagHandler", "wxPyHtmlTagHandler");
|
wxPyPtrTypeMap_Add("wxHtmlTagHandler", "wxPyHtmlTagHandler");
|
||||||
wxPyPtrTypeMap_Add("wxHtmlWinTagHandler", "wxPyHtmlWinTagHandler");
|
wxPyPtrTypeMap_Add("wxHtmlWinTagHandler", "wxPyHtmlWinTagHandler");
|
||||||
wxPyPtrTypeMap_Add("wxHtmlWindow", "wxPyHtmlWindow");
|
wxPyPtrTypeMap_Add("wxHtmlWindow", "wxPyHtmlWindow");
|
||||||
|
@ -402,6 +402,7 @@ SWIGSTATICRUNTIME(char *)
|
|||||||
SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type) {
|
SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type) {
|
||||||
PyObject *sobj = obj;
|
PyObject *sobj = obj;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
if (!PyString_Check(obj)) {
|
if (!PyString_Check(obj)) {
|
||||||
if (!PyInstance_Check(obj) || !(sobj = PyObject_GetAttrString(obj,"this")))
|
if (!PyInstance_Check(obj) || !(sobj = PyObject_GetAttrString(obj,"this")))
|
||||||
return "";
|
return "";
|
||||||
|
@ -587,6 +587,8 @@ unsigned long wxGetProcessId();
|
|||||||
// When wxApp gets the virtual method magic then enable this.
|
// When wxApp gets the virtual method magic then enable this.
|
||||||
// bool wxHandleFatalExceptions(bool doIt = TRUE);
|
// bool wxHandleFatalExceptions(bool doIt = TRUE);
|
||||||
|
|
||||||
|
void wxTrap();
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
|
enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
|
||||||
|
@ -1105,9 +1105,6 @@ wxLongLong wxGetLocalTimeMillis();
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
%init %{
|
%init %{
|
||||||
// These are no longer needed since utils is back in the core
|
|
||||||
// wxClassInfo::CleanUpClasses();
|
|
||||||
// wxClassInfo::InitializeClasses();
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -337,4 +337,494 @@ public:
|
|||||||
#endif // __WXMAC__
|
#endif // __WXMAC__
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
// wxVScrolledWindow
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <wx/vscroll.h>
|
||||||
|
DECLARE_DEF_STRING(PanelNameStr);
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
// First, the C++ version
|
||||||
|
%{
|
||||||
|
class wxPyVScrolledWindow : public wxVScrolledWindow
|
||||||
|
{
|
||||||
|
DECLARE_ABSTRACT_CLASS(wxPyVScrolledWindow);
|
||||||
|
public:
|
||||||
|
wxPyVScrolledWindow() : wxVScrolledWindow() {}
|
||||||
|
|
||||||
|
wxPyVScrolledWindow(wxWindow *parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& name = wxPyPanelNameStr)
|
||||||
|
: wxVScrolledWindow(parent, id, pos, size, style, name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// Overridable virtuals
|
||||||
|
|
||||||
|
// this function must be overridden in the derived class and it should
|
||||||
|
// return the height of the given line in pixels
|
||||||
|
DEC_PYCALLBACK_COORD_SIZET_constpure(OnGetLineHeight);
|
||||||
|
|
||||||
|
|
||||||
|
// this function doesn't have to be overridden but it may be useful to do
|
||||||
|
// it if calculating the lines heights is a relatively expensive operation
|
||||||
|
// as it gives the user code a possibility to calculate several of them at
|
||||||
|
// once
|
||||||
|
//
|
||||||
|
// OnGetLinesHint() is normally called just before OnGetLineHeight() but you
|
||||||
|
// shouldn't rely on the latter being called for all lines in the interval
|
||||||
|
// specified here. It is also possible that OnGetLineHeight() will be
|
||||||
|
// called for the lines outside of this interval, so this is really just a
|
||||||
|
// hint, not a promise.
|
||||||
|
//
|
||||||
|
// finally note that lineMin is inclusive, while lineMax is exclusive, as
|
||||||
|
// usual
|
||||||
|
DEC_PYCALLBACK_VOID_SIZETSIZET_const(OnGetLinesHint);
|
||||||
|
|
||||||
|
|
||||||
|
// when the number of lines changes, we try to estimate the total height
|
||||||
|
// of all lines which is a rather expensive operation in terms of lines
|
||||||
|
// access, so if the user code may estimate the average height
|
||||||
|
// better/faster than we do, it should override this function to implement
|
||||||
|
// its own logic
|
||||||
|
//
|
||||||
|
// this function should return the best guess for the total height it may
|
||||||
|
// make
|
||||||
|
DEC_PYCALLBACK_COORD_const(EstimateTotalHeight);
|
||||||
|
|
||||||
|
|
||||||
|
// Also expose some other interesting protected methods
|
||||||
|
|
||||||
|
|
||||||
|
// find the index of the line we need to show at the top of the window such
|
||||||
|
// that the last (fully or partially) visible line is the given one
|
||||||
|
size_t FindFirstFromBottom(size_t lineLast, bool fullyVisible = false)
|
||||||
|
{ return wxVScrolledWindow::FindFirstFromBottom(lineLast, fullyVisible); }
|
||||||
|
|
||||||
|
// get the total height of the lines between lineMin (inclusive) and
|
||||||
|
// lineMax (exclusive)
|
||||||
|
wxCoord GetLinesHeight(size_t lineMin, size_t lineMax) const
|
||||||
|
{ return wxVScrolledWindow::GetLinesHeight(lineMin, lineMax); }
|
||||||
|
|
||||||
|
|
||||||
|
PYPRIVATE;
|
||||||
|
};
|
||||||
|
|
||||||
|
IMPLEMENT_ABSTRACT_CLASS(wxPyVScrolledWindow, wxVScrolledWindow);
|
||||||
|
|
||||||
|
IMP_PYCALLBACK_COORD_SIZET_constpure(wxPyVScrolledWindow, wxVScrolledWindow, OnGetLineHeight);
|
||||||
|
IMP_PYCALLBACK_VOID_SIZETSIZET_const(wxPyVScrolledWindow, wxVScrolledWindow, OnGetLinesHint);
|
||||||
|
IMP_PYCALLBACK_COORD_const (wxPyVScrolledWindow, wxVScrolledWindow, EstimateTotalHeight);
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Now define this class for SWIG
|
||||||
|
|
||||||
|
/*
|
||||||
|
In the name of this class, "V" may stand for "variable" because it can be
|
||||||
|
used for scrolling lines of variable heights; "virtual" because it is not
|
||||||
|
necessary to know the heights of all lines in advance -- only those which
|
||||||
|
are shown on the screen need to be measured; or, even, "vertical" because
|
||||||
|
this class only supports scrolling in one direction currently (this could
|
||||||
|
and probably will change in the future however).
|
||||||
|
|
||||||
|
In any case, this is a generalization of the wxScrolledWindow class which
|
||||||
|
can be only used when all lines have the same height. It lacks some other
|
||||||
|
wxScrolledWindow features however, notably it currently lacks support for
|
||||||
|
horizontal scrolling; it can't scroll another window nor only a rectangle
|
||||||
|
of the window and not its entire client area.
|
||||||
|
*/
|
||||||
|
|
||||||
|
%name(wxVScrolledWindow) class wxPyVScrolledWindow : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxPyVScrolledWindow(wxWindow *parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& name = wxPyPanelNameStr);
|
||||||
|
|
||||||
|
%name(wxPreVScrolledWindow)wxPyVScrolledWindow();
|
||||||
|
|
||||||
|
void _setCallbackInfo(PyObject* self, PyObject* _class);
|
||||||
|
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxVScrolledWindow)"
|
||||||
|
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||||
|
%pragma(python) addtomethod = "wxPreVScrolledWindow:val._setOORInfo(val)"
|
||||||
|
|
||||||
|
bool Create(wxWindow *parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& name = wxPyPanelNameStr);
|
||||||
|
|
||||||
|
|
||||||
|
// set the number of lines the window contains: the derived class must
|
||||||
|
// provide the heights for all lines with indices up to the one given here
|
||||||
|
// in its OnGetLineHeight()
|
||||||
|
void SetLineCount(size_t count);
|
||||||
|
|
||||||
|
// scroll to the specified line: it will become the first visible line in
|
||||||
|
// the window
|
||||||
|
//
|
||||||
|
// return true if we scrolled the window, false if nothing was done
|
||||||
|
bool ScrollToLine(size_t line);
|
||||||
|
|
||||||
|
// scroll by the specified number of lines/pages
|
||||||
|
virtual bool ScrollLines(int lines);
|
||||||
|
virtual bool ScrollPages(int pages);
|
||||||
|
|
||||||
|
// redraw the specified line
|
||||||
|
void RefreshLine(size_t line);
|
||||||
|
|
||||||
|
// redraw all lines in the specified range (inclusive)
|
||||||
|
void RefreshLines(size_t from, size_t to);
|
||||||
|
|
||||||
|
// return the item at the specified (in physical coordinates) position or
|
||||||
|
// wxNOT_FOUND if none, i.e. if it is below the last item
|
||||||
|
%name(HitTestXT) int HitTest(wxCoord x, wxCoord y) const;
|
||||||
|
int HitTest(const wxPoint& pt) const;
|
||||||
|
|
||||||
|
// recalculate all our parameters and redisplay all lines
|
||||||
|
virtual void RefreshAll();
|
||||||
|
|
||||||
|
|
||||||
|
// get the number of lines this window contains (previously set by
|
||||||
|
// SetLineCount())
|
||||||
|
size_t GetLineCount() const;
|
||||||
|
|
||||||
|
// get the first currently visible line
|
||||||
|
size_t GetFirstVisibleLine() const;
|
||||||
|
|
||||||
|
// get the last currently visible line
|
||||||
|
size_t GetLastVisibleLine() const;
|
||||||
|
|
||||||
|
// is this line currently visible?
|
||||||
|
bool IsVisible(size_t line) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// wxVListBox
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <wx/vlbox.h>
|
||||||
|
DECLARE_DEF_STRING(VListBoxNameStr);
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
// First, the C++ version
|
||||||
|
%{
|
||||||
|
class wxPyVListBox : public wxVListBox
|
||||||
|
{
|
||||||
|
DECLARE_ABSTRACT_CLASS(wxPyVListBox);
|
||||||
|
public:
|
||||||
|
wxPyVListBox() : wxVListBox() {}
|
||||||
|
|
||||||
|
wxPyVListBox(wxWindow *parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& name = wxPyVListBoxNameStr)
|
||||||
|
: wxVListBox(parent, id, pos, size, style, name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// Overridable virtuals
|
||||||
|
|
||||||
|
// the derived class must implement this function to actually draw the item
|
||||||
|
// with the given index on the provided DC
|
||||||
|
// virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const = 0;
|
||||||
|
DEC_PYCALLBACK__DCRECTSIZET_constpure(OnDrawItem);
|
||||||
|
|
||||||
|
|
||||||
|
// the derived class must implement this method to return the height of the
|
||||||
|
// specified item
|
||||||
|
// virtual wxCoord OnMeasureItem(size_t n) const = 0;
|
||||||
|
DEC_PYCALLBACK_COORD_SIZET_constpure(OnMeasureItem);
|
||||||
|
|
||||||
|
|
||||||
|
// this method may be used to draw separators between the lines; note that
|
||||||
|
// the rectangle may be modified, typically to deflate it a bit before
|
||||||
|
// passing to OnDrawItem()
|
||||||
|
//
|
||||||
|
// the base class version doesn't do anything
|
||||||
|
// virtual void OnDrawSeparator(wxDC& dc, wxRect& rect, size_t n) const;
|
||||||
|
DEC_PYCALLBACK__DCRECTSIZET_constpure(OnDrawSeparator);
|
||||||
|
|
||||||
|
|
||||||
|
// this method is used to draw the items background and, maybe, a border
|
||||||
|
// around it
|
||||||
|
//
|
||||||
|
// the base class version implements a reasonable default behaviour which
|
||||||
|
// consists in drawing the selected item with the standard background
|
||||||
|
// colour and drawing a border around the item if it is either selected or
|
||||||
|
// current
|
||||||
|
// virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const;
|
||||||
|
DEC_PYCALLBACK__DCRECTSIZET_const(OnDrawBackground);
|
||||||
|
|
||||||
|
|
||||||
|
PYPRIVATE;
|
||||||
|
};
|
||||||
|
|
||||||
|
IMPLEMENT_ABSTRACT_CLASS(wxPyVListBox, wxVListBox);
|
||||||
|
|
||||||
|
IMP_PYCALLBACK__DCRECTSIZET_constpure(wxPyVListBox, wxVListBox, OnDrawItem);
|
||||||
|
IMP_PYCALLBACK_COORD_SIZET_constpure (wxPyVListBox, wxVListBox, OnMeasureItem);
|
||||||
|
IMP_PYCALLBACK__DCRECTSIZET_constpure(wxPyVListBox, wxVListBox, OnDrawSeparator);
|
||||||
|
IMP_PYCALLBACK__DCRECTSIZET_const (wxPyVListBox, wxVListBox, OnDrawBackground);
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Now define this class for SWIG
|
||||||
|
|
||||||
|
/*
|
||||||
|
This class has two main differences from a regular listbox: it can have an
|
||||||
|
arbitrarily huge number of items because it doesn't store them itself but
|
||||||
|
uses OnDrawItem() callback to draw them and its items can have variable
|
||||||
|
height as determined by OnMeasureItem().
|
||||||
|
|
||||||
|
It emits the same events as wxListBox and the same event macros may be used
|
||||||
|
with it.
|
||||||
|
*/
|
||||||
|
%name(wxVListBox) class wxPyVListBox : public wxPyVScrolledWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxPyVListBox(wxWindow *parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& name = wxPyVListBoxNameStr);
|
||||||
|
|
||||||
|
%name(wxPreVListBox) wxPyVListBox();
|
||||||
|
|
||||||
|
void _setCallbackInfo(PyObject* self, PyObject* _class);
|
||||||
|
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxVListBox)"
|
||||||
|
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||||
|
%pragma(python) addtomethod = "wxPreVListBox:val._setOORInfo(val)"
|
||||||
|
|
||||||
|
|
||||||
|
bool Create(wxWindow *parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& name = wxPyVListBoxNameStr);
|
||||||
|
|
||||||
|
// get the number of items in the control
|
||||||
|
size_t GetItemCount() const;
|
||||||
|
|
||||||
|
// does this control use multiple selection?
|
||||||
|
bool HasMultipleSelection() const;
|
||||||
|
|
||||||
|
// get the currently selected item or wxNOT_FOUND if there is no selection
|
||||||
|
//
|
||||||
|
// this method is only valid for the single selection listboxes
|
||||||
|
int GetSelection() const;
|
||||||
|
|
||||||
|
// is this item the current one?
|
||||||
|
bool IsCurrent(size_t item) const;
|
||||||
|
|
||||||
|
// is this item selected?
|
||||||
|
bool IsSelected(size_t item) const;
|
||||||
|
|
||||||
|
// get the number of the selected items (maybe 0)
|
||||||
|
//
|
||||||
|
// this method is valid for both single and multi selection listboxes
|
||||||
|
size_t GetSelectedCount() const;
|
||||||
|
|
||||||
|
// get the first selected item, returns wxNOT_FOUND if none
|
||||||
|
//
|
||||||
|
// cookie is an opaque parameter which should be passed to
|
||||||
|
// GetNextSelected() later
|
||||||
|
//
|
||||||
|
// this method is only valid for the multi selection listboxes
|
||||||
|
int GetFirstSelected(unsigned long& cookie) const;
|
||||||
|
|
||||||
|
// get next selection item, return wxNOT_FOUND if no more
|
||||||
|
//
|
||||||
|
// cookie must be the same parameter that was passed to GetFirstSelected()
|
||||||
|
// before
|
||||||
|
//
|
||||||
|
// this method is only valid for the multi selection listboxes
|
||||||
|
int GetNextSelected(unsigned long& cookie) const;
|
||||||
|
|
||||||
|
// get the margins around each item
|
||||||
|
wxPoint GetMargins() const;
|
||||||
|
|
||||||
|
// get the background colour of selected cells
|
||||||
|
const wxColour& GetSelectionBackground() const;
|
||||||
|
|
||||||
|
|
||||||
|
// set the number of items to be shown in the control
|
||||||
|
//
|
||||||
|
// this is just a synonym for wxVScrolledWindow::SetLineCount()
|
||||||
|
void SetItemCount(size_t count);
|
||||||
|
|
||||||
|
// delete all items from the control
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
// set the selection to the specified item, if it is wxNOT_FOUND the
|
||||||
|
// selection is unset
|
||||||
|
//
|
||||||
|
// this function is only valid for the single selection listboxes
|
||||||
|
void SetSelection(int selection);
|
||||||
|
|
||||||
|
// selects or deselects the specified item which must be valid (i.e. not
|
||||||
|
// equal to wxNOT_FOUND)
|
||||||
|
//
|
||||||
|
// return true if the items selection status has changed or false
|
||||||
|
// otherwise
|
||||||
|
//
|
||||||
|
// this function is only valid for the multiple selection listboxes
|
||||||
|
bool Select(size_t item, bool select = true);
|
||||||
|
|
||||||
|
// selects the items in the specified range whose end points may be given
|
||||||
|
// in any order
|
||||||
|
//
|
||||||
|
// return true if any items selection status has changed, false otherwise
|
||||||
|
//
|
||||||
|
// this function is only valid for the single selection listboxes
|
||||||
|
bool SelectRange(size_t from, size_t to);
|
||||||
|
|
||||||
|
// toggle the selection of the specified item (must be valid)
|
||||||
|
//
|
||||||
|
// this function is only valid for the multiple selection listboxes
|
||||||
|
void Toggle(size_t item);
|
||||||
|
|
||||||
|
// select all items in the listbox
|
||||||
|
//
|
||||||
|
// the return code indicates if any items were affected by this operation
|
||||||
|
// (true) or if nothing has changed (false)
|
||||||
|
bool SelectAll();
|
||||||
|
|
||||||
|
// unselect all items in the listbox
|
||||||
|
//
|
||||||
|
// the return code has the same meaning as for SelectAll()
|
||||||
|
bool DeselectAll();
|
||||||
|
|
||||||
|
// set the margins: horizontal margin is the distance between the window
|
||||||
|
// border and the item contents while vertical margin is half of the
|
||||||
|
// distance between items
|
||||||
|
//
|
||||||
|
// by default both margins are 0
|
||||||
|
void SetMargins(const wxPoint& pt);
|
||||||
|
%name(SetMarginsXY) void SetMargins(wxCoord x, wxCoord y);
|
||||||
|
|
||||||
|
// change the background colour of the selected cells
|
||||||
|
void SetSelectionBackground(const wxColour& col);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// wxHtmlListBox
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <wx/htmllbox.h>
|
||||||
|
%}
|
||||||
|
|
||||||
|
// First, the C++ version
|
||||||
|
%{
|
||||||
|
class wxPyHtmlListBox : public wxHtmlListBox
|
||||||
|
{
|
||||||
|
DECLARE_ABSTRACT_CLASS(wxPyHtmlListBox);
|
||||||
|
public:
|
||||||
|
wxPyHtmlListBox() : wxHtmlListBox() {}
|
||||||
|
|
||||||
|
wxPyHtmlListBox(wxWindow *parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& name = wxPyVListBoxNameStr)
|
||||||
|
: wxHtmlListBox(parent, id, pos, size, style, name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// Overridable virtuals
|
||||||
|
|
||||||
|
// this method must be implemented in the derived class and should return
|
||||||
|
// the body (i.e. without <html>) of the HTML for the given item
|
||||||
|
DEC_PYCALLBACK_STRING_SIZET_pure(OnGetItem);
|
||||||
|
|
||||||
|
// this function may be overridden to decorate HTML returned by OnGetItem()
|
||||||
|
DEC_PYCALLBACK_STRING_SIZET(OnGetItemMarkup);
|
||||||
|
|
||||||
|
// TODO:
|
||||||
|
// // this method allows to customize the selection appearance: it may be used
|
||||||
|
// // to specify the colour of the text which normally has the given colour
|
||||||
|
// // colFg when it is inside the selection
|
||||||
|
// //
|
||||||
|
// // by default, the original colour is not used at all and all text has the
|
||||||
|
// // same (default for this system) colour inside selection
|
||||||
|
// virtual wxColour GetSelectedTextColour(const wxColour& colFg) const;
|
||||||
|
|
||||||
|
// // this is the same as GetSelectedTextColour() but allows to customize the
|
||||||
|
// // background colour -- this is even more rarely used as you can change it
|
||||||
|
// // globally using SetSelectionBackground()
|
||||||
|
// virtual wxColour GetSelectedTextBgColour(const wxColour& colBg) const;
|
||||||
|
|
||||||
|
|
||||||
|
PYPRIVATE;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
IMPLEMENT_ABSTRACT_CLASS(wxPyHtmlListBox, wxHtmlListBox)
|
||||||
|
|
||||||
|
IMP_PYCALLBACK_STRING_SIZET_pure(wxPyHtmlListBox, wxHtmlListBox, OnGetItem);
|
||||||
|
IMP_PYCALLBACK_STRING_SIZET (wxPyHtmlListBox, wxHtmlListBox, OnGetItemMarkup);
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Now define this class for SWIG
|
||||||
|
|
||||||
|
|
||||||
|
// wxHtmlListBox is a listbox whose items are wxHtmlCells
|
||||||
|
%name(wxHtmlListBox) class wxPyHtmlListBox : public wxPyVListBox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// normal constructor which calls Create() internally
|
||||||
|
wxPyHtmlListBox(wxWindow *parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& name = wxPyVListBoxNameStr);
|
||||||
|
|
||||||
|
%name(wxPreHtmlListBox) wxPyHtmlListBox();
|
||||||
|
|
||||||
|
void _setCallbackInfo(PyObject* self, PyObject* _class);
|
||||||
|
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxHtmlListBox)"
|
||||||
|
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||||
|
%pragma(python) addtomethod = "wxPreHtmlListBox:val._setOORInfo(val)"
|
||||||
|
|
||||||
|
bool Create(wxWindow *parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& name = wxPyVListBoxNameStr);
|
||||||
|
|
||||||
|
|
||||||
|
void RefreshAll();
|
||||||
|
void SetItemCount(size_t count);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -382,8 +382,6 @@ public:
|
|||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
%init %{
|
%init %{
|
||||||
wxClassInfo::CleanUpClasses();
|
|
||||||
wxClassInfo::InitializeClasses();
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user