Added the missing EVT_LIST_ITEM_SELECTED and friends.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1550 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
1999-02-01 00:11:43 +00:00
parent 9bd6a5037a
commit 73c5ed3696
7 changed files with 126 additions and 32 deletions

View File

@@ -1,7 +1,7 @@
@echo off @echo off
cd %WXWIN%\utils rem cd %WXWIN%\utils
zip -@ -r wxPython\wxPython-%1.zip < wxPython\distrib\wxPython.rsp zip -@ -r wxPython\wxPython-%1.zip < wxPython\distrib\wxPython.rsp

View File

@@ -476,6 +476,45 @@ def EVT_CALCULATE_LAYOUT(win, func):
win.Connect(-1, -1, wxEVT_EVT_CALCULATE_LAYOUT, func) win.Connect(-1, -1, wxEVT_EVT_CALCULATE_LAYOUT, func)
# wxListCtrl
def EVT_LIST_BEGIN_DRAG(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_DRAG, func)
def EVT_LIST_BEGIN_RDRAG(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_RDRAG, func)
def EVT_LIST_BEGIN_LABEL_EDIT(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, func)
def EVT_LIST_END_LABEL_EDIT(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_END_LABEL_EDIT, func)
def EVT_LIST_DELETE_ITEM(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ITEM, func)
def EVT_LIST_DELETE_ALL_ITEMS(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, func)
def EVT_LIST_GET_INFO(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_GET_INFO, func)
def EVT_LIST_SET_INFO(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_SET_INFO, func)
def EVT_LIST_ITEM_SELECTED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_SELECTED, func)
def EVT_LIST_ITEM_DESELECTED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_DESELECTED, func)
def EVT_LIST_KEY_DOWN(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_KEY_DOWN, func)
def EVT_LIST_INSERT_ITEM(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_INSERT_ITEM, func)
def EVT_LIST_COL_CLICK(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_COL_CLICK, func)
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@@ -576,7 +615,11 @@ class wxApp(wxPyApp):
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# #
# $Log$ # $Log$
# Revision 1.10 1999/02/01 00:10:39 RD
# Added the missing EVT_LIST_ITEM_SELECTED and friends.
#
# Revision 1.9 1999/01/30 07:30:09 RD # Revision 1.9 1999/01/30 07:30:09 RD
#
# Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc. # Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc.
# #
# Various cleanup, tweaks, minor additions, etc. to maintain # Various cleanup, tweaks, minor additions, etc. to maintain

View File

@@ -9,6 +9,7 @@
# Copyright: (c) 1998 by Total Control Software # Copyright: (c) 1998 by Total Control Software
# Licence: wxWindows license # Licence: wxWindows license
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
VERSION=0.5.4
# Set WXDIR to the root wxWindows directory for your system # Set WXDIR to the root wxWindows directory for your system
WXDIR = $(WXWIN) WXDIR = $(WXWIN)
@@ -259,10 +260,19 @@ SOURCES = $(GENCODEDIR)\wx.cpp $(GENCODEDIR)\wx.py \
sources : $(SOURCES) sources : $(SOURCES)
dist:
cd ..\..
wxPython\distrib\zipit.bat $(VERSION)
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# $Log$ # $Log$
# Revision 1.10 1999/02/01 00:10:40 RD
# Added the missing EVT_LIST_ITEM_SELECTED and friends.
#
# Revision 1.9 1999/01/30 07:30:13 RD # Revision 1.9 1999/01/30 07:30:13 RD
#
# Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc. # Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc.
# #
# Various cleanup, tweaks, minor additions, etc. to maintain # Various cleanup, tweaks, minor additions, etc. to maintain

View File

@@ -33,11 +33,8 @@
* and things like that. * and things like that.
* *
* $Log$ * $Log$
* Revision 1.5 1999/01/30 07:31:09 RD * Revision 1.6 1999/02/01 00:11:10 RD
* Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc. * Added the missing EVT_LIST_ITEM_SELECTED and friends.
*
* Various cleanup, tweaks, minor additions, etc. to maintain
* compatibility with the current wxWindows.
* *
************************************************************************/ ************************************************************************/
@@ -1729,7 +1726,7 @@ SWIGEXPORT(void,initwxc)() {
PyDict_SetItemString(d,"wxEVT_COMMAND_TAB_SEL_CHANGING", PyInt_FromLong((long) wxEVT_COMMAND_TAB_SEL_CHANGING)); PyDict_SetItemString(d,"wxEVT_COMMAND_TAB_SEL_CHANGING", PyInt_FromLong((long) wxEVT_COMMAND_TAB_SEL_CHANGING));
PyDict_SetItemString(d,"wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED", PyInt_FromLong((long) wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)); PyDict_SetItemString(d,"wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED", PyInt_FromLong((long) wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED));
PyDict_SetItemString(d,"wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING", PyInt_FromLong((long) wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)); PyDict_SetItemString(d,"wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING", PyInt_FromLong((long) wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING));
PyDict_SetItemString(d,"__version__", PyString_FromString("0.5.3")); PyDict_SetItemString(d,"__version__", PyString_FromString("0.5.4"));
PyDict_SetItemString(d,"cvar", SWIG_globals); PyDict_SetItemString(d,"cvar", SWIG_globals);
SWIG_addvarlink(SWIG_globals,"wxPyDefaultPosition",_wrap_wxPyDefaultPosition_get, _wrap_wxPyDefaultPosition_set); SWIG_addvarlink(SWIG_globals,"wxPyDefaultPosition",_wrap_wxPyDefaultPosition_get, _wrap_wxPyDefaultPosition_set);
SWIG_addvarlink(SWIG_globals,"wxPyDefaultSize",_wrap_wxPyDefaultSize_get, _wrap_wxPyDefaultSize_set); SWIG_addvarlink(SWIG_globals,"wxPyDefaultSize",_wrap_wxPyDefaultSize_get, _wrap_wxPyDefaultSize_set);

View File

@@ -1110,6 +1110,45 @@ def EVT_CALCULATE_LAYOUT(win, func):
win.Connect(-1, -1, wxEVT_EVT_CALCULATE_LAYOUT, func) win.Connect(-1, -1, wxEVT_EVT_CALCULATE_LAYOUT, func)
# wxListCtrl
def EVT_LIST_BEGIN_DRAG(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_DRAG, func)
def EVT_LIST_BEGIN_RDRAG(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_RDRAG, func)
def EVT_LIST_BEGIN_LABEL_EDIT(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, func)
def EVT_LIST_END_LABEL_EDIT(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_END_LABEL_EDIT, func)
def EVT_LIST_DELETE_ITEM(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ITEM, func)
def EVT_LIST_DELETE_ALL_ITEMS(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, func)
def EVT_LIST_GET_INFO(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_GET_INFO, func)
def EVT_LIST_SET_INFO(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_SET_INFO, func)
def EVT_LIST_ITEM_SELECTED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_SELECTED, func)
def EVT_LIST_ITEM_DESELECTED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_DESELECTED, func)
def EVT_LIST_KEY_DOWN(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_KEY_DOWN, func)
def EVT_LIST_INSERT_ITEM(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_INSERT_ITEM, func)
def EVT_LIST_COL_CLICK(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_COL_CLICK, func)
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@@ -1210,7 +1249,11 @@ class wxApp(wxPyApp):
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# #
# $Log$ # $Log$
# Revision 1.4 1999/01/30 07:31:12 RD # Revision 1.5 1999/02/01 00:11:12 RD
# Added the missing EVT_LIST_ITEM_SELECTED and friends.
#
# Revision 1.9 1999/01/30 07:30:09 RD
#
# Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc. # Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc.
# #
# Various cleanup, tweaks, minor additions, etc. to maintain # Various cleanup, tweaks, minor additions, etc. to maintain

View File

@@ -47,7 +47,7 @@
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#define __version__ "0.5.3" #define __version__ "0.5.4"
wxPoint wxPyDefaultPosition; wxPoint wxPyDefaultPosition;
wxSize wxPyDefaultSize; wxSize wxPyDefaultSize;
@@ -156,7 +156,11 @@ extern "C" SWIGEXPORT(void,initwindows3c)();
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// $Log$ // $Log$
// Revision 1.5 1999/02/01 00:10:41 RD
// Added the missing EVT_LIST_ITEM_SELECTED and friends.
//
// Revision 1.4 1999/01/30 07:30:16 RD // Revision 1.4 1999/01/30 07:30:16 RD
//
// Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc. // Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc.
// //
// Various cleanup, tweaks, minor additions, etc. to maintain // Various cleanup, tweaks, minor additions, etc. to maintain

View File

@@ -15,13 +15,13 @@ widget set/library must have in order to be taken seriously :-)
file from http://slashdot.org, which contains the headlines in a computer file from http://slashdot.org, which contains the headlines in a computer
friendly format. It then displays said headlines in a wxWindows list control. friendly format. It then displays said headlines in a wxWindows list control.
You can read articles using either Python's html library or an external You can read articles using either Python's html library or an external
browser. Uncheck the 'browser->internal' menu item to use the latter option. browser. Uncheck the 'browser->internal' menu item to use the latter option.
Use the settings dialog box to set how external browser is started. Use the settings dialog box to set how external browser is started.
This code is available under the wxWindows license, see elsewhere. If you This code is available under the wxWindows license, see elsewhere. If you
modify this code, be aware of the fact that slashdot.org's maintainer, modify this code, be aware of the fact that slashdot.org's maintainer,
CmdrTaco, explicitly asks 'ultramode.txt' downloaders not to do this CmdrTaco, explicitly asks 'ultramode.txt' downloaders not to do this
automatically more than twice per hour. If this feature is abused, CmdrTaco automatically more than twice per hour. If this feature is abused, CmdrTaco
may remove the ultramode file completely and that will make a *lot* of people may remove the ultramode file completely and that will make a *lot* of people
unhappy. unhappy.
@@ -50,7 +50,7 @@ class HTMLTextView(wxFrame):
self.mainmenu.Append(menu, '&File') self.mainmenu.Append(menu, '&File')
self.SetMenuBar(self.mainmenu) self.SetMenuBar(self.mainmenu)
self.CreateStatusBar(1) self.CreateStatusBar(1)
self.text = wxTextCtrl(self, -1, "", wxPyDefaultPosition, self.text = wxTextCtrl(self, -1, "", wxPyDefaultPosition,
wxPyDefaultSize, wxTE_MULTILINE | wxTE_READONLY) wxPyDefaultSize, wxTE_MULTILINE | wxTE_READONLY)
@@ -59,7 +59,7 @@ class HTMLTextView(wxFrame):
def logprint(self, x): def logprint(self, x):
self.SetStatusText(x) self.SetStatusText(x)
def OpenURL(self, url): def OpenURL(self, url):
self.url = url self.url = url
m = re.match('file:(\S+)\s*', url) m = re.match('file:(\S+)\s*', url)
@@ -95,7 +95,7 @@ class HTMLTextView(wxFrame):
self.text.SetValue(tmp.read()) self.text.SetValue(tmp.read())
self.SetTitle(url) self.SetTitle(url)
self.logprint(url) self.logprint(url)
def OnFileOpen(self, event): def OnFileOpen(self, event):
dlg = wxTextEntryDialog(self, "Enter URL to open:", "") dlg = wxTextEntryDialog(self, "Enter URL to open:", "")
if dlg.ShowModal() == wxID_OK: if dlg.ShowModal() == wxID_OK:
@@ -110,7 +110,7 @@ class HTMLTextView(wxFrame):
def OnCloseWindow(self, event): def OnCloseWindow(self, event):
self.Destroy() self.Destroy()
def ParseSlashdot(f): def ParseSlashdot(f):
art_sep = re.compile('%%\r?\n') art_sep = re.compile('%%\r?\n')
@@ -121,10 +121,10 @@ def ParseSlashdot(f):
for i in range(1,len(list)-1): for i in range(1,len(list)-1):
art_list.append(line_sep.split(list[i])) art_list.append(line_sep.split(list[i]))
return art_list return art_list
def myprint(x): def myprint(x):
print x print x
def RetrieveAsFile(host, path='', logprint = myprint): def RetrieveAsFile(host, path='', logprint = myprint):
try: try:
h = HTTP(host) h = HTTP(host)
@@ -143,10 +143,7 @@ def RetrieveAsFile(host, path='', logprint = myprint):
# f = open('/home/harm/ultramode.txt','r') # f = open('/home/harm/ultramode.txt','r')
return f return f
# This one isn't defined in the default wxPython modules...
def EVT_LIST_ITEM_SELECTED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_SELECTED, func)
class AppStatusBar(wxStatusBar): class AppStatusBar(wxStatusBar):
def __init__(self, parent): def __init__(self, parent):
wxStatusBar.__init__(self,parent, -1) wxStatusBar.__init__(self,parent, -1)
@@ -155,7 +152,7 @@ class AppStatusBar(wxStatusBar):
self.but = wxButton(self, 1001, "Refresh") self.but = wxButton(self, 1001, "Refresh")
EVT_BUTTON(self, 1001, parent.OnViewRefresh) EVT_BUTTON(self, 1001, parent.OnViewRefresh)
self.OnSize(None) self.OnSize(None)
def logprint(self,x): def logprint(self,x):
self.SetStatusText(x,1) self.SetStatusText(x,1)
@@ -172,7 +169,7 @@ class AppStatusBar(wxStatusBar):
# For example, if you're about to perform function f which may take a long # For example, if you're about to perform function f which may take a long
# time, write "Please wait" in the statusbar, then create a QuickTimer(f) # time, write "Please wait" in the statusbar, then create a QuickTimer(f)
# object to automatically call f after a short delay. That way, wxWindows # object to automatically call f after a short delay. That way, wxWindows
# will get a chance to update the statusbar before the long function is # will get a chance to update the statusbar before the long function is
# called. # called.
# FIXME: can this be done better using an OnIdle kind of thing? # FIXME: can this be done better using an OnIdle kind of thing?
class QuickTimer(wxTimer): class QuickTimer(wxTimer):
@@ -219,15 +216,15 @@ class AppFrame(wxFrame):
menu.Append(230, '&About', 'Some documentation'); menu.Append(230, '&About', 'Some documentation');
EVT_MENU(self, 230, self.OnAbout) EVT_MENU(self, 230, self.OnAbout)
self.mainmenu.Append(menu, '&Help') self.mainmenu.Append(menu, '&Help')
self.SetMenuBar(self.mainmenu) self.SetMenuBar(self.mainmenu)
self.BrowserSettings = "netscape -remote 'OpenURL(%s, new_window)'" self.BrowserSettings = "netscape -remote 'OpenURL(%s, new_window)'"
# A status bar to tell people what's happening # A status bar to tell people what's happening
self.sb = AppStatusBar(self) self.sb = AppStatusBar(self)
self.SetStatusBar(self.sb) self.SetStatusBar(self.sb)
self.list = wxListCtrl(self, 1100) self.list = wxListCtrl(self, 1100)
self.list.SetSingleStyle(wxLC_REPORT) self.list.SetSingleStyle(wxLC_REPORT)
self.list.InsertColumn(0, 'Subject') self.list.InsertColumn(0, 'Subject')
@@ -240,14 +237,14 @@ class AppFrame(wxFrame):
self.list.SetColumnWidth(3, 100) self.list.SetColumnWidth(3, 100)
EVT_LIST_ITEM_SELECTED(self, 1100, self.OnItemSelected) EVT_LIST_ITEM_SELECTED(self, 1100, self.OnItemSelected)
self.logprint("Connecting to slashdot... Please wait.") self.logprint("Connecting to slashdot... Please wait.")
# Need a longer time here. Don't really know why # Need a longer time here. Don't really know why
self.timer = QuickTimer(self.DoRefresh, 1000) self.timer = QuickTimer(self.DoRefresh, 1000)
def logprint(self, x): def logprint(self, x):
self.sb.logprint(x) self.sb.logprint(x)
def OnFileExit(self, event): def OnFileExit(self, event):
self.Destroy() self.Destroy()
@@ -305,7 +302,7 @@ class AppFrame(wxFrame):
self.UseInternal = 1 self.UseInternal = 1
else: else:
self.UseInternal = 0 self.UseInternal = 0
def OnBrowserSettings(self, event): def OnBrowserSettings(self, event):
dlg = wxTextEntryDialog(self, "Enter command to view URL.\nUse %s as a placeholder for the URL.", "", self.BrowserSettings); dlg = wxTextEntryDialog(self, "Enter command to view URL.\nUse %s as a placeholder for the URL.", "", self.BrowserSettings);
if dlg.ShowModal() == wxID_OK: if dlg.ShowModal() == wxID_OK:
@@ -314,11 +311,11 @@ class AppFrame(wxFrame):
def OnAbout(self, event): def OnAbout(self, event):
dlg = wxMessageDialog(self, __doc__, "wxSlash", wxOK | wxICON_INFORMATION) dlg = wxMessageDialog(self, __doc__, "wxSlash", wxOK | wxICON_INFORMATION)
dlg.ShowModal() dlg.ShowModal()
def OnItemSelected(self, event): def OnItemSelected(self, event):
self.current = event.m_itemIndex self.current = event.m_itemIndex
self.logprint("URL: %s" % (self.url[self.current])) self.logprint("URL: %s" % (self.url[self.current]))
def OnCloseWindow(self, event): def OnCloseWindow(self, event):
self.Destroy() self.Destroy()