Initial version

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@485 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
1998-08-09 08:31:08 +00:00
parent b6a69abc7d
commit 7bf854050f
51 changed files with 49938 additions and 0 deletions
+133
View File
@@ -0,0 +1,133 @@
wxPython README
---------------
Introduction
------------
The code in this subtree is a Python Extension Module that enables the
use of wxWindows from the Python language. So what is Python? Go to
http://www.python.org to learn more but in a nutshell, it's an
extremly cool object oriented language. It's easier than Perl and
nearly as powerful. It runs on more platforms than Java, and by some
reports, is even faster than Java with a JIT compiler!
So why would you wan to use wxPython over just C++ and wxWindows?
Personally I prefer using Python for everything. I only use C++ when
I absolutly have to eek more performance out of an algorithm, and even
then I ususally code it as an extension module and leave the majority
of the program in Python. Another good thing to use wxPython for is
quick prototyping of your wxWindows apps. With C++ you have to
continuously go though the edit-compile-link-run cycle, which can be
quite time comsuming. With Python it is only an edit-run cycle. You
can easily build an application in a few hours with Python that would
normally take a few days with C++. Converting a wxPython app to a
C++/wxWindows app should be a straight forward task.
This extension module attempts to mirror the class heiarchy of
wxWindows as closely as possble. This means that there is a wxFrame
class in wxPython that looks, smells, tastes and acts almost the same
as the wxFrame class in the C++ version. Unfortunatly, I wasn't able
to match things exactly because of differences in the languages, but
the differences should be easy to absorb because they are natural to
Python. For example, some methods that return mutliple values via
argument pointers in C++ will return a tuple of values in Python.
These differences have not been documented yet so if something isn't
working the same as described in the wxWindows documents the best
thing to do is to scan through the wxPython sources.
Currently this extension module is designed such that the entire
application will be written in Python. I havn't tried it yet, but I
am sure that attempting to embed wxPython in a C++ wxWindows
application will cause problems. However there is a plan to support
this in the future.
Build Instructions
------------------
I used SWIG (http://www.swig.org) to create the source code for the
extension module. This enabled me to only have to deal with a small
amount of code an only have to bother with the exceptional issues.
SWIG takes care of the rest and generates all the repetative code for
me. You don't need SWIG to build the extension module as all the
generated C++ code is included in the src directory.
wxPython is organized as a Python package. This means that the
directory containing the results of the build process should be a
subdirectory of a directory on the PYTHONPATH. (And preferably should
be named wxPython.) You can control where the bulid process will dump
wxPython by setting the TARGETDIR makefile variable. The default is
$(WXWIN)/utils/wxPython, where this README.txt is located. If you
leave it here then you should add $(WXWIN)/utils to your PYTHONPATH.
However, you may prefer to use something that is already on your
PYTHONPATH, such as the site-packages directory on Unix systems.
Win32
-----
1. Build wxWindows with USE_RESOURCE_LOADING_IN_MSW set to 1 in
include/wx/msw/setup.h so icons can be loaded dynamically.
2. Change into the $(WXWIN)/utils/wxPython/src directory.
3. Edit makefile.nt and specify where your python installation is at.
You may also want to fiddle with the TARGETDIR variable as described
above.
4. Run nmake -f makefile.nt
5. If it builds successfully, congratulations! Move on to the next
step. If not then you can try mailing me for help. Also, I will
always have a pre-built win32 version of this module at
http://starship.skyport.net/crew/robind/python.
6. Change to the $(WXWIN)/utils/wxPython/tests directory.
7. Try executing the test programs. Note that some of these print
diagnositc or test info to standard output, so they will require the
console version of python. For example:
python test1.py
To run them without requiring a console, you can use the pythonw.exe
version of Python either from the command line or from a shortcut.
Unix
----
NOTE: I don't have wxPython working yet with wxGTK, so if you aren't
using Win32 you can skip the rest of this file and check back in a
week or so.
1. Change into the $(WXWIN)/utils/wxPython/src directory.
2. Edit Setup.in and ensure that the flags, directories, and toolkit
options are correct. See the above commentary about TARGETDIR.
3. Run this command to generate a makefile:
make -f Makefile.pre.in boot
4. Run these commands to build and then install the wxPython extension
module:
make
make install
5. Change to the $(WXWIN)/utils/wxPython/tests directory.
6. Try executing the test programs. For example:
python test1.py
------------------------
8/8/1998
Robin Dunn
robind@earthling.net
+34
View File
@@ -0,0 +1,34 @@
wxPython TODO List
------------------
These are the major tasks to be done on wxPython:
1. Get it working for wxGTK.
2. Figure out how to do embedding of wxPython in a wxWindows C++
application.
Actually, now that I think about it it might actually work. We
just need to ensure that __wxStart is not called and that a wxApp
is not created. So this task becomes: Create a test case for
embedding wxPython in a C++ app. Should also create some helper
functions for passing window objects into the Python code, etc.
3. Derived Python classes should have the ability to call the standard
On** methods in the base class.
4. There are some virtual On** and other methods in wxWindows that
should end up being callbacks in derived python classes, but they are
not called via the standard event system. Is there any way to hook
into these and call Python methods (if they exist in the derived
class) without having to derive a specialized C++ class?
5. Add the Doc/View related classes
6. Add the Printing related classes
7. Document the differences (method signatures, new methods to
compensate for no overloading, etc.) between wxPython and wxWindows.
8.
+377
View File
@@ -0,0 +1,377 @@
# Universal Unix Makefile for Python extensions
# =============================================
# Short Instructions
# ------------------
# 1. Build and install Python (1.5 or newer).
# 2. "make -f Makefile.pre.in boot"
# 3. "make"
# You should now have a shared library.
# Long Instructions
# -----------------
# Build *and install* the basic Python 1.5 distribution. See the
# Python README for instructions. (This version of Makefile.pre.in
# only withs with Python 1.5, alpha 3 or newer.)
# Create a file Setup.in for your extension. This file follows the
# format of the Modules/Setup.in file; see the instructions there.
# For a simple module called "spam" on file "spammodule.c", it can
# contain a single line:
# spam spammodule.c
# You can build as many modules as you want in the same directory --
# just have a separate line for each of them in the Setup.in file.
# If you want to build your extension as a shared library, insert a
# line containing just the string
# *shared*
# at the top of your Setup.in file.
# Note that the build process copies Setup.in to Setup, and then works
# with Setup. It doesn't overwrite Setup when Setup.in is changed, so
# while you're in the process of debugging your Setup.in file, you may
# want to edit Setup instead, and copy it back to Setup.in later.
# (All this is done so you can distribute your extension easily and
# someone else can select the modules they actually want to build by
# commenting out lines in the Setup file, without editing the
# original. Editing Setup is also used to specify nonstandard
# locations for include or library files.)
# Copy this file (Misc/Makefile.pre.in) to the directory containing
# your extension.
# Run "make -f Makefile.pre.in boot". This creates Makefile
# (producing Makefile.pre and sedscript as intermediate files) and
# config.c, incorporating the values for sys.prefix, sys.exec_prefix
# and sys.version from the installed Python binary. For this to work,
# the python binary must be on your path. If this fails, try
# make -f Makefile.pre.in Makefile VERSION=1.5 installdir=<prefix>
# where <prefix> is the prefix used to install Python for installdir
# (and possibly similar for exec_installdir=<exec_prefix>).
# Note: "make boot" implies "make clobber" -- it assumes that when you
# bootstrap you may have changed platforms so it removes all previous
# output files.
# If you are building your extension as a shared library (your
# Setup.in file starts with *shared*), run "make" or "make sharedmods"
# to build the shared library files. If you are building a statically
# linked Python binary (the only solution of your platform doesn't
# support shared libraries, and sometimes handy if you want to
# distribute or install the resulting Python binary), run "make
# python".
# Note: Each time you edit Makefile.pre.in or Setup, you must run
# "make Makefile" before running "make".
# Hint: if you want to use VPATH, you can start in an empty
# subdirectory and say (e.g.):
# make -f ../Makefile.pre.in boot srcdir=.. VPATH=..
# === Bootstrap variables (edited through "make boot") ===
# The prefix used by "make inclinstall libainstall" of core python
installdir= /usr/local
# The exec_prefix used by the same
exec_installdir=$(installdir)
# Source directory and VPATH in case you want to use VPATH.
# (You will have to edit these two lines yourself -- there is no
# automatic support as the Makefile is not generated by
# config.status.)
srcdir= .
VPATH= .
# === Variables that you may want to customize (rarely) ===
# (Static) build target
TARGET= python
# Installed python binary (used only by boot target)
PYTHON= python
# Add more -I and -D options here
CFLAGS= $(OPT) -I$(INCLUDEPY) -I$(EXECINCLUDEPY) $(DEFS)
# These two variables can be set in Setup to merge extensions.
# See example[23].
BASELIB=
BASESETUP=
# === Variables set by makesetup ===
MODOBJS= _MODOBJS_
MODLIBS= _MODLIBS_
# === Definitions added by makesetup ===
# === Variables from configure (through sedscript) ===
VERSION= @VERSION@
CC= @CC@
LINKCC= @LINKCC@
SGI_ABI= @SGI_ABI@
OPT= @OPT@
LDFLAGS= @LDFLAGS@
LDLAST= @LDLAST@
DEFS= @DEFS@
LIBS= @LIBS@
LIBM= @LIBM@
LIBC= @LIBC@
RANLIB= @RANLIB@
MACHDEP= @MACHDEP@
SO= @SO@
LDSHARED= @LDSHARED@
CCSHARED= @CCSHARED@
LINKFORSHARED= @LINKFORSHARED@
#@SET_CCC@
# Install prefix for architecture-independent files
prefix= /usr/local
# Install prefix for architecture-dependent files
exec_prefix= $(prefix)
# === Fixed definitions ===
# Shell used by make (some versions default to the login shell, which is bad)
SHELL= /bin/sh
# Expanded directories
BINDIR= $(exec_installdir)/bin
LIBDIR= $(exec_prefix)/lib
MANDIR= $(installdir)/man
INCLUDEDIR= $(installdir)/include
SCRIPTDIR= $(prefix)/lib
# Detailed destination directories
BINLIBDEST= $(LIBDIR)/python$(VERSION)
LIBDEST= $(SCRIPTDIR)/python$(VERSION)
INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
EXECINCLUDEPY= $(exec_installdir)/include/python$(VERSION)
LIBP= $(exec_installdir)/lib/python$(VERSION)
DESTSHARED= $(BINLIBDEST)/site-packages
LIBPL= $(LIBP)/config
PYTHONLIBS= $(LIBPL)/libpython$(VERSION).a
MAKESETUP= $(LIBPL)/makesetup
MAKEFILE= $(LIBPL)/Makefile
CONFIGC= $(LIBPL)/config.c
CONFIGCIN= $(LIBPL)/config.c.in
SETUP= $(LIBPL)/Setup
SYSLIBS= $(LIBM) $(LIBC)
ADDOBJS= $(LIBPL)/python.o config.o
# Portable install script (configure doesn't always guess right)
INSTALL= $(LIBPL)/install-sh -c
# Shared libraries must be installed with executable mode on some systems;
# rather than figuring out exactly which, we always give them executable mode.
# Also, making them read-only seems to be a good idea...
INSTALL_SHARED= ${INSTALL} -m 555
# === Fixed rules ===
# Default target. This builds shared libraries only
default: sharedmods
# Build everything
all: static sharedmods
# Build shared libraries from our extension modules
sharedmods: $(SHAREDMODS)
# Build a static Python binary containing our extension modules
static: $(TARGET)
$(TARGET): $(ADDOBJS) lib.a $(PYTHONLIBS) Makefile $(BASELIB)
$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) \
$(ADDOBJS) lib.a $(PYTHONLIBS) \
$(LINKPATH) $(BASELIB) $(MODLIBS) $(LIBS) $(SYSLIBS) \
-o $(TARGET) $(LDLAST)
#------------------------------------------------------------------------
#------------------------------------------------------------------------
# This is a defaul version of the install target for wxPython. It just
# redirects to wxInstall below...
install: wxInstall
#install: sharedmods
# if test ! -d $(DESTSHARED) ; then \
# mkdir $(DESTSHARED) ; else true ; fi
# -for i in X $(SHAREDMODS); do \
# if test $$i != X; \
# then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
# fi; \
# done
# Build the library containing our extension modules
lib.a: $(MODOBJS)
-rm -f lib.a
ar cr lib.a $(MODOBJS)
-$(RANLIB) lib.a
# This runs makesetup *twice* to use the BASESETUP definition from Setup
config.c Makefile: Makefile.pre Setup $(BASESETUP) $(MAKESETUP)
$(MAKESETUP) \
-m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)
$(MAKE) -f Makefile do-it-again
# Internal target to run makesetup for the second time
do-it-again:
$(MAKESETUP) \
-m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)
# Make config.o from the config.c created by makesetup
config.o: config.c
$(CC) $(CFLAGS) -c config.c
# Setup is copied from Setup.in *only* if it doesn't yet exist
Setup:
cp $(srcdir)/Setup.in Setup
# Make the intermediate Makefile.pre from Makefile.pre.in
Makefile.pre: Makefile.pre.in sedscript
sed -f sedscript $(srcdir)/Makefile.pre.in >Makefile.pre
# Shortcuts to make the sed arguments on one line
P=prefix
E=exec_prefix
H=Generated automatically from Makefile.pre.in by sedscript.
L=LINKFORSHARED
# Make the sed script used to create Makefile.pre from Makefile.pre.in
sedscript: $(MAKEFILE)
sed -n \
-e '1s/.*/1i\\/p' \
-e '2s%.*%# $H%p' \
-e '/^VERSION=/s/^VERSION=[ ]*\(.*\)/s%@VERSION[@]%\1%/p' \
-e '/^CC=/s/^CC=[ ]*\(.*\)/s%@CC[@]%\1%/p' \
-e '/^CCC=/s/^CCC=[ ]*\(.*\)/s%#@SET_CCC[@]%CCC=\1%/p' \
-e '/^LINKCC=/s/^LINKCC=[ ]*\(.*\)/s%@LINKCC[@]%\1%/p' \
-e '/^OPT=/s/^OPT=[ ]*\(.*\)/s%@OPT[@]%\1%/p' \
-e '/^LDFLAGS=/s/^LDFLAGS=[ ]*\(.*\)/s%@LDFLAGS[@]%\1%/p' \
-e '/^DEFS=/s/^DEFS=[ ]*\(.*\)/s%@DEFS[@]%\1%/p' \
-e '/^LIBS=/s/^LIBS=[ ]*\(.*\)/s%@LIBS[@]%\1%/p' \
-e '/^LIBM=/s/^LIBM=[ ]*\(.*\)/s%@LIBM[@]%\1%/p' \
-e '/^LIBC=/s/^LIBC=[ ]*\(.*\)/s%@LIBC[@]%\1%/p' \
-e '/^RANLIB=/s/^RANLIB=[ ]*\(.*\)/s%@RANLIB[@]%\1%/p' \
-e '/^MACHDEP=/s/^MACHDEP=[ ]*\(.*\)/s%@MACHDEP[@]%\1%/p' \
-e '/^SO=/s/^SO=[ ]*\(.*\)/s%@SO[@]%\1%/p' \
-e '/^LDSHARED=/s/^LDSHARED=[ ]*\(.*\)/s%@LDSHARED[@]%\1%/p' \
-e '/^CCSHARED=/s/^CCSHARED=[ ]*\(.*\)/s%@CCSHARED[@]%\1%/p' \
-e '/^$L=/s/^$L=[ ]*\(.*\)/s%@$L[@]%\1%/p' \
-e '/^$P=/s/^$P=\(.*\)/s%^$P=.*%$P=\1%/p' \
-e '/^$E=/s/^$E=\(.*\)/s%^$E=.*%$E=\1%/p' \
$(MAKEFILE) >sedscript
echo "/^#@SET_CCC@/d" >>sedscript
echo "/^installdir=/s%=.*%= $(installdir)%" >>sedscript
echo "/^exec_installdir=/s%=.*%=$(exec_installdir)%" >>sedscript
echo "/^srcdir=/s%=.*%= $(srcdir)%" >>sedscript
echo "/^VPATH=/s%=.*%= $(VPATH)%" >>sedscript
echo "/^LINKPATH=/s%=.*%= $(LINKPATH)%" >>sedscript
echo "/^BASELIB=/s%=.*%= $(BASELIB)%" >>sedscript
echo "/^BASESETUP=/s%=.*%= $(BASESETUP)%" >>sedscript
# Bootstrap target
boot: clobber
VERSION=`$(PYTHON) -c "import sys; print sys.version[:3]"`; \
installdir=`$(PYTHON) -c "import sys; print sys.prefix"`; \
exec_installdir=`$(PYTHON) -c "import sys; print sys.exec_prefix"`; \
$(MAKE) -f $(srcdir)/Makefile.pre.in VPATH=$(VPATH) srcdir=$(srcdir) \
VERSION=$$VERSION \
installdir=$$installdir \
exec_installdir=$$exec_installdir \
Makefile
# Handy target to remove intermediate files and backups
clean:
-rm -f *.o *~
# Handy target to remove everything that is easily regenerated
clobber: clean
-rm -f *.a tags TAGS config.c Makefile.pre $(TARGET) sedscript
-rm -f *.so *.sl so_locations
# Handy target to remove everything you don't want to distribute
distclean: clobber
-rm -f Makefile Setup
#------------------------------------------------------------------------
#------------------------------------------------------------------------
# Custom rules and dependencies added for wxPython
#
SWIGFLAGS=-c++ -shadow -python -dnone
ifndef FINAL
PYEXT=pyc
PYTHON=python
else
PYEXT=pyo
PYTHON=python -O
endif
PYMODULES = wxp.py events.py windows.py misc.py \
gdi.py mdi.py controls.py controls2.py \
windows2.py cmndlgs.py __init__.py
# Implicit rules to run SWIG
%.cpp : %.i
swig $(SWIGFLAGS) -c -o $*.cpp $*.i
$(TARGETDIR)/%.py : %.py
cp $< $@
$(TARGETDIR)/%.$(PYEXT) : %.py
$(PYTHON) -c "import py_compile; py_compile.compile('$<', '$@')"
%.py : %.i
swig $(SWIGFLAGS) -c -o $*.cpp $*.i
# This one must leave out the -c flag so we define the whole rule
wxp.cpp wxp.py : wxp.i my_typemaps.i _defs.i _extras.py
swig $(SWIGFLAGS) -o wxp.cpp wxp.i
# define some dependencies
windows.cpp windows.py : windows.i my_typemaps.i _defs.i
windows2.cpp windows2.py : windows2.i my_typemaps.i _defs.i
events.cpp events.py : events.i my_typemaps.i _defs.i
misc.cpp misc.py : misc.i my_typemaps.i _defs.i
gdi.cpp gdi.py : gdi.i my_typemaps.i _defs.i
mdi.cpp mdi.py : mdi.i my_typemaps.i _defs.i
controls.cpp controls.py : controls.i my_typemaps.i _defs.i
controls2.cpp controls2.py : controls2.i my_typemaps.i _defs.i
cmndlgs.cpp cmndlgs.py : cmndlgs.i my_typemaps.i _defs.i
wxInstall : sharedmods $(PYMODULES)
if test ! -d $(TARGETDIR) ; then \
mkdir $(TARGETDIR) ; else true ; fi
-for i in $(SHAREDMODS); do \
$(INSTALL_SHARED) $$i $(TARGETDIR)/$$i; \
done
-for i in $(PYMODULES); do \
$(INSTALL) $$i $(TARGETDIR)/$$i; \
done
python $(LIBDEST)/compileall.py -l $(TARGETDIR)
python -O $(LIBDEST)/compileall.py -l $(TARGETDIR)
+18
View File
@@ -0,0 +1,18 @@
# This file gives the details of what is needed to uild this extension
# module so the Makefile can be created.
*shared*
CCC=c++
WXWIN=../../..
## Pick one of these, or set your own
#TARGETDIR=$(BINLIBDEST)/site-packages/wxPython
TARGETDIR=..
wxpc wxp.cpp helpers.cpp windows.cpp events.cpp misc.cpp gdi.cpp \
mdi.cpp controls.cpp controls2.cpp windows2.cpp cmndlgs.cpp \
-I$(WXWIN)/include -I/usr/lib/glib/include \
-DSWIG_GLOBAL -D__WXGTK__ -L$(WXWIN)/lib/Linux -lwx_gtk
+24
View File
@@ -0,0 +1,24 @@
#----------------------------------------------------------------------------
# Name: __init__.py
# Purpose: The presence of this file turs this directory into a
# Python package. For simplicity, we import all of the
# wxPython package at this point, so users only need to
# import the package.
#
# Author: Robin Dunn
#
# Created: 8/8/98
# RCS-ID: $Id$
# Copyright: (c) 1998 by Total Control Software
# Licence: wxWindows license
#----------------------------------------------------------------------------
from wxp import *
#----------------------------------------------------------------------------
#
# $Log$
# Revision 1.1 1998/08/09 08:25:49 RD
# Initial version
#
#
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+293
View File
@@ -0,0 +1,293 @@
%module cmndlgs
%{
/////////////////////////////////////////////////////////////////////////////
// Name: cmndlgs.i
// Purpose: SWIG definitions for the Common Dialog Classes
//
// Author: Robin Dunn
//
// Created: 7/25/98
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#include "helpers.h"
#include <wx/colordlg.h>
#include <wx/dirdlg.h>
#include <wx/fontdlg.h>
#include <wx/printdlg.h>
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import misc.i
%import gdi.i
%import windows.i
//----------------------------------------------------------------------
class wxColourData {
public:
wxColourData();
~wxColourData();
bool GetChooseFull();
wxColour& GetColour();
wxColour& GetCustomColour(int i);
void SetChooseFull(int flag);
void SetColour(const wxColour& colour);
void SetCustomColour(int i, const wxColour& colour);
};
class wxColourDialog : public wxDialog {
public:
wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
wxColourData& GetColourData();
int ShowModal();
};
//----------------------------------------------------------------------
class wxDirDialog : public wxDialog {
public:
wxDirDialog(wxWindow* parent,
char* message = "Choose a directory",
char* defaultPath = "",
long style = 0,
const wxPoint& pos = wxPyDefaultPosition);
wxString GetPath();
wxString GetMessage();
long GetStyle();
void SetMessage(const wxString& message);
void SetPath(const wxString& path);
int ShowModal();
};
//----------------------------------------------------------------------
class wxFileDialog : public wxDialog {
public:
wxFileDialog(wxWindow* parent,
char* message = "Choose a file",
char* defaultDir = "",
char* defaultFile = "",
char* wildcard = "*.*",
long style = 0,
const wxPoint& pos = wxPyDefaultPosition);
wxString GetDirectory();
wxString GetFilename();
int GetFilterIndex();
wxString GetMessage();
wxString GetPath();
long GetStyle();
wxString GetWildcard();
void SetDirectory(const wxString& directory);
void SetFilename(const wxString& setfilename);
void SetFilterIndex(int filterIndex);
void SetMessage(const wxString& message);
void SetPath(const wxString& path);
void SetStyle(long style);
void SetWildcard(const wxString& wildCard);
int ShowModal();
};
//----------------------------------------------------------------------
//TODO: wxMultipleChoiceDialog
//----------------------------------------------------------------------
class wxSingleChoiceDialog : public wxDialog {
public:
%addmethods {
// TODO: ignoring clientData for now...
// SWIG is messing up the &/*'s for some reason.
wxSingleChoiceDialog(wxWindow* parent,
wxString* message,
wxString* caption,
int LCOUNT, wxString* LIST,
//char** clientData = NULL,
long style = wxOK | wxCANCEL | wxCENTRE,
wxPoint* pos = &wxPyDefaultPosition) {
return new wxSingleChoiceDialog(parent, *message, *caption,
LCOUNT, LIST, NULL, style, *pos);
}
}
int GetSelection();
wxString GetStringSelection();
void SetSelection(int sel);
int ShowModal();
};
//----------------------------------------------------------------------
class wxTextEntryDialog : public wxDialog {
public:
wxTextEntryDialog(wxWindow* parent,
char* message,
char* caption = "Input Text",
char* defaultValue = "",
long style = wxOK | wxCANCEL | wxCENTRE,
const wxPoint& pos = wxPyDefaultPosition);
wxString GetValue();
void SetValue(const wxString& value);
int ShowModal();
};
//----------------------------------------------------------------------
class wxFontData {
public:
wxFontData();
~wxFontData();
void EnableEffects(bool enable);
bool GetAllowSymbols();
wxColour& GetColour();
wxFont GetChosenFont();
bool GetEnableEffects();
wxFont GetInitialFont();
bool GetShowHelp();
void SetAllowSymbols(bool allowSymbols);
void SetChosenFont(const wxFont& font);
void SetColour(const wxColour& colour);
void SetInitialFont(const wxFont& font);
void SetRange(int min, int max);
void SetShowHelp(bool showHelp);
};
class wxFontDialog : public wxDialog {
public:
wxFontDialog(wxWindow* parent, wxFontData* data = NULL);
wxFontData& GetFontData();
int ShowModal();
};
//----------------------------------------------------------------------
class wxPageSetupData {
public:
wxPageSetupData();
~wxPageSetupData();
void EnableHelp(bool flag);
void EnableMargins(bool flag);
void EnableOrientation(bool flag);
void EnablePaper(bool flag);
void EnablePrinter(bool flag);
wxPoint GetPaperSize();
wxPoint GetMarginTopLeft();
wxPoint GetMarginBottomRight();
wxPoint GetMinMarginTopLeft();
wxPoint GetMinMarginBottomRight();
int GetOrientation();
bool GetDefaultMinMargins();
bool GetEnableMargins();
bool GetEnableOrientation();
bool GetEnablePaper();
bool GetEnablePrinter();
bool GetEnableHelp();
bool GetDefaultInfo();
void SetPaperSize(const wxPoint& size);
void SetMarginTopLeft(const wxPoint& pt);
void SetMarginBottomRight(const wxPoint& pt);
void SetMinMarginTopLeft(const wxPoint& pt);
void SetMinMarginBottomRight(const wxPoint& pt);
void SetOrientation(int orientation);
void SetDefaultMinMargins(bool flag);
void SetDefaultInfo(bool flag);
};
class wxPageSetupDialog : public wxDialog {
public:
wxPageSetupDialog(wxWindow* parent, wxPageSetupData* data = NULL);
wxPageSetupData& GetPageSetupData();
int ShowModal();
};
//----------------------------------------------------------------------
class wxPrintData {
public:
wxPrintData();
~wxPrintData();
void EnableHelp(bool flag);
void EnablePageNumbers(bool flag);
void EnablePrintToFile(bool flag);
void EnableSelection(bool flag);
bool GetAllPages();
bool GetCollate();
int GetFromPage();
int GetMaxPage();
int GetMinPage();
int GetNoCopies();
int GetOrientation();
int GetToPage();
void SetCollate(bool flag);
void SetFromPage(int page);
void SetMaxPage(int page);
void SetMinPage(int page);
void SetOrientation(int orientation);
void SetNoCopies(int n);
void SetPrintToFile(bool flag);
void SetSetupDialog(bool flag);
void SetToPage(int page);
};
class wxPrintDialog : public wxDialog {
public:
wxPrintDialog(wxWindow* parent, wxPrintData* data = NULL);
wxPrintData& GetPrintData();
wxDC* GetPrintDC();
int ShowModal();
};
//----------------------------------------------------------------------
class wxMessageDialog : public wxDialog {
public:
wxMessageDialog(wxWindow* parent,
char* message,
char* caption = "Message box",
long style = wxOK | wxCANCEL | wxCENTRE,
const wxPoint& pos = wxPyDefaultPosition);
int ShowModal();
};
//----------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//
// $Log$
// Revision 1.1 1998/08/09 08:25:49 RD
// Initial version
//
//
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+426
View File
@@ -0,0 +1,426 @@
%module controls
%{
/////////////////////////////////////////////////////////////////////////////
// Name: controls.i
// Purpose: Control (widget) classes for wxPython
//
// Author: Robin Dunn
//
// Created: 6/10/98
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#include "helpers.h"
#include <wx/slider.h>
#include <wx/spinbutt.h>
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import misc.i
%import windows.i
%import gdi.i
%import events.i
//----------------------------------------------------------------------
%{
wxValidator wxPyDefaultValidator; // Non-const default because of SWIG
%}
//----------------------------------------------------------------------
class wxControl : public wxWindow {
public:
void Command(wxCommandEvent& event);
wxString& GetLabel();
void SetLabel(const wxString& label);
};
//----------------------------------------------------------------------
class wxButton : public wxControl {
public:
wxButton(wxWindow* parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = 0,
const wxValidator& validator = wxPyDefaultValidator,
char* name = "button");
void SetDefault();
};
//----------------------------------------------------------------------
class wxBitmapButton : public wxButton {
public:
wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxBU_AUTODRAW,
const wxValidator& validator = wxPyDefaultValidator,
char* name = "button");
wxBitmap& GetBitmapDisabled();
wxBitmap& GetBitmapFocus();
wxBitmap& GetBitmapLabel();
wxBitmap& GetBitmapSelected();
void SetBitmapDisabled(const wxBitmap& bitmap);
void SetBitmapFocus(const wxBitmap& bitmap);
void SetBitmapLabel(const wxBitmap& bitmap);
void SetBitmapSelected(const wxBitmap& bitmap);
};
//----------------------------------------------------------------------
class wxCheckBox : public wxControl {
public:
wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = 0,
const wxValidator& val = wxPyDefaultValidator,
char* name = "checkBox");
bool GetValue();
void SetValue(const bool state);
};
//----------------------------------------------------------------------
class wxChoice : public wxControl {
public:
wxChoice(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
int LCOUNT=0, wxString* LIST=NULL,
long style = 0,
const wxValidator& validator = wxPyDefaultValidator,
char* name = "choice");
void Append(const wxString& item);
void Clear();
int FindString(const wxString& string);
int GetColumns();
int GetSelection();
wxString GetString(const int n);
wxString GetStringSelection();
int Number();
void SetColumns(const int n = 1);
void SetSelection(const int n);
void SetStringSelection(const wxString& string);
};
//----------------------------------------------------------------------
class wxComboBox : public wxControl {
public:
wxComboBox(wxWindow* parent, wxWindowID id, char* value = "",
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
int LCOUNT=0, wxString* LIST=NULL,
long style = 0,
const wxValidator& validator = wxPyDefaultValidator,
char* name = "comboBox");
void Append(const wxString& item);
// TODO: void Append(const wxString& item, char* clientData);
void Clear();
void Copy();
void Cut();
void Delete(int n);
// NotMember??: void Deselect(int n);
int FindString(const wxString& string);
// TODO: char* GetClientData(const int n);
long GetInsertionPoint();
long GetLastPosition();
int GetSelection();
wxString GetString(int n);
wxString GetStringSelection();
wxString GetValue();
int Number();
void Paste();
void Replace(long from, long to, const wxString& text);
void Remove(long from, long to);
// TODO: void SetClientData(const int n, char* data);
void SetInsertionPoint(long pos);
void SetInsertionPointEnd();
void SetSelection(int n, bool select = TRUE);
%name(SetMark)void SetSelection(long from, long to);
void SetValue(const wxString& text);
};
//----------------------------------------------------------------------
class wxGauge : public wxControl {
public:
wxGauge(wxWindow* parent, wxWindowID id, int range,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxPyDefaultValidator,
char* name = "gauge");
int GetBezelFace();
int GetRange();
int GetShadowWidth();
int GetValue();
void SetBezelFace(int width);
void SetRange(int range);
void SetShadowWidth(int width);
void SetValue(int pos);
};
//----------------------------------------------------------------------
class wxStaticBox : public wxControl {
public:
wxStaticBox(wxWindow* parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = 0,
char* name = "staticBox");
};
//----------------------------------------------------------------------
class wxStaticText : public wxControl {
public:
wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = 0,
char* name = "staticText");
wxString GetLabel();
void SetLabel(const wxString& label);
};
//----------------------------------------------------------------------
class wxListBox : public wxControl {
public:
wxListBox(wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
int LCOUNT, wxString* LIST = NULL,
long style = 0,
const wxValidator& validator = wxPyDefaultValidator,
char* name = "listBox");
void Append(const wxString& item);
// TODO: void Append(const wxString& item, char* clientData);
void Clear();
void Delete(int n);
void Deselect(int n);
int FindString(const wxString& string);
// TODO: char* GetClientData(const int n);
int GetSelection();
// TODO: int GetSelections(int **selections);
wxString GetString(int n);
wxString GetStringSelection();
int Number();
bool Selected(const int n);
void Set(int LCOUNT, wxString* LIST);
// TODO: void SetClientData(const int n, char* data);
void SetFirstItem(int n);
%name(SetFirstItemStr)void SetFirstItem(const wxString& string);
void SetSelection(int n, bool select = TRUE);
void SetString(int n, const wxString& string);
void SetStringSelection(const wxString& string, bool select = TRUE);
};
//----------------------------------------------------------------------
class wxTextCtrl : public wxControl {
public:
wxTextCtrl(wxWindow* parent, wxWindowID id, char* value = "",
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = 0,
const wxValidator& validator = wxPyDefaultValidator,
char* name = "text");
void Clear();
void Copy();
void Cut();
void DiscardEdits();
long GetInsertionPoint();
long GetLastPosition();
int GetLineLength(long lineNo);
wxString GetLineText(long lineNo);
int GetNumberOfLines();
wxString GetValue();
bool IsModified();
bool LoadFile(const wxString& filename);
void Paste();
void PositionToXY(long pos, long *OUTPUT, long *OUTPUT);
void Remove(long from, long to);
void Replace(long from, long to, const wxString& value);
bool SaveFile(const wxString& filename);
void SetEditable(bool editable);
void SetInsertionPoint(long pos);
void SetInsertionPointEnd();
void SetSelection(long from, long to);
void SetValue(const wxString& value);
void ShowPosition(long pos);
void WriteText(const wxString& text);
long XYToPosition(long x, long y);
};
//----------------------------------------------------------------------
class wxScrollBar : public wxControl {
public:
wxScrollBar(wxWindow* parent, wxWindowID id = -1,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxSB_HORIZONTAL,
const wxValidator& validator = wxPyDefaultValidator,
char* name = "scrollBar");
int GetRange();
int GetPageSize();
int GetPosition();
int GetThumbSize();
void SetPosition(int viewStart);
void SetScrollbar(int position, int thumbSize,
int range, int pageSize,
bool refresh = TRUE);
};
//----------------------------------------------------------------------
class wxSpinButton : public wxControl {
public:
wxSpinButton(wxWindow* parent, wxWindowID id = -1,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxSP_HORIZONTAL,
char* name = "spinButton");
int GetMax();
int GetMin();
int GetValue();
void SetRange(int min, int max);
void SetValue(int value);
};
//----------------------------------------------------------------------
class wxStaticBitmap : public wxControl {
public:
wxStaticBitmap(wxWindow* parent, wxWindowID id,
const wxBitmap& bitmap,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = 0,
char* name = "staticBitmap");
wxBitmap& GetBitmap();
void SetBitmap(const wxBitmap& bitmap);
};
//----------------------------------------------------------------------
class wxRadioBox : public wxControl {
public:
wxRadioBox(wxWindow* parent, wxWindowID id,
const wxString& label,
const wxPoint& point = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
int LCOUNT = 0, wxString* LIST = NULL,
int majorDimension = 0,
long style = wxRA_HORIZONTAL,
const wxValidator& validator = wxPyDefaultValidator,
char* name = "radioBox");
%name(EnableBox)void Enable(bool enable);
void Enable(int n, bool enable);
int FindString(const wxString& string);
%name(GetBoxLabel)wxString GetLabel();
wxString GetLabel(int n);
int GetSelection();
wxString GetString(int n);
wxString GetStringSelection();
int Number();
%name(SetBoxLabel)void SetLabel(const wxString& label);
void SetLabel(int n, const wxString& label);
void SetSelection(int n);
void SetStringSelection(const wxString& string);
void Show(bool show);
%name(ShowItem)void Show(int item, bool show);
};
//----------------------------------------------------------------------
class wxRadioButton : public wxControl {
public:
wxRadioButton(wxWindow* parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = 0,
const wxValidator& validator = wxPyDefaultValidator,
char* name = "radioButton");
bool GetValue();
void SetValue(bool value);
};
//----------------------------------------------------------------------
class wxSlider : public wxControl {
public:
wxSlider(wxWindow* parent, wxWindowID id,
int value, int minValue, int maxValue,
const wxPoint& point = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxSL_HORIZONTAL,
const wxValidator& validator = wxPyDefaultValidator,
char* name = "slider");
void ClearSel();
void ClearTicks();
int GetLineSize();
int GetMax();
int GetMin();
int GetPageSize();
int GetSelEnd();
int GetSelStart();
int GetThumbLength();
int GetTickFreq();
int GetValue();
void SetRange(int minValue, int maxValue);
void SetTickFreq(int n, int pos);
void SetLineSize(int lineSize);
void SetPageSize(int pageSize);
void SetSelection(int startPos, int endPos);
void SetThumbLength(int len);
void SetTick(int tickPos);
void SetValue(int value);
};
//----------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//
// $Log$
// Revision 1.1 1998/08/09 08:25:49 RD
// Initial version
//
//
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+381
View File
@@ -0,0 +1,381 @@
%module controls2
%{
/////////////////////////////////////////////////////////////////////////////
// Name: controls2.i
// Purpose: More control (widget) classes for wxPython
//
// Author: Robin Dunn
//
// Created: 6/10/98
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#include "helpers.h"
#include <wx/listctrl.h>
#include <wx/treectrl.h>
#include <wx/tabctrl.h>
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import misc.i
%import windows.i
%import gdi.i
%import events.i
%import controls.i
//----------------------------------------------------------------------
%{
extern wxValidator wxPyDefaultValidator;
%}
//----------------------------------------------------------------------
class wxListItem {
public:
long m_mask; // Indicates what fields are valid
long m_itemId; // The zero-based item position
int m_col; // Zero-based column, if in report mode
long m_state; // The state of the item
long m_stateMask; // Which flags of m_state are valid (uses same flags)
wxString m_text; // The label/header text
int m_image; // The zero-based index into an image list
long m_data; // App-defined data
// wxColour *m_colour; // only wxGLC, not supported by Windows ;->
// For columns only
int m_format; // left, right, centre
int m_width; // width of column
wxListItem();
~wxListItem();
};
class wxListEvent: public wxCommandEvent {
public:
int m_code;
long m_itemIndex;
long m_oldItemIndex;
int m_col;
bool m_cancelled;
wxPoint m_pointDrag;
wxListItem m_item;
};
class wxListCtrl : public wxControl {
public:
wxListCtrl(wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxPyDefaultValidator,
char* name = "listCtrl");
bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
bool DeleteItem(long item);
bool DeleteAllItems();
bool DeleteColumn(int col);
bool DeleteAllColumns(void);
void ClearAll(void);
wxTextCtrl* EditLabel(long item);
bool EndEditLabel(bool cancel);
bool EnsureVisible(long item);
long FindItem(long start, const wxString& str, bool partial = FALSE);
%name(FindItemData)long FindItem(long start, long data);
%name(FindItemAtPos)long FindItem(long start, const wxPoint& pt,
int direction);
bool GetColumn(int col, wxListItem& item);
int GetColumnWidth(int col);
int GetCountPerPage();
wxTextCtrl* GetEditControl();
wxImageList* GetImageList(int which);
long GetItemData(long item);
%addmethods {
%new wxListItem* GetItem() {
wxListItem* info = new wxListItem;
self->GetItem(*info);
return info;
}
%new wxPoint* GetItemPosition(long item) {
wxPoint* pos = new wxPoint;
self->GetItemPosition(item, *pos);
return pos;
}
%new wxRect* GetItemRect(long item, int code = wxLIST_RECT_BOUNDS) {
wxRect* rect= new wxRect;
self->GetItemRect(item, *rect, code);
return rect;
}
}
int GetItemState(long item, long stateMask);
int GetItemCount();
int GetItemSpacing(bool isSmall);
wxString GetItemText(long item);
long GetNextItem(long item,
int geometry = wxLIST_NEXT_ALL,
int state = wxLIST_STATE_DONTCARE);
int GetSelectedItemCount();
wxColour GetTextColour();
long GetTopItem();
long HitTest(const wxPoint& point, int& OUTPUT);
%name(InsertColumnWithInfo)long InsertColumn(long col, wxListItem& info);
long InsertColumn(long col, const wxString& heading,
int format = wxLIST_FORMAT_LEFT,
int width = -1);
long InsertItem(wxListItem& info);
%name(InsertStringItem) long InsertItem(long index, const wxString& label);
%name(InsertImageItem) long InsertItem(long index, int imageIndex);
%name(InsertImageStringItem)long InsertItem(long index, const wxString& label,
int imageIndex);
bool ScrollList(int dx, int dy);
void SetBackgroundColour(const wxColour& col);
bool SetColumn(int col, wxListItem& item);
bool SetColumnWidth(int col, int width);
void SetImageList(wxImageList* imageList, int which);
bool SetItem(wxListItem& info);
%name(SetItemString)long SetItem(long index, int col, const wxString& label,
int imageId = -1);
bool SetItemData(long item, long data);
bool SetItemImage(long item, int image, int selImage);
bool SetItemPosition(long item, const wxPoint& pos);
bool SetItemState(long item, long state, long stateMask);
void SetItemText(long item, const wxString& text);
void SetSingleStyle(long style, bool add = TRUE);
void SetTextColour(const wxColour& col);
void SetWindowStyleFlag(long style);
// TODO: bool SortItems(wxListCtrlCompare fn, long data);
};
//----------------------------------------------------------------------
enum {
wxTREE_MASK_HANDLE,
wxTREE_MASK_STATE,
wxTREE_MASK_TEXT,
wxTREE_MASK_IMAGE,
wxTREE_MASK_SELECTED_IMAGE,
wxTREE_MASK_CHILDREN,
wxTREE_MASK_DATA,
wxTREE_STATE_BOLD,
wxTREE_STATE_DROPHILITED,
wxTREE_STATE_EXPANDED,
wxTREE_STATE_EXPANDEDONCE,
wxTREE_STATE_FOCUSED,
wxTREE_STATE_SELECTED,
wxTREE_STATE_CUT,
wxTREE_HITTEST_ABOVE,
wxTREE_HITTEST_BELOW,
wxTREE_HITTEST_NOWHERE,
wxTREE_HITTEST_ONITEMBUTTON,
wxTREE_HITTEST_ONITEMICON,
wxTREE_HITTEST_ONITEMINDENT,
wxTREE_HITTEST_ONITEMLABEL,
wxTREE_HITTEST_ONITEMRIGHT,
wxTREE_HITTEST_ONITEMSTATEICON,
wxTREE_HITTEST_TOLEFT,
wxTREE_HITTEST_TORIGHT,
wxTREE_HITTEST_ONITEM,
};
enum {
wxTREE_NEXT_CARET,
wxTREE_NEXT_CHILD,
wxTREE_NEXT_DROPHILITE,
wxTREE_NEXT_FIRSTVISIBLE,
wxTREE_NEXT_NEXT,
wxTREE_NEXT_NEXTVISIBLE,
wxTREE_NEXT_PARENT,
wxTREE_NEXT_PREVIOUS,
wxTREE_NEXT_PREVIOUSVISIBLE,
wxTREE_NEXT_ROOT
};
enum {
wxTREE_EXPAND_EXPAND,
wxTREE_EXPAND_COLLAPSE,
wxTREE_EXPAND_COLLAPSE_RESET,
wxTREE_EXPAND_TOGGLE
};
enum {
wxTREE_INSERT_LAST,
wxTREE_INSERT_FIRST,
wxTREE_INSERT_SORT,
};
class wxTreeItem {
public:
long m_mask;
long m_itemId;
long m_state;
long m_stateMask;
wxString m_text;
int m_image;
int m_selectedImage;
int m_children;
long m_data;
wxTreeItem();
~wxTreeItem();
};
class wxTreeEvent : public wxCommandEvent {
public:
int m_code;
wxTreeItem m_item;
long m_oldItem;
wxPoint m_pointDrag;
};
class wxTreeCtrl : public wxControl {
public:
wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxTR_HAS_BUTTONS,
const wxValidator& validator = wxPyDefaultValidator,
char* name = "wxTreeCtrl");
bool DeleteAllItems();
bool DeleteItem(long item);
wxTextCtrl* EditLabel(long item);
bool EnsureVisible(long item);
bool ExpandItem(long item, int action);
long GetChild(long item);
int GetCount();
wxTextCtrl* GetEditControl();
long GetFirstVisibleItem();
wxImageList* GetImageList(int which = wxIMAGE_LIST_NORMAL);
int GetIndent();
long GetItemData(long item);
%addmethods {
%new wxTreeItem* GetItem() {
wxTreeItem* info = new wxTreeItem;
self->GetItem(*info);
return info;
}
%new wxRect* GetItemRect(long item, int textOnly = FALSE) {
wxRect* rect = new wxRect;
self->GetItemRect(item, *rect, textOnly);
return rect;
}
}
int GetItemState(long item, long stateMask);
wxString GetItemText(long item);
long GetNextItem(long item, int code);
long GetNextVisibleItem(long item);
long GetParent(long item);
long GetRootItem();
long GetSelection();
long HitTest(const wxPoint& point, int& OUTPUT); // *** check this
long InsertItem(long parent, wxTreeItem& info,
long insertAfter = wxTREE_INSERT_LAST);
%name(InsertItemString)
long InsertItem(long parent, const wxString& label,
int image = -1, int selImage = -1,
long insertAfter = wxTREE_INSERT_LAST);
bool ItemHasChildren(long item);
bool ScrollTo(long item);
bool SelectItem(long item);
void SetIndent(int indent);
void SetImageList(wxImageList* imageList, int which = wxIMAGE_LIST_NORMAL);
bool SetItem(wxTreeItem& info);
bool SetItemImage(long item, int image, int selImage);
bool SetItemState(long item, long state, long stateMask);
void SetItemText(long item, const wxString& text);
bool SetItemData(long item, long data);
bool SortChildren(long item);
};
//----------------------------------------------------------------------
class wxTabEvent : public wxCommandEvent {
public:
};
class wxTabCtrl : public wxControl {
public:
wxTabCtrl(wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = 0,
char* name = "tabCtrl");
bool DeleteAllItems();
bool DeleteItem(int item);
wxImageList* GetImageList();
int GetItemCount();
// TODO: void* GetItemData();
int GetItemImage(int item);
%addmethods {
%new wxRect* GetItemRect(int item) {
wxRect* rect = new wxRect;
self->GetItemRect(item, *rect);
return rect;
}
}
wxString GetItemText(int item);
bool GetRowCount();
int GetSelection();
int HitTest(const wxPoint& pt, long& OUTPUT);
void InsertItem(int item, const wxString& text,
int imageId = -1, void* clientData = NULL);
// TODO: bool SetItemData(int item, void* data);
bool SetItemImage(int item, int image);
void SetImageList(wxImageList* imageList);
void SetItemSize(const wxSize& size);
bool SetItemText(int item, const wxString& text);
void SetPadding(const wxSize& padding);
int SetSelection(int item);
};
//----------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//
// $Log$
// Revision 1.1 1998/08/09 08:25:49 RD
// Initial version
//
//
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+295
View File
@@ -0,0 +1,295 @@
%module events
%{
/////////////////////////////////////////////////////////////////////////////
// Name: events.i
// Purpose: SWIGgable Event classes for wxPython
//
// Author: Robin Dunn
//
// Created: 5/24/98
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#include "helpers.h"
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import misc.i
//---------------------------------------------------------------------------
class wxEvent {
public:
wxObject* GetEventObject();
wxEventType GetEventType();
int GetId();
bool GetSkipped();
long GetTimestamp();
void SetEventObject(wxObject* object);
void SetEventType(wxEventType typ);
void SetId(int id);
void SetTimestamp(long timeStamp);
void Skip(bool skip = TRUE);
};
//---------------------------------------------------------------------------
class wxSizeEvent : public wxEvent {
public:
wxSize GetSize();
};
//---------------------------------------------------------------------------
class wxCloseEvent : public wxEvent {
public:
bool GetSessionEnding();
bool GetLoggingOff();
void Veto(bool veto = TRUE);
bool GetVeto();
void SetForce(bool force);
bool GetForce();
};
//---------------------------------------------------------------------------
class wxCommandEvent : public wxEvent {
public:
bool Checked();
long GetExtraLong();
int GetInt();
int GetSelection();
char* GetString();
bool IsSelection();
};
//---------------------------------------------------------------------------
class wxScrollEvent: public wxCommandEvent {
public:
int GetOrientation();
int GetPosition();
};
//---------------------------------------------------------------------------
class wxMouseEvent: public wxEvent {
public:
bool IsButton();
bool ButtonDown(int but = -1);
bool ButtonDClick(int but = -1);
bool ButtonUp(int but = -1);
bool Button(int but);
bool ButtonIsDown(int but);
bool ControlDown();
bool MetaDown();
bool AltDown();
bool ShiftDown();
bool LeftDown();
bool MiddleDown();
bool RightDown();
bool LeftUp();
bool MiddleUp();
bool RightUp();
bool LeftDClick();
bool MiddleDClick();
bool RightDClick();
bool LeftIsDown();
bool MiddleIsDown();
bool RightIsDown();
bool Dragging();
bool Moving();
bool Entering();
bool Leaving();
void Position(long *OUTPUT, long *OUTPUT);
wxPoint GetPosition();
wxPoint GetLogicalPosition(const wxDC& dc);
long GetX();
long GetY();
};
//---------------------------------------------------------------------------
class wxKeyEvent: public wxEvent {
public:
bool ControlDown();
bool MetaDown();
bool AltDown();
bool ShiftDown();
long KeyCode();
void Position(float *OUTPUT, float *OUTPUT);
float GetX();
float GetY();
};
//---------------------------------------------------------------------------
class wxMoveEvent: public wxEvent {
public:
wxPoint GetPosition();
};
//---------------------------------------------------------------------------
class wxPaintEvent: public wxEvent {
public:
};
//---------------------------------------------------------------------------
class wxEraseEvent: public wxEvent {
public:
wxDC *GetDC();
};
//---------------------------------------------------------------------------
class wxFocusEvent: public wxEvent {
public:
};
//---------------------------------------------------------------------------
class wxActivateEvent: public wxEvent{
public:
bool GetActive();
};
//---------------------------------------------------------------------------
class wxInitDialogEvent: public wxEvent {
public:
};
//---------------------------------------------------------------------------
class wxMenuEvent: public wxEvent {
public:
int GetMenuId();
};
//---------------------------------------------------------------------------
class wxShowEvent: public wxEvent {
public:
void SetShow(bool show);
bool GetShow();
};
//---------------------------------------------------------------------------
class wxIconizeEvent: public wxEvent {
public:
};
//---------------------------------------------------------------------------
class wxMaximizeEvent: public wxEvent {
public:
};
//---------------------------------------------------------------------------
class wxJoystickEvent: public wxEvent {
public:
wxPoint GetPosition();
int GetZPosition();
int GetButtonState();
int GetButtonChange();
int GetJoystick();
void SetJoystick(int stick);
void SetButtonState(int state);
void SetButtonChange(int change);
void SetPosition(const wxPoint& pos);
void SetZPosition(int zPos);
bool IsButton();
bool IsMove();
bool IsZMove();
bool ButtonDown(int but = wxJOY_BUTTON_ANY);
bool ButtonUp(int but = wxJOY_BUTTON_ANY);
bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
};
//---------------------------------------------------------------------------
class wxDropFilesEvent: public wxEvent {
public:
wxPoint GetPosition();
int GetNumberOfFiles();
%addmethods {
PyObject* GetFiles() {
int count = self->GetNumberOfFiles();
wxString* files = self->GetFiles();
PyObject* list = PyList_New(count);
if (!list) {
PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
return NULL;
}
for (int i=0; i<count; i++) {
PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
}
return list;
}
}
};
//---------------------------------------------------------------------------
class wxIdleEvent: public wxEvent {
public:
void RequestMore(bool needMore = TRUE);
bool MoreRequested();
};
//---------------------------------------------------------------------------
class wxUpdateUIEvent: public wxEvent {
public:
bool GetChecked();
bool GetEnabled();
wxString GetText();
bool GetSetText();
bool GetSetChecked();
bool GetSetEnabled();
void Check(bool check);
void Enable(bool enable);
void SetText(const wxString& text);
};
//---------------------------------------------------------------------------
class wxSysColourChangedEvent: public wxEvent {
public:
};
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//
// $Log$
// Revision 1.1 1998/08/09 08:25:50 RD
// Initial version
//
//
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+466
View File
@@ -0,0 +1,466 @@
%module gdi
%{
/////////////////////////////////////////////////////////////////////////////
// Name: gdi.i
// Purpose: SWIG interface file for wxDC, wxBrush, wxPen, wxFont, etc.
//
// Author: Robin Dunn
//
// Created: 7/7/97
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#include "helpers.h"
#include <wx/metafile.h>
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import misc.i
//---------------------------------------------------------------------------
class wxBitmap {
public:
wxBitmap(const wxString& name, long type);
~wxBitmap();
void Create(int width, int height, int depth = -1);
int GetDepth();
int GetHeight();
wxPalette* GetPalette();
wxMask* GetMask();
int GetWidth();
bool LoadFile(const wxString& name, long flags);
bool Ok();
bool SaveFile(const wxString& name, int type, wxPalette* palette = NULL);
void SetDepth(int depth);
void SetHeight(int height);
void SetMask(wxMask* mask);
void SetOk(int isOk);
void SetPalette(wxPalette* palette);
void SetWidth(int width);
};
%new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
wxBitmap* wxNoRefBitmap(char* name, long flags);
%{ // Alternate 'constructor'
wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
return new wxBitmap(width, height, depth);
}
// This one won't own the reference, so Python won't call
// the dtor, this is good for toolbars and such where
// the parent will manage the bitmap.
wxBitmap* wxNoRefBitmap(char* name, long flags) {
return new wxBitmap(name, flags);
}
%}
//---------------------------------------------------------------------------
class wxMask {
public:
wxMask(const wxBitmap& bitmap);
~wxMask();
};
%new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
%{
wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
return new wxMask(bitmap, colour);
}
%}
//---------------------------------------------------------------------------
class wxIcon : public wxBitmap {
public:
wxIcon(char *name, long flags);
~wxIcon();
int GetDepth();
int GetHeight();
int GetWidth();
bool LoadFile(const wxString& name, long flags);
bool Ok();
void SetDepth(int depth);
void SetHeight(int height);
void SetOk(int isOk);
void SetWidth(int width);
};
//---------------------------------------------------------------------------
class wxCursor : public wxBitmap {
public:
wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
~wxCursor();
bool Ok();
};
%new wxCursor* wxStockCursor(int id);
%{ // Alternate 'constructor'
wxCursor* wxStockCursor(int id) {
return new wxCursor(id);
}
%}
//----------------------------------------------------------------------
class wxFont {
public:
// I'll do it this way to use long-lived objects and not have to
// worry about when python may delete the object.
%addmethods {
wxFont( int pointSize, int family, int style, int weight,
int underline=FALSE, char* faceName = "") {
return wxTheFontList->FindOrCreateFont(pointSize, family, style, weight,
underline, faceName);
}
// NO Destructor.
}
wxString GetFaceName();
int GetFamily();
int GetFontId();
int GetPointSize();
int GetStyle();
bool GetUnderlined();
int GetWeight();
void SetFaceName(const wxString& faceName);
void SetFamily(int family);
void SetPointSize(int pointSize);
void SetStyle(int style);
void SetUnderlined(bool underlined);
void SetWeight(int weight);
};
//----------------------------------------------------------------------
class wxColour {
public:
wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
~wxColour();
unsigned char Red();
unsigned char Green();
unsigned char Blue();
bool Ok();
void Set(unsigned char red, unsigned char green, unsigned char blue);
%addmethods {
PyObject* Get() {
PyObject* rv = PyTuple_New(3);
PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red()));
PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green()));
PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue()));
return rv;
}
}
};
%new wxColour* wxNamedColour(const wxString& colorName);
%{ // Alternate 'constructor'
wxColour* wxNamedColour(const wxString& colorName) {
return new wxColour(colorName);
}
%}
//----------------------------------------------------------------------
typedef unsigned long wxDash;
class wxPen {
public:
// I'll do it this way to use long-lived objects and not have to
// worry about when python may delete the object.
%addmethods {
wxPen(wxColour* colour, int width=1, int style=wxSOLID) {
return wxThePenList->FindOrCreatePen(*colour, width, style);
}
// NO Destructor.
}
int GetCap();
wxColour& GetColour();
// **** This one needs to return a list of ints (wxDash)
int GetDashes(wxDash **dashes);
int GetJoin();
wxBitmap* GetStipple();
int GetStyle();
int GetWidth();
bool Ok();
void SetCap(int cap_style);
void SetColour(wxColour& colour);
void SetDashes(int LCOUNT, wxDash* LIST);
void SetJoin(int join_style);
void SetStipple(wxBitmap * stipple);
void SetStyle(int style);
void SetWidth(int width);
};
//----------------------------------------------------------------------
class wxBrush {
public:
// I'll do it this way to use long-lived objects and not have to
// worry about when python may delete the object.
%addmethods {
wxBrush(wxColour* colour, int style=wxSOLID) {
return wxTheBrushList->FindOrCreateBrush(*colour, style);
}
// NO Destructor.
}
wxColour& GetColour();
wxBitmap * GetStipple();
int GetStyle();
bool Ok();
void SetColour(wxColour &colour);
void SetStipple(wxBitmap *bitmap);
void SetStyle(int style);
};
//----------------------------------------------------------------------
class wxDC {
public:
wxDC();
~wxDC();
void BeginDrawing();
bool Blit(long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, long logical_func);
void Clear();
void CrossHair(long x, long y);
void DestroyClippingRegion();
long DeviceToLogicalX(long x);
long DeviceToLogicalXRel(long x);
long DeviceToLogicalY(long y);
long DeviceToLogicalYRel(long y);
void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
void DrawEllipse(long x, long y, long width, long height);
void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
void DrawIcon(const wxIcon& icon, long x, long y);
void DrawLine(long x1, long y1, long x2, long y2);
void DrawLines(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0);
void DrawPolygon(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0,
int fill_style=wxODDEVEN_RULE);
void DrawPoint(long x, long y);
void DrawRectangle(long x, long y, long width, long height);
void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
void DrawSpline(int LCOUNT, wxPoint* LIST);
void DrawText(const wxString& text, long x, long y);
void EndDoc();
void EndDrawing();
void EndPage();
void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
wxBrush * GetBackground();
wxBrush * GetBrush();
long GetCharHeight();
long GetCharWidth();
void GetClippingBox(long *OUTPUT, long *OUTPUT,
long *OUTPUT, long *OUTPUT);
wxFont * GetFont();
int GetLogicalFunction();
int GetMapMode();
bool GetOptimization();
wxPen * GetPen();
//bool GetPixel(int x, int y, wxColour *T_OUTPUT); **** See below.
void GetSize(int* OUTPUT, int* OUTPUT); //void GetSize(long* OUTPUT, long* OUTPUT);
wxColour& GetTextBackground();
void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT,
long *OUTPUT, long *OUTPUT);
wxColour& GetTextForeground();
long LogicalToDeviceX(long x);
long LogicalToDeviceXRel(long x);
long LogicalToDeviceY(long y);
long LogicalToDeviceYRel(long y);
long MaxX();
long MaxY();
long MinX();
long MinY();
bool Ok();
void SetDeviceOrigin(long x, long y);
void SetBackground(const wxBrush& brush);
void SetBackgroundMode(int mode);
void SetClippingRegion(long x, long y, long width, long height);
void SetPalette(const wxPalette& colourMap);
void SetBrush(const wxBrush& brush);
void SetFont(const wxFont& font);
void SetLogicalFunction(int function);
void SetMapMode(int mode);
void SetOptimization(bool optimize);
void SetPen(const wxPen& pen);
void SetTextBackground(const wxColour& colour);
void SetTextForeground(const wxColour& colour);
void SetUserScale(double x_scale, double y_scale);
bool StartDoc(const wxString& message);
void StartPage();
%addmethods {
%new wxColour* GetPixel(long x, long y) {
wxColor* wc = new wxColor();
self->GetPixel(x, y, wc);
return wc;
}
// This one is my own creation...
void DrawBitmap(wxBitmap* bitmap, long x, long y, bool swapPalette=TRUE) {
wxMemoryDC* memDC = new wxMemoryDC;
memDC->SelectObject(bitmap);
if (swapPalette)
self->SetPalette(bitmap->GetPalette());
self->Blit(x, y, bitmap->GetWidth(), bitmap->GetHeight(), memDC,
0, 0, self->GetLogicalFunction());
memDC->SelectObject(wxNullBitmap);
delete memDC;
}
}
};
//----------------------------------------------------------------------
class wxMemoryDC : public wxDC {
public:
wxMemoryDC();
void SelectObject(const wxBitmap& bitmap);
}
%new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
%{ // Alternate 'constructor'
wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
return new wxMemoryDC(oldDC);
}
%}
//---------------------------------------------------------------------------
class wxScreenDC : public wxDC {
public:
wxScreenDC();
bool StartDrawingOnTop(wxWindow* window);
%name(StartDrawingOnTopRect) bool StartDrawingOnTop(wxRect* rect = NULL);
bool EndDrawingOnTop();
};
//---------------------------------------------------------------------------
class wxClientDC : public wxDC {
public:
wxClientDC(wxWindow* win);
};
//---------------------------------------------------------------------------
class wxPaintDC : public wxDC {
public:
wxPaintDC(wxWindow* win);
};
//---------------------------------------------------------------------------
class wxPostScriptDC : public wxDC {
public:
wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL);
};
//---------------------------------------------------------------------------
class wxPrinterDC : public wxDC {
public:
wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output,
bool interactive = TRUE, int orientation = wxPORTRAIT);
};
//---------------------------------------------------------------------------
class wxMetaFileDC : public wxDC {
public:
wxMetaFileDC(const wxString& filename = wxPyEmptyStr);
wxMetaFile* Close();
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
%readonly
extern wxFont *wxNORMAL_FONT;
extern wxFont *wxSMALL_FONT;
extern wxFont *wxITALIC_FONT;
extern wxFont *wxSWISS_FONT;
extern wxPen *wxRED_PEN;
extern wxPen *wxCYAN_PEN;
extern wxPen *wxGREEN_PEN;
extern wxPen *wxBLACK_PEN;
extern wxPen *wxWHITE_PEN;
extern wxPen *wxTRANSPARENT_PEN;
extern wxPen *wxBLACK_DASHED_PEN;
extern wxPen *wxGREY_PEN;
extern wxPen *wxMEDIUM_GREY_PEN;
extern wxPen *wxLIGHT_GREY_PEN;
extern wxBrush *wxBLUE_BRUSH;
extern wxBrush *wxGREEN_BRUSH;
extern wxBrush *wxWHITE_BRUSH;
extern wxBrush *wxBLACK_BRUSH;
extern wxBrush *wxTRANSPARENT_BRUSH;
extern wxBrush *wxCYAN_BRUSH;
extern wxBrush *wxRED_BRUSH;
extern wxBrush *wxGREY_BRUSH;
extern wxBrush *wxMEDIUM_GREY_BRUSH;
extern wxBrush *wxLIGHT_GREY_BRUSH;
extern wxColour *wxBLACK;
extern wxColour *wxWHITE;
extern wxColour *wxRED;
extern wxColour *wxBLUE;
extern wxColour *wxGREEN;
extern wxColour *wxCYAN;
extern wxColour *wxLIGHT_GREY;
extern wxCursor *wxSTANDARD_CURSOR;
extern wxCursor *wxHOURGLASS_CURSOR;
extern wxCursor *wxCROSS_CURSOR;
extern wxBitmap wxNullBitmap;
extern wxIcon wxNullIcon;
extern wxCursor wxNullCursor;
extern wxPen wxNullPen;
extern wxBrush wxNullBrush;
extern wxPalette wxNullPalette;
extern wxFont wxNullFont;
extern wxColour wxNullColour;
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//
// $Log$
// Revision 1.1 1998/08/09 08:25:50 RD
// Initial version
//
//
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+110
View File
@@ -0,0 +1,110 @@
/////////////////////////////////////////////////////////////////////////////
// Name: helpers.h
// Purpose: Helper functions/classes for the wxPython extenaion module
//
// Author: Robin Dunn
//
// Created: 7/1/97
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __wxp_helpers__
#define __wxp_helpers__
#include <wx/wx.h>
//----------------------------------------------------------------------
class wxPyApp: public wxApp
{
public:
int MainLoop(void);
bool OnInit(void);
void AfterMainLoop(void);
};
extern wxPyApp *wxPythonApp;
//----------------------------------------------------------------------
PyObject* __wxStart(PyObject*, PyObject* args);
extern PyObject* wxPython_dict;
PyObject* __wxSetDictionary(PyObject*, PyObject* args);
extern wxHashTable* wxPyWindows; // keep track of all windows so we
// don't accidentally delete them twice.
void wxPyEventThunker(wxObject*, wxEvent& event);
//----------------------------------------------------------------------
#ifndef SWIGCODE
extern "C" void SWIG_MakePtr(char *, void *, char *);
extern "C" char *SWIG_GetPtr(char *, void **, char *);
#endif
#ifdef _MSC_VER
# pragma warning(disable:4800)
#endif
// Non-const versions to keep SWIG happy.
extern wxPoint wxPyDefaultPosition;
extern wxSize wxPyDefaultSize;
extern char* wxPyPanelNameStr;
extern wxString wxPyEmptyStr;
//----------------------------------------------------------------------
class wxPyCallback : public wxObject {
public:
wxPyCallback(PyObject* func) { m_func = func; Py_INCREF(m_func); }
~wxPyCallback() { Py_DECREF(m_func); }
void EventThunker(wxEvent& event);
PyObject* m_func;
};
//---------------------------------------------------------------------------
class wxPyMenu : public wxMenu {
public:
wxPyMenu(const wxString& title = "", PyObject* func=NULL);
~wxPyMenu();
private:
static void MenuCallback(wxMenu& menu, wxCommandEvent& evt);
PyObject* func;
};
//---------------------------------------------------------------------------
class wxPyTimer : public wxTimer {
public:
wxPyTimer(PyObject* callback);
~wxPyTimer();
void Notify();
private:
PyObject* func;
};
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//
// $Log$
// Revision 1.1 1998/08/09 08:25:51 RD
// Initial version
//
//
#endif
+184
View File
@@ -0,0 +1,184 @@
#----------------------------------------------------------------------------
# Name: makefile.nt
# Purpose: Win32, VC++ 5 makefile for wxPython
#
# Author: Robin Dunn
#
# Created: 3/27/97
# RCS-ID: $Id$
# Copyright: (c) 1998 by Total Control Software
# Licence: wxWindows license
#----------------------------------------------------------------------------
# Set WXDIR to the root wxWindows directory for your system
WXDIR = $(WXWIN)
# Set this to the root of the Python installation
PYTHONDIR=e:\Tools\Python15
# Set this to 1 for a non-debug, optimised compile
FINAL=0
# Set this to where you want the stuff installed at. It should
# be a directory contained in a PYTHONPATH directory.
TARGETDIR=..
#----------------------------------------------------------------------
WXUSINGDLL=0
NOPCH=1
THISDIR=$(WXDIR)\utils\wxPython
EXTRALIBS=$(PYTHONDIR)\libs\python15.lib
EXTRAINC=-I$(PYTHONDIR)\include
EXTRAFLAGS=/Fpwxp.pch /YXhelpers.h -DSWIG_GLOBAL -DHAVE_CONFIG_H
SWIGFLAGS=-c++ -shadow -python -dnone
!include $(WXDIR)\src\ntwxwin.mak
#----------------------------------------------------------------------
TARGET = wxpc
OBJECTS = wxp.obj helpers.obj windows.obj events.obj \
misc.obj gdi.obj mdi.obj controls.obj \
controls2.obj windows2.obj cmndlgs.obj
PYMODULES = $(TARGETDIR)\wxp.py $(TARGETDIR)\events.py \
$(TARGETDIR)\windows.py $(TARGETDIR)\misc.py \
$(TARGETDIR)\gdi.py $(TARGETDIR)\mdi.py \
$(TARGETDIR)\controls.py $(TARGETDIR)\controls2.py \
$(TARGETDIR)\windows2.py $(TARGETDIR)\cmndlgs.py \
$(TARGETDIR)\__init__.py
#----------------------------------------------------------------------
!if "$(FINAL)" == "0"
DEBUGLFLAGS = /DEBUG /INCREMENTAL:YES
!else
DEBUGLFLAGS = /INCREMENTAL:NO
!endif
LFLAGS= $(DEBUGLFLAGS) /DLL /def:$(TARGET).def /subsystem:windows,3.50 \
/machine:I386 /implib:./$(TARGET).lib /nologo
#----------------------------------------------------------------------
default: $(TARGETDIR)\$(TARGET).pyd pycfiles
all: wx $(TARGET)
wx:
cd $(WXDIR)\src\msw
nmake -f makefile.nt FINAL=$(FINAL)
cd $(THISDIR)
wxclean:
cd $(WXDIR)\src\msw
nmake -f makefile.nt clean
cd $(THISDIR)
pycfiles : $(PYMODULES)
$(PYTHONDIR)\python $(PYTHONDIR)\Lib\compileall.py -l $(TARGETDIR)
$(PYTHONDIR)\python -O $(PYTHONDIR)\Lib\compileall.py -l $(TARGETDIR)
#----------------------------------------------------------------------
$(TARGETDIR)\$(TARGET).pyd : $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(TARGET).res
$(link) @<<
/out:$@ /dll
$(LFLAGS)
$(DUMMYOBJ) $(OBJECTS) $(TARGET).res
$(LIBS)
<<
$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
$(rc) -r /i$(WXDIR)\include -fo$@ $(TARGET).rc
# implicit rule for compiling .cpp files
{}.cpp{}.obj:
$(cc) @<<
$(CPPFLAGS) /c /Tp $<
<<
clean:
-erase *.obj
-erase *.exe
-erase *.res
-erase *.map
-erase *.sbr
-erase *.pdb
-erase *.pch
-erase $(TARGET).exp
-erase $(TARGET).lib
-erase $(TARGETDIR)\$(TARGET).pyd
-erase $(TARGETDIR)\*.py
-erase $(TARGETDIR)\*.pyc
-erase $(TARGETDIR)\*.pyo
-erase $(TARGETDIR)\$(TARGET).*
#------------------------------------------------------------------------
.SUFFIXES : .i .py
# Implicit rules to run SWIG
{}.i{}.cpp:
swig $(SWIGFLAGS) -c -o $*.cpp $*.i
{}.i{}.py:
swig $(SWIGFLAGS) -c -o $*.cpp $*.i
{}.py{$(TARGETDIR)}.py:
copy $< $@
#{}.py{$(TARGETDIR)}.$(PYEXT):
# $(PYTHON) -c "import py_compile; py_compile.compile('$<', '$@')"
# This one must leave out the -c flag so we define the whole rule
wxp.cpp wxp.py : wxp.i my_typemaps.i _defs.i _extras.py
swig $(SWIGFLAGS) -o wxp.cpp wxp.i
# define some dependencies
windows.cpp windows.py : windows.i my_typemaps.i _defs.i
windows2.cpp windows2.py : windows2.i my_typemaps.i _defs.i
events.cpp events.py : events.i my_typemaps.i _defs.i
misc.cpp misc.py : misc.i my_typemaps.i _defs.i
gdi.cpp gdi.py : gdi.i my_typemaps.i _defs.i
mdi.cpp mdi.py : mdi.i my_typemaps.i _defs.i
controls.cpp controls.py : controls.i my_typemaps.i _defs.i
controls2.cpp controls2.py : controls2.i my_typemaps.i _defs.i
cmndlgs.cpp cmndlgs.py : cmndlgs.i my_typemaps.i _defs.i
$(TARGETDIR)\wxp.py : wxp.py
$(TARGETDIR)\windows.py : windows.py
$(TARGETDIR)\windows2.py : windows2.py
$(TARGETDIR)\events.py : events.py
$(TARGETDIR)\misc.py : misc.py
$(TARGETDIR)\gdi.py : gdi.py
$(TARGETDIR)\mdi.py : mdi.py
$(TARGETDIR)\controls.py : controls.py
$(TARGETDIR)\controls2.py : controls2.py
$(TARGETDIR)\cmndlgs.py : cmndlgs.py
#------------------------------------------------------------------------
#
# $Log$
# Revision 1.1 1998/08/09 08:25:51 RD
# Initial version
#
File diff suppressed because it is too large Load Diff
+89
View File
@@ -0,0 +1,89 @@
%module mdi
%{
/////////////////////////////////////////////////////////////////////////////
// Name: mdi.i
// Purpose: MDI related class definitions for wxPython
//
// Author: Robin Dunn
//
// Created: 5/26/98
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#include "helpers.h"
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import misc.i
%import windows.i
//----------------------------------------------------------------------
class wxMDIParentFrame : public wxFrame {
public:
wxMDIParentFrame(wxWindow *parent,
const wxWindowID id,
const wxString& title,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const char* name = "frame");
void ActivateNext();
void ActivatePrevious();
void ArrangeIcons();
void Cascade();
void GetClientSize(int* OUTPUT, int* OUTPUT);
wxMDIChildFrame* GetActiveChild();
wxMDIClientWindow* GetClientWindow();
wxWindow* GetToolBar();
// TODO: This isn't handled by the standard event-table system...
//wxMDIClientWindow* OnCreateClient();
void SetToolBar(wxToolBar* toolbar);
void Tile();
};
//---------------------------------------------------------------------------
class wxMDIChildFrame : public wxFrame {
public:
wxMDIChildFrame(wxMDIParentFrame* parent,
const wxWindowID id,
const wxString& title,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const char* name = "frame");
void Activate();
void Maximize();
void Restore();
};
//---------------------------------------------------------------------------
class wxMDIClientWindow : public wxWindow {
public:
wxMDIClientWindow(wxMDIParentFrame* parent, long style = 0);
};
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//
// $Log$
// Revision 1.1 1998/08/09 08:25:51 RD
// Initial version
//
//
+112
View File
@@ -0,0 +1,112 @@
# This file was created automatically by SWIG.
import mdic
from misc import *
from windows import *
from gdi import *
class wxMDIParentFramePtr(wxFramePtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def ActivateNext(self):
val = mdic.wxMDIParentFrame_ActivateNext(self.this)
return val
def ActivatePrevious(self):
val = mdic.wxMDIParentFrame_ActivatePrevious(self.this)
return val
def ArrangeIcons(self):
val = mdic.wxMDIParentFrame_ArrangeIcons(self.this)
return val
def Cascade(self):
val = mdic.wxMDIParentFrame_Cascade(self.this)
return val
def GetClientSize(self):
val = mdic.wxMDIParentFrame_GetClientSize(self.this)
return val
def GetActiveChild(self):
val = mdic.wxMDIParentFrame_GetActiveChild(self.this)
val = wxMDIChildFramePtr(val)
return val
def GetClientWindow(self):
val = mdic.wxMDIParentFrame_GetClientWindow(self.this)
val = wxMDIClientWindowPtr(val)
return val
def GetToolBar(self):
val = mdic.wxMDIParentFrame_GetToolBar(self.this)
val = wxWindowPtr(val)
return val
def SetToolBar(self,arg0):
val = mdic.wxMDIParentFrame_SetToolBar(self.this,arg0)
return val
def Tile(self):
val = mdic.wxMDIParentFrame_Tile(self.this)
return val
def __repr__(self):
return "<C wxMDIParentFrame instance>"
class wxMDIParentFrame(wxMDIParentFramePtr):
def __init__(self,arg0,arg1,arg2,*args) :
argl = map(None,args)
try: argl[0] = argl[0].this
except: pass
try: argl[1] = argl[1].this
except: pass
args = tuple(argl)
self.this = apply(mdic.new_wxMDIParentFrame,(arg0.this,arg1,arg2,)+args)
self.thisown = 1
class wxMDIChildFramePtr(wxFramePtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def Activate(self):
val = mdic.wxMDIChildFrame_Activate(self.this)
return val
def Maximize(self):
val = mdic.wxMDIChildFrame_Maximize(self.this)
return val
def Restore(self):
val = mdic.wxMDIChildFrame_Restore(self.this)
return val
def __repr__(self):
return "<C wxMDIChildFrame instance>"
class wxMDIChildFrame(wxMDIChildFramePtr):
def __init__(self,arg0,arg1,arg2,*args) :
argl = map(None,args)
try: argl[0] = argl[0].this
except: pass
try: argl[1] = argl[1].this
except: pass
args = tuple(argl)
self.this = apply(mdic.new_wxMDIChildFrame,(arg0.this,arg1,arg2,)+args)
self.thisown = 1
class wxMDIClientWindowPtr(wxWindowPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def __repr__(self):
return "<C wxMDIClientWindow instance>"
class wxMDIClientWindow(wxMDIClientWindowPtr):
def __init__(self,arg0,*args) :
self.this = apply(mdic.new_wxMDIClientWindow,(arg0.this,)+args)
self.thisown = 1
#-------------- FUNCTION WRAPPERS ------------------
#-------------- VARIABLE WRAPPERS ------------------
File diff suppressed because it is too large Load Diff
+309
View File
@@ -0,0 +1,309 @@
%module misc
%{
/////////////////////////////////////////////////////////////////////////////
// Name: misc.i
// Purpose: Definitions of miscelaneous functions and classes
//
// Author: Robin Dunn
//
// Created: 7/3/97
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#include "helpers.h"
#include <wx/resource.h>
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
//---------------------------------------------------------------------------
class wxSize {
public:
%name(width) long x;
%name(height)long y;
wxSize(long w=0, long h=0);
~wxSize();
void Set(long w, long h);
%name(GetWidth) long GetX();
%name(GetHeight)long GetY();
%addmethods {
PyObject* __str__() {
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
return tup;
}
}
};
//---------------------------------------------------------------------------
class wxRealPoint {
public:
double x;
double y;
wxRealPoint(double x=0.0, double y=0.0);
~wxRealPoint();
};
class wxPoint {
public:
long x;
long y;
wxPoint(long x=0, long y=0);
~wxPoint();
%addmethods {
void Set(long x, long y) {
self->x = x;
self->y = y;
}
PyObject* __str__() {
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
return tup;
}
}
};
//---------------------------------------------------------------------------
class wxRect {
public:
wxRect(long x=0, long y=0, long w=0, long h=0);
// TODO: do this one too... wxRect(const wxPoint& pos, const wxSize& size);
~wxRect();
long GetX();
void SetX(long X);
long GetY();
void SetY(long Y);
long GetWidth();
void SetWidth(long w);
long GetHeight();
void SetHeight(long h);
wxPoint GetPosition();
wxSize GetSize();
long GetLeft();
long GetTop();
long GetBottom();
long GetRight();
long x, y, width, height;
};
//---------------------------------------------------------------------------
// Dialog Functions
char* wxFileSelector(char* message,
char* default_path = NULL,
char* default_filename = NULL,
char* default_extension = NULL,
char* wildcard = "*.*",
int flags = 0,
wxWindow *parent = NULL,
int x = -1, int y = -1);
wxString wxGetTextFromUser(const wxString& message,
const wxString& caption = wxPyEmptyStr,
const wxString& default_value = wxPyEmptyStr,
wxWindow *parent = NULL,
int x = -1, int y = -1,
bool centre = TRUE);
// TODO: Need to custom wrap this one...
// int wxGetMultipleChoice(char* message, char* caption,
// int LCOUNT, char** LIST,
// int nsel, int *selection,
// wxWindow *parent = NULL, int x = -1, int y = -1,
// bool centre = TRUE, int width=150, int height=200);
wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
int LCOUNT, wxString* LIST,
wxWindow *parent = NULL,
int x = -1, int y = -1,
bool centre = TRUE,
int width=150, int height=200);
int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
int LCOUNT, wxString* LIST,
wxWindow *parent = NULL,
int x = -1, int y = -1,
bool centre = TRUE,
int width=150, int height=200);
int wxMessageBox(const wxString& message,
const wxString& caption = wxPyEmptyStr,
int style = wxOK | wxCENTRE,
wxWindow *parent = NULL,
int x = -1, int y = -1);
//---------------------------------------------------------------------------
// GDI Functions
bool wxColourDisplay();
int wxDisplayDepth();
void wxSetCursor(wxCursor *cursor);
//---------------------------------------------------------------------------
// Miscellaneous functions
long NewId();
void RegisterId(long id);
void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
void wxBell();
void wxDisplaySize(int *OUTPUT, int *OUTPUT);
void wxEndBusyCursor();
long wxExecute(const wxString& command, bool sync = FALSE);
wxWindow * wxFindWindowByLabel(const wxString& label, wxWindow *parent=NULL);
wxWindow * wxFindWindowByName(const wxString& name, wxWindow *parent=NULL);
wxWindow * wxGetActiveWindow();
long wxGetElapsedTime(bool resetTimer = TRUE);
long wxGetFreeMemory();
void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
bool wxIsBusy();
wxString wxNow();
bool wxShell(const wxString& command = wxPyEmptyStr);
void wxStartTimer();
bool wxYield();
int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
%inline %{
char* wxGetResource(char *section, char *entry, char *file = NULL) {
char * retval;
wxGetResource(section, entry, &retval, file);
return retval;
}
%}
//---------------------------------------------------------------------------
// Resource System
bool wxResourceAddIdentifier(char *name, int value);
void wxResourceClear(void);
wxBitmap * wxResourceCreateBitmap(char *resource);
wxIcon * wxResourceCreateIcon(char *resource);
wxMenuBar * wxResourceCreateMenuBar(char *resource);
int wxResourceGetIdentifier(char *name);
bool wxResourceParseData(char *resource, wxResourceTable *table = NULL);
bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL);
bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
//----------------------------------------------------------------------
class wxPyTimer {
public:
wxPyTimer(PyObject* notify);
~wxPyTimer();
int Interval();
void Start(int milliseconds=-1, int oneShot=FALSE);
void Stop();
};
//---------------------------------------------------------------------------
enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
enum wxRelationship { wxUnconstrained = 0,
wxAsIs,
wxPercentOf,
wxAbove,
wxBelow,
wxLeftOf,
wxRightOf,
wxSameAs,
wxAbsolute };
class wxIndividualLayoutConstraint {
public:
// wxIndividualLayoutConstraint();
// ~wxIndividualLayoutConstraint();
void Above(wxWindow *otherWin, int margin=0);
void Absolute(int value);
void AsIs(void);
void Below(wxWindow *otherWin, int margin=0);
void Unconstrained(void);
void LeftOf(wxWindow *otherWin, int margin=0);
void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
void RightOf(wxWindow *otherWin, int margin=0);
void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
};
class wxLayoutConstraints {
public:
wxLayoutConstraints();
%readonly
wxIndividualLayoutConstraint bottom;
wxIndividualLayoutConstraint centreX;
wxIndividualLayoutConstraint centreY;
wxIndividualLayoutConstraint height;
wxIndividualLayoutConstraint left;
wxIndividualLayoutConstraint right;
wxIndividualLayoutConstraint top;
wxIndividualLayoutConstraint width;
%readwrite
}
//---------------------------------------------------------------------------
// Accelerator Entry and Table
class wxAcceleratorEntry {
public:
wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
//~wxAcceleratorEntry(); *** ?
void Set(int flags, int keyCode, int Cmd);
int GetFlags();
int GetKeyCode();
int GetCommand();
};
class wxAcceleratorTable {
public:
// Can also accept a list of 3-tuples
wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
// ~wxAcceleratorEntry(); *** ?
};
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//
// $Log$
// Revision 1.1 1998/08/09 08:25:51 RD
// Initial version
//
//
File diff suppressed because it is too large Load Diff
+193
View File
@@ -0,0 +1,193 @@
/////////////////////////////////////////////////////////////////////////////
// Name: my_typemaps.i
// Purpose: Special typemaps specifically for wxPython.
//
// Author: Robin Dunn
//
// Created: 7/3/97
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------
// Here are some to map (int LCOUNT, int* LIST), etc. from a python list
%{
extern int* int_LIST_helper(PyObject* source);
extern long* long_LIST_helper(PyObject* source);
extern char** string_LIST_helper(PyObject* source);
extern wxPoint* wxPoint_LIST_helper(PyObject* source);
extern wxBitmap** wxBitmap_LIST_helper(PyObject* source);
extern wxString* wxString_LIST_helper(PyObject* source);
extern wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source);
%}
//----------------------------------------------------------------------
%typemap(python,build) int LCOUNT {
$target = PyList_Size(_in_LIST);
}
%typemap(python,in) int* LIST {
$target = int_LIST_helper($source);
if ($target == NULL) {
return NULL;
}
}
%typemap(python,freearg) int* LIST {
delete [] $source;
}
%typemap(python,in) long* LIST {
$target = long_LIST_helper($source);
if ($target == NULL) {
return NULL;
}
}
%typemap(python,freearg) long* LIST {
delete [] $source;
}
%typemap(python,in) unsigned long* LIST {
$target = (unsigned long*)long_LIST_helper($source);
if ($target == NULL) {
return NULL;
}
}
%typemap(python,freearg) unsigned long* LIST {
delete [] $source;
}
%typemap(python,in) wxDash* LIST = unsigned long* LIST;
%typemap(python,freearg) wxDash* LIST = unsigned long* LIST;
%typemap(python,in) char** LIST {
$target = string_LIST_helper($source);
if ($target == NULL) {
return NULL;
}
}
%typemap(python,freearg) char** LIST {
delete [] $source;
}
%typemap(python,in) wxPoint* LIST {
$target = wxPoint_LIST_helper($source);
if ($target == NULL) {
return NULL;
}
}
%typemap(python,freearg) wxPoint* LIST {
delete [] $source;
}
%typemap(python,in) wxBitmap** LIST {
$target = wxBitmap_LIST_helper($source);
if ($target == NULL) {
return NULL;
}
}
%typemap(python,freearg) wxBitmap** LIST {
delete [] $source;
}
%typemap(python,in) wxString* LIST {
$target = wxString_LIST_helper($source);
if ($target == NULL) {
return NULL;
}
}
%typemap(python,freearg) wxString* LIST {
delete [] $source;
}
%typemap(python,in) wxAcceleratorEntry* LIST {
$target = wxAcceleratorEntry_LIST_helper($source);
if ($target == NULL) {
return NULL;
}
}
%typemap(python,freearg) wxAcceleratorEntry* LIST {
delete [] $source;
}
//---------------------------------------------------------------------------
%{
static char* wxStringErrorMsg = "string type is required for parameter";
%}
%typemap(python, in) wxString& {
if (!PyString_Check($source)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
$target = new wxString(PyString_AsString($source));
}
%typemap(python, freearg) wxString& {
if ($target)
delete $source;
}
%typemap(python, out) wxString {
$target = PyString_FromString(WXSTRINGCAST *($source));
}
%typemap(python, ret) wxString {
delete $source;
}
%typemap(python, out) wxString* {
$target = PyString_FromString(WXSTRINGCAST (*$source));
}
// --------------------------------------------------------------------
//---------------------------------------------------------------------------
// --------------------------------------------------------------------
// Map T_OUTPUTs for floats to return ints.
%typemap(python,ignore) float *T_OUTPUT_TOINT(float temp),
double *T_OUTPUT_TOINT(double temp)
{
$target = &temp;
}
%typemap(python,argout) float *T_OUTPUT_TOINT,
double *T_OUTPUT_TOINT
{
PyObject *o;
o = PyInt_FromLong((long) (*$source));
$target = t_output_helper($target, o);
}
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//
// $Log$
// Revision 1.1 1998/08/09 08:25:52 RD
// Initial version
//
//
File diff suppressed because it is too large Load Diff
+358
View File
@@ -0,0 +1,358 @@
%module windows
%{
/////////////////////////////////////////////////////////////////////////////
// Name: windows.i
// Purpose: SWIG definitions of various window classes
//
// Author: Robin Dunn
//
// Created: 6/24/97
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#include "helpers.h"
#include <wx/minifram.h>
#include <wx/menuitem.h>
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import misc.i
%import gdi.i
//---------------------------------------------------------------------------
class wxEvtHandler {
public:
%addmethods {
void Connect( int id, int lastId, int eventType, PyObject* func) {
if (PyCallable_Check(func)) {
self->Connect(id, lastId, eventType,
(wxObjectEventFunction) wxPyCallback::EventThunker,
new wxPyCallback(func));
}
}
}
};
//----------------------------------------------------------------------
class wxWindow : public wxEvtHandler {
public:
wxWindow(wxWindow* parent, const wxWindowID id,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = 0,
char* name = "panel");
void CaptureMouse();
void Center(int direction = wxHORIZONTAL);
void Centre(int direction = wxHORIZONTAL);
void ClientToScreen(int *BOTH, int *BOTH);
bool Close(int force = FALSE);
bool Destroy();
void DestroyChildren();
void DragAcceptFiles(bool accept);
void Enable(bool enable);
//bool FakePopupMenu(wxMenu* menu, int x, int y);
void Fit();
wxColour GetBackgroundColour();
int GetCharHeight();
int GetCharWidth();
void GetClientSize(int *OUTPUT, int *OUTPUT);
wxLayoutConstraints * GetConstraints();
wxButton* GetDefaultItem();
//wxEvtHandler* GetEventHandler();
wxFont* GetFont();
wxColour GetForegroundColour();
wxWindow * GetGrandParent();
int GetId();
void GetPosition(int *OUTPUT, int *OUTPUT);
wxString& GetLabel();
wxString& GetName();
wxWindow * GetParent();
int GetReturnCode();
int GetScrollThumb(int orientation);
int GetScrollPos(int orientation);
int GetScrollRange(int orientation);
void GetSize(int *OUTPUT, int *OUTPUT);
void GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT); // int* descent = NULL, int* externalLeading = NULL, const wxFont* font = NULL, bool use16 = FALSE)
wxString& GetTitle();
long GetWindowStyleFlag();
void InitDialog();
bool IsEnabled();
bool IsRetained();
bool IsShown();
void Layout();
bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL);
void Lower();
void MakeModal(bool flag);
void Move(int x, int y);
//wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE);
bool PopupMenu(wxMenu *menu, int x, int y);
//void PushEventHandler(wxEvtHandler* handler);
void Raise();
void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL);
void ReleaseMouse();
void ScreenToClient(int *BOTH, int *BOTH);
void ScrollWindow(int dx, int dy, const wxRect* rect = NULL);
void SetAutoLayout(bool autoLayout);
void SetBackgroundColour(const wxColour& colour);
void SetConstraints(wxLayoutConstraints *constraints);
void SetDoubleClick(bool allowDoubleClick);
void SetFocus();
void SetFont(const wxFont& font);
void SetForegroundColour(const wxColour& colour);
void SetId(int id);
void SetName(const wxString& name);
void SetReturnCode(int retCode);
void SetScrollbar(int orientation, int position, int thumbSize, int range, bool refresh = TRUE);
void SetScrollPos(int orientation, int pos, bool refresh = TRUE);
//void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
//%name(SetSizeOnly) void SetSize(int width, int height);
%name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
%addmethods {
void SetSize(const wxSize& size) {
self->SetSize(size.x, size.y);
}
void SetPosition(const wxPoint& pos) {
self->SetSize(pos.x, pos.y, -1, -1);
}
}
void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1);
void SetClientSize(int width, int height);
//void SetPalette(wxPalette* palette);
//void SetColourMap(wxColourMap *colourMap);
void SetCursor(const wxCursor&cursor);
//void SetEventHandler(wxEvtHandler* handler);
void SetTitle(const wxString& title);
bool Show(bool show);
bool TransferDataFromWindow();
bool TransferDataToWindow();
bool Validate();
void WarpPointer(int x, int y);
};
// Static method(s)
%inline %{
wxWindow* wxWindow_FindFocus() {
return wxWindow::FindFocus();
}
%}
//----------------------------------------------------------------------
class wxFrame : public wxWindow {
public:
wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
char* name = "frame");
void Centre(int direction = wxBOTH);
void Command(int id);
bool CreateStatusBar(int number = 1);
wxMenuBar* GetMenuBar();
wxStatusBar* GetStatusBar();
wxString& GetTitle();
void Iconize(bool iconize);
bool IsIconized();
// *** removed *** void LoadAccelerators(const wxString& table);
void SetAcceleratorTable(const wxAcceleratorTable& accel);
void Maximize(bool maximize);
void SetIcon(const wxIcon& icon);
void SetMenuBar(wxMenuBar* menuBar);
void SetStatusText(const wxString& text, int number = 0);
void SetStatusWidths(int LCOUNT, int* LIST); // use typemap
void SetTitle(const wxString& title);
};
//---------------------------------------------------------------------------
class wxMiniFrame : public wxFrame {
public:
wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
char* name = "frame");
};
//---------------------------------------------------------------------------
class wxPanel : public wxWindow {
public:
wxPanel(wxWindow* parent,
const wxWindowID id,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxTAB_TRAVERSAL,
const char* name = "panel");
void InitDialog();
};
//---------------------------------------------------------------------------
class wxDialog : public wxPanel {
public:
wxDialog(wxWindow* parent,
const wxWindowID id,
const wxString& title,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const char* name = "dialogBox");
void Centre(int direction = wxBOTH);
void EndModal(int retCode);
wxString GetTitle();
void Iconize(bool iconize);
bool IsIconized();
bool IsModal();
void SetModal(bool flag);
void SetTitle(const wxString& title);
bool Show(bool show);
int ShowModal();
};
//---------------------------------------------------------------------------
class wxScrolledWindow : public wxWindow {
public:
wxScrolledWindow(wxWindow* parent,
const wxWindowID id = -1,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxHSCROLL | wxVSCROLL,
char* name = "scrolledWindow");
void EnableScrolling(bool xScrolling, bool yScrolling);
void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT);
void GetVirtualSize(int* OUTPUT, int* OUTPUT);
bool IsRetained();
void PrepareDC(wxDC& dc);
void Scroll(int x, int y);
void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
int noUnitsX, int noUnitsY,
int xPos = 0, int yPos = 0);
void ViewStart(int* OUTPUT, int* OUTPUT);
};
//----------------------------------------------------------------------
class wxMenu : public wxEvtHandler {
public:
wxMenu(const wxString& title = wxPyEmptyStr);
void Append(int id, const wxString& item,
const wxString& helpString = wxPyEmptyStr,
int checkable = FALSE);
%name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu,
const wxString& helpString = wxPyEmptyStr);
void AppendSeparator();
void Break();
void Check(int id, bool flag);
bool Checked(int id);
void Enable(int id, bool enable);
int FindItem(const wxString& itemString);
wxMenuItem* FindItemForId(int id);
wxString& GetHelpString(int id);
wxString GetLabel(int id);
wxString GetTitle();
void SetHelpString(int id, const wxString& helpString);
void SetLabel(int id, const wxString& label);
void SetTitle(const wxString& title);
};
//
// This one knows how to set a callback and handle INC- and DECREFing it. To
// be used for PopupMenus, but you must retain a referece to it while using
// it.
//
class wxPyMenu : public wxMenu {
public:
wxPyMenu(const wxString& title = wxPyEmptyStr, PyObject* func = NULL);
~wxPyMenu();
};
//----------------------------------------------------------------------
class wxMenuBar : public wxEvtHandler {
public:
wxMenuBar();
void Append(wxMenu *menu, const wxString& title);
void Check(int id, bool flag);
bool Checked(int id);
void Enable(int id, bool enable);
void EnableTop(int pos, bool enable);
int FindMenuItem(const wxString& menuString, const wxString& itemString);
wxMenuItem * FindItemForId(int id);
wxString GetHelpString(int id);
wxString GetLabel(int id);
wxString GetLabelTop(int pos);
void SetHelpString(int id, const wxString& helpString);
void SetLabel(int id, const wxString& label);
void SetLabelTop(int pos, const wxString& label);
};
//----------------------------------------------------------------------
class wxMenuItem {
public:
bool IsSeparator();
bool IsEnabled();
bool IsChecked();
int GetId();
const wxString& GetHelp();
wxMenu* GetSubMenu();
void SetName(const wxString& strName);
void SetHelp(const wxString& strHelp);
void Enable(bool bDoEnable = TRUE);
void Check(bool bDoCheck = TRUE);
void DeleteSubMenu();
const wxString& GetName();
bool IsCheckable();
};
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//
// $Log$
// Revision 1.1 1998/08/09 08:25:52 RD
// Initial version
//
//
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+228
View File
@@ -0,0 +1,228 @@
%module windows2
%{
/////////////////////////////////////////////////////////////////////////////
// Name: windows2.i
// Purpose: SWIG definitions of MORE window classes
//
// Author: Robin Dunn
//
// Created: 6/2/98
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#include "helpers.h"
#include <wx/grid.h>
#include <wx/notebook.h>
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import misc.i
%import gdi.i
%import windows.i
%import controls.i
%import events.i
//---------------------------------------------------------------------------
enum {
wxGRID_TEXT_CTRL,
wxGRID_HSCROLL,
wxGRID_VSCROLL,
};
class wxGridCell {
public:
wxString& GetTextValue();
void SetTextValue(const wxString& str);
wxFont *GetFont();
void SetFont(wxFont *f);
wxColour& GetTextColour();
void SetTextColour(const wxColour& colour);
wxColour& GetBackgroundColour();
void SetBackgroundColour(const wxColour& colour);
wxBrush *GetBackgroundBrush();
int GetAlignment();
void SetAlignment(int align);
wxBitmap *GetCellBitmap();
void SetCellBitmap(wxBitmap *bitmap);
};
class wxGrid : public wxPanel {
public:
wxGrid(wxWindow* parent, wxWindowID id,
const wxPoint& pos=wxPyDefaultPosition,
const wxSize& size=wxPyDefaultSize,
long style=0,
char* name="grid");
void AdjustScrollbars();
bool AppendCols(int n=1, bool updateLabels=TRUE);
bool AppendRows(int n=1, bool updateLabels=TRUE);
void BeginBatch();
bool CellHitTest(int x, int y, int *OUTPUT, int *OUTPUT);
%addmethods {
// TODO: For now we are just ignoring the initial cellValues
// and widths. Add support for loading them from
// Python sequence objects.
bool CreateGrid(int rows, int cols,
//PyObject* cellValues = NULL,
//PyObject* widths = NULL,
short defaultWidth = wxGRID_DEFAULT_CELL_WIDTH,
short defaultHeight = wxGRID_DEFAULT_CELL_HEIGHT) {
return self->CreateGrid(rows, cols, NULL, NULL,
defaultWidth, defaultHeight);
}
}
bool CurrentCellVisible();
bool DeleteCols(int pos=0, int n=1, bool updateLabels=TRUE);
bool DeleteRows(int pos=0, int n=1, bool updateLabels=TRUE);
void EndBatch();
int GetBatchCount();
wxGridCell* GetCell(int row, int col);
int GetCellAlignment(int row, int col);
%name(GetDefCellAlignment)int GetCellAlignment();
wxColour& GetCellBackgroundColour(int row, int col);
%name(GetDefCellBackgroundColour)
wxColour& GetCellBackgroundColour();
//wxGridCell *** GetCells();
wxColour& GetCellTextColour(int row, int col);
%name(GetDefCellTextColour)wxColour& GetCellTextColour();
wxFont* GetCellTextFont(int row, int col);
%name(GetDefCellTextFont)wxFont* GetCellTextFont();
wxString& GetCellValue(int row, int col);
int GetCols();
int GetColumnWidth(int col);
wxRect& GetCurrentRect();
int GetCursorColumn();
int GetCursorRow();
bool GetEditable();
wxScrollBar * GetHorizScrollBar();
int GetLabelAlignment(int orientation);
wxColour& GetLabelBackgroundColour();
int GetLabelSize(int orientation);
wxColour& GetLabelTextColour();
wxFont* GetLabelTextFont();
wxString& GetLabelValue(int orientation, int pos);
int GetRowHeight(int row);
int GetRows();
int GetScrollPosX();
int GetScrollPosY();
wxTextCtrl* GetTextItem();
wxScrollBar* GetVertScrollBar();
bool InsertCols(int pos=0, int n=1, bool updateLabels=TRUE);
bool InsertRows(int pos=0, int n=1, bool updateLabels=TRUE);
// TODO: How to handle callbacks that don't come from
// event system???
//
//void OnActivate(bool active);
//void OnChangeLabels();
//void OnChangeSelectionLabel();
//wxGridCell* OnCreateCell();
//void OnLeftClick(int row, int col, int x, int y, bool control, bool shift);
//void OnRightClick(int row, int col, int x, int y, bool control, bool shift);
//void OnLabelLeftClick(int row, int col, int x, int y, bool control, bool shift);
//void OnLabelRightClick(int row, int col, int x, int y, bool control, bool shift);
//void OnSelectCell(int row, int col);
//void OnSelectCellImplementation(wxDC *dc, int row, int col);
void SetCellAlignment(int alignment, int row, int col);
%name(SetDefCellAlignment)void SetCellAlignment(int alignment);
void SetCellBackgroundColour(const wxColour& colour, int row, int col);
%name(SetDefCellBackgroundColour)
void SetCellBackgroundColour(const wxColour& colour);
void SetCellTextColour(const wxColour& colour, int row, int col);
%name(SetDefCellTextColour)void SetCellTextColour(const wxColour& colour);
void SetCellTextFont(wxFont *font, int row, int col);
%name(SetDefCellTextFont)void SetCellTextFont(wxFont *font);
void SetCellValue(const wxString& val, int row, int col);
void SetColumnWidth(int col, int width);
void SetDividerPen(wxPen *pen);
void SetEditable(bool editable);
void SetGridCursor(int row, int col);
void SetLabelAlignment(int orientation, int alignment);
void SetLabelBackgroundColour(const wxColour& value);
void SetLabelSize(int orientation, int size);
void SetLabelTextColour(const wxColour& value);
void SetLabelTextFont(wxFont *font);
void SetLabelValue(int orientation, const wxString& value, int pos);
void SetRowHeight(int row, int height);
void UpdateDimensions();
};
//---------------------------------------------------------------------------
class wxNotebookEvent : public wxCommandEvent {
public:
int GetSelection();
int GetOldSelection();
};
class wxNotebook : public wxControl {
public:
wxNotebook(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = 0,
char* name = "notebook");
int GetPageCount();
int SetSelection(int nPage);
void AdvanceSelection(bool bForward = TRUE);
int GetSelection();
bool SetPageText(int nPage, const wxString& strText);
wxString GetPageText(int nPage) const;
void SetImageList(wxImageList* imageList);
wxImageList* GetImageList();
int GetPageImage(int nPage);
bool SetPageImage(int nPage, int nImage);
int GetRowCount();
// LINK ERROR: void SetPageSize(const wxSize& size);
// LINK ERROR: void SetPadding(const wxSize& padding);
bool DeletePage(int nPage);
bool DeleteAllPages();
bool AddPage(/*wxNotebookPage*/ wxWindow *pPage,
const wxString& strText,
bool bSelect = FALSE,
int imageId = -1);
bool InsertPage(int nPage,
/*wxNotebookPage*/ wxWindow *pPage,
const wxString& strText,
bool bSelect = FALSE,
int imageId = -1);
wxNotebookPage *GetPage(int nPage);
};
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//
// $Log$
// Revision 1.1 1998/08/09 08:25:52 RD
// Initial version
//
//
+390
View File
@@ -0,0 +1,390 @@
# This file was created automatically by SWIG.
import windows2c
from misc import *
from gdi import *
from windows import *
from controls import *
from events import *
class wxGridCellPtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def GetTextValue(self):
val = windows2c.wxGridCell_GetTextValue(self.this)
return val
def SetTextValue(self,arg0):
val = windows2c.wxGridCell_SetTextValue(self.this,arg0)
return val
def GetFont(self):
val = windows2c.wxGridCell_GetFont(self.this)
val = wxFontPtr(val)
return val
def SetFont(self,arg0):
val = windows2c.wxGridCell_SetFont(self.this,arg0.this)
return val
def GetTextColour(self):
val = windows2c.wxGridCell_GetTextColour(self.this)
val = wxColourPtr(val)
return val
def SetTextColour(self,arg0):
val = windows2c.wxGridCell_SetTextColour(self.this,arg0.this)
return val
def GetBackgroundColour(self):
val = windows2c.wxGridCell_GetBackgroundColour(self.this)
val = wxColourPtr(val)
return val
def SetBackgroundColour(self,arg0):
val = windows2c.wxGridCell_SetBackgroundColour(self.this,arg0.this)
return val
def GetBackgroundBrush(self):
val = windows2c.wxGridCell_GetBackgroundBrush(self.this)
val = wxBrushPtr(val)
return val
def GetAlignment(self):
val = windows2c.wxGridCell_GetAlignment(self.this)
return val
def SetAlignment(self,arg0):
val = windows2c.wxGridCell_SetAlignment(self.this,arg0)
return val
def GetCellBitmap(self):
val = windows2c.wxGridCell_GetCellBitmap(self.this)
val = wxBitmapPtr(val)
return val
def SetCellBitmap(self,arg0):
val = windows2c.wxGridCell_SetCellBitmap(self.this,arg0.this)
return val
def __repr__(self):
return "<C wxGridCell instance>"
class wxGridCell(wxGridCellPtr):
def __init__(self,this):
self.this = this
class wxGridPtr(wxPanelPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def AdjustScrollbars(self):
val = windows2c.wxGrid_AdjustScrollbars(self.this)
return val
def AppendCols(self,*args):
val = apply(windows2c.wxGrid_AppendCols,(self.this,)+args)
return val
def AppendRows(self,*args):
val = apply(windows2c.wxGrid_AppendRows,(self.this,)+args)
return val
def BeginBatch(self):
val = windows2c.wxGrid_BeginBatch(self.this)
return val
def CellHitTest(self,arg0,arg1):
val = windows2c.wxGrid_CellHitTest(self.this,arg0,arg1)
return val
def CreateGrid(self,arg0,arg1,*args):
val = apply(windows2c.wxGrid_CreateGrid,(self.this,arg0,arg1,)+args)
return val
def CurrentCellVisible(self):
val = windows2c.wxGrid_CurrentCellVisible(self.this)
return val
def DeleteCols(self,*args):
val = apply(windows2c.wxGrid_DeleteCols,(self.this,)+args)
return val
def DeleteRows(self,*args):
val = apply(windows2c.wxGrid_DeleteRows,(self.this,)+args)
return val
def EndBatch(self):
val = windows2c.wxGrid_EndBatch(self.this)
return val
def GetBatchCount(self):
val = windows2c.wxGrid_GetBatchCount(self.this)
return val
def GetCell(self,arg0,arg1):
val = windows2c.wxGrid_GetCell(self.this,arg0,arg1)
val = wxGridCellPtr(val)
return val
def GetCellAlignment(self,arg0,arg1):
val = windows2c.wxGrid_GetCellAlignment(self.this,arg0,arg1)
return val
def GetDefCellAlignment(self):
val = windows2c.wxGrid_GetDefCellAlignment(self.this)
return val
def GetCellBackgroundColour(self,arg0,arg1):
val = windows2c.wxGrid_GetCellBackgroundColour(self.this,arg0,arg1)
val = wxColourPtr(val)
return val
def GetDefCellBackgroundColour(self):
val = windows2c.wxGrid_GetDefCellBackgroundColour(self.this)
val = wxColourPtr(val)
return val
def GetCellTextColour(self,arg0,arg1):
val = windows2c.wxGrid_GetCellTextColour(self.this,arg0,arg1)
val = wxColourPtr(val)
return val
def GetDefCellTextColour(self):
val = windows2c.wxGrid_GetDefCellTextColour(self.this)
val = wxColourPtr(val)
return val
def GetCellTextFont(self,arg0,arg1):
val = windows2c.wxGrid_GetCellTextFont(self.this,arg0,arg1)
val = wxFontPtr(val)
return val
def GetDefCellTextFont(self):
val = windows2c.wxGrid_GetDefCellTextFont(self.this)
val = wxFontPtr(val)
return val
def GetCellValue(self,arg0,arg1):
val = windows2c.wxGrid_GetCellValue(self.this,arg0,arg1)
return val
def GetCols(self):
val = windows2c.wxGrid_GetCols(self.this)
return val
def GetColumnWidth(self,arg0):
val = windows2c.wxGrid_GetColumnWidth(self.this,arg0)
return val
def GetCurrentRect(self):
val = windows2c.wxGrid_GetCurrentRect(self.this)
val = wxRectPtr(val)
return val
def GetCursorColumn(self):
val = windows2c.wxGrid_GetCursorColumn(self.this)
return val
def GetCursorRow(self):
val = windows2c.wxGrid_GetCursorRow(self.this)
return val
def GetEditable(self):
val = windows2c.wxGrid_GetEditable(self.this)
return val
def GetHorizScrollBar(self):
val = windows2c.wxGrid_GetHorizScrollBar(self.this)
val = wxScrollBarPtr(val)
return val
def GetLabelAlignment(self,arg0):
val = windows2c.wxGrid_GetLabelAlignment(self.this,arg0)
return val
def GetLabelBackgroundColour(self):
val = windows2c.wxGrid_GetLabelBackgroundColour(self.this)
val = wxColourPtr(val)
return val
def GetLabelSize(self,arg0):
val = windows2c.wxGrid_GetLabelSize(self.this,arg0)
return val
def GetLabelTextColour(self):
val = windows2c.wxGrid_GetLabelTextColour(self.this)
val = wxColourPtr(val)
return val
def GetLabelTextFont(self):
val = windows2c.wxGrid_GetLabelTextFont(self.this)
val = wxFontPtr(val)
return val
def GetLabelValue(self,arg0,arg1):
val = windows2c.wxGrid_GetLabelValue(self.this,arg0,arg1)
return val
def GetRowHeight(self,arg0):
val = windows2c.wxGrid_GetRowHeight(self.this,arg0)
return val
def GetRows(self):
val = windows2c.wxGrid_GetRows(self.this)
return val
def GetScrollPosX(self):
val = windows2c.wxGrid_GetScrollPosX(self.this)
return val
def GetScrollPosY(self):
val = windows2c.wxGrid_GetScrollPosY(self.this)
return val
def GetTextItem(self):
val = windows2c.wxGrid_GetTextItem(self.this)
val = wxTextCtrlPtr(val)
return val
def GetVertScrollBar(self):
val = windows2c.wxGrid_GetVertScrollBar(self.this)
val = wxScrollBarPtr(val)
return val
def InsertCols(self,*args):
val = apply(windows2c.wxGrid_InsertCols,(self.this,)+args)
return val
def InsertRows(self,*args):
val = apply(windows2c.wxGrid_InsertRows,(self.this,)+args)
return val
def SetCellAlignment(self,arg0,arg1,arg2):
val = windows2c.wxGrid_SetCellAlignment(self.this,arg0,arg1,arg2)
return val
def SetDefCellAlignment(self,arg0):
val = windows2c.wxGrid_SetDefCellAlignment(self.this,arg0)
return val
def SetCellBackgroundColour(self,arg0,arg1,arg2):
val = windows2c.wxGrid_SetCellBackgroundColour(self.this,arg0.this,arg1,arg2)
return val
def SetDefCellBackgroundColour(self,arg0):
val = windows2c.wxGrid_SetDefCellBackgroundColour(self.this,arg0.this)
return val
def SetCellTextColour(self,arg0,arg1,arg2):
val = windows2c.wxGrid_SetCellTextColour(self.this,arg0.this,arg1,arg2)
return val
def SetDefCellTextColour(self,arg0):
val = windows2c.wxGrid_SetDefCellTextColour(self.this,arg0.this)
return val
def SetCellTextFont(self,arg0,arg1,arg2):
val = windows2c.wxGrid_SetCellTextFont(self.this,arg0.this,arg1,arg2)
return val
def SetDefCellTextFont(self,arg0):
val = windows2c.wxGrid_SetDefCellTextFont(self.this,arg0.this)
return val
def SetCellValue(self,arg0,arg1,arg2):
val = windows2c.wxGrid_SetCellValue(self.this,arg0,arg1,arg2)
return val
def SetColumnWidth(self,arg0,arg1):
val = windows2c.wxGrid_SetColumnWidth(self.this,arg0,arg1)
return val
def SetDividerPen(self,arg0):
val = windows2c.wxGrid_SetDividerPen(self.this,arg0.this)
return val
def SetEditable(self,arg0):
val = windows2c.wxGrid_SetEditable(self.this,arg0)
return val
def SetGridCursor(self,arg0,arg1):
val = windows2c.wxGrid_SetGridCursor(self.this,arg0,arg1)
return val
def SetLabelAlignment(self,arg0,arg1):
val = windows2c.wxGrid_SetLabelAlignment(self.this,arg0,arg1)
return val
def SetLabelBackgroundColour(self,arg0):
val = windows2c.wxGrid_SetLabelBackgroundColour(self.this,arg0.this)
return val
def SetLabelSize(self,arg0,arg1):
val = windows2c.wxGrid_SetLabelSize(self.this,arg0,arg1)
return val
def SetLabelTextColour(self,arg0):
val = windows2c.wxGrid_SetLabelTextColour(self.this,arg0.this)
return val
def SetLabelTextFont(self,arg0):
val = windows2c.wxGrid_SetLabelTextFont(self.this,arg0.this)
return val
def SetLabelValue(self,arg0,arg1,arg2):
val = windows2c.wxGrid_SetLabelValue(self.this,arg0,arg1,arg2)
return val
def SetRowHeight(self,arg0,arg1):
val = windows2c.wxGrid_SetRowHeight(self.this,arg0,arg1)
return val
def UpdateDimensions(self):
val = windows2c.wxGrid_UpdateDimensions(self.this)
return val
def __repr__(self):
return "<C wxGrid instance>"
class wxGrid(wxGridPtr):
def __init__(self,arg0,arg1,*args) :
argl = map(None,args)
try: argl[0] = argl[0].this
except: pass
try: argl[1] = argl[1].this
except: pass
args = tuple(argl)
self.this = apply(windows2c.new_wxGrid,(arg0.this,arg1,)+args)
self.thisown = 1
class wxNotebookEventPtr(wxCommandEventPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def GetSelection(self):
val = windows2c.wxNotebookEvent_GetSelection(self.this)
return val
def GetOldSelection(self):
val = windows2c.wxNotebookEvent_GetOldSelection(self.this)
return val
def __repr__(self):
return "<C wxNotebookEvent instance>"
class wxNotebookEvent(wxNotebookEventPtr):
def __init__(self,this):
self.this = this
class wxNotebookPtr(wxControlPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def GetPageCount(self):
val = windows2c.wxNotebook_GetPageCount(self.this)
return val
def SetSelection(self,arg0):
val = windows2c.wxNotebook_SetSelection(self.this,arg0)
return val
def AdvanceSelection(self,*args):
val = apply(windows2c.wxNotebook_AdvanceSelection,(self.this,)+args)
return val
def GetSelection(self):
val = windows2c.wxNotebook_GetSelection(self.this)
return val
def SetPageText(self,arg0,arg1):
val = windows2c.wxNotebook_SetPageText(self.this,arg0,arg1)
return val
def GetPageText(self,arg0):
val = windows2c.wxNotebook_GetPageText(self.this,arg0)
return val
def SetImageList(self,arg0):
val = windows2c.wxNotebook_SetImageList(self.this,arg0)
return val
def GetImageList(self):
val = windows2c.wxNotebook_GetImageList(self.this)
return val
def GetPageImage(self,arg0):
val = windows2c.wxNotebook_GetPageImage(self.this,arg0)
return val
def SetPageImage(self,arg0,arg1):
val = windows2c.wxNotebook_SetPageImage(self.this,arg0,arg1)
return val
def GetRowCount(self):
val = windows2c.wxNotebook_GetRowCount(self.this)
return val
def DeletePage(self,arg0):
val = windows2c.wxNotebook_DeletePage(self.this,arg0)
return val
def DeleteAllPages(self):
val = windows2c.wxNotebook_DeleteAllPages(self.this)
return val
def AddPage(self,arg0,arg1,*args):
val = apply(windows2c.wxNotebook_AddPage,(self.this,arg0.this,arg1,)+args)
return val
def InsertPage(self,arg0,arg1,arg2,*args):
val = apply(windows2c.wxNotebook_InsertPage,(self.this,arg0,arg1.this,arg2,)+args)
return val
def GetPage(self,arg0):
val = windows2c.wxNotebook_GetPage(self.this,arg0)
return val
def __repr__(self):
return "<C wxNotebook instance>"
class wxNotebook(wxNotebookPtr):
def __init__(self,arg0,arg1,*args) :
argl = map(None,args)
try: argl[0] = argl[0].this
except: pass
try: argl[1] = argl[1].this
except: pass
args = tuple(argl)
self.this = apply(windows2c.new_wxNotebook,(arg0.this,arg1,)+args)
self.thisown = 1
#-------------- FUNCTION WRAPPERS ------------------
#-------------- VARIABLE WRAPPERS ------------------
wxGRID_TEXT_CTRL = windows2c.wxGRID_TEXT_CTRL
wxGRID_HSCROLL = windows2c.wxGRID_HSCROLL
wxGRID_VSCROLL = windows2c.wxGRID_VSCROLL
File diff suppressed because it is too large Load Diff
+184
View File
@@ -0,0 +1,184 @@
%module wxp
%{
/////////////////////////////////////////////////////////////////////////////
// Name: wxp.i
// Purpose: SWIG interface file for a python wxWindows module
//
// Author: Robin Dunn
//
// Created: 5/22/98
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __WXMSW__
#include <windows.h>
#undef FindWindow
#undef GetCharWidth
#undef LoadAccelerators
#endif
#include "helpers.h"
%}
//----------------------------------------------------------------------
// This is where we include the other wrapper definition files for SWIG
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
%include _defs.i
%import misc.i
%import windows.i
%import events.i
%import gdi.i
%import mdi.i
%import controls.i
%import controls2.i
%import windows2.i
%import cmndlgs.i
%native(_wxStart) __wxStart;
%native(_wxSetDictionary) __wxSetDictionary;
//---------------------------------------------------------------------------
#define __version__ "0.3.0"
//%readonly
wxPoint wxPyDefaultPosition;
wxSize wxPyDefaultSize;
//%readwrite
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
class wxPyApp : public wxEvtHandler {
public:
%addmethods {
wxPyApp() {
wxPythonApp = new wxPyApp();
return wxPythonApp;
}
}
wxString GetAppName();
bool GetAuto3D();
wxString GetClassName();
bool GetExitOnFrameDelete();
int GetPrintMode();
wxWindow * GetTopWindow();
wxString GetVendorName();
void Dispatch();
void ExitMainLoop();
bool Initialized();
int MainLoop();
bool Pending();
void SetAppName(const wxString& name);
void SetAuto3D(bool auto3D);
void SetClassName(const wxString& name);
void SetExitOnFrameDelete(bool flag);
void SetPrintMode(int mode);
void SetTopWindow(wxWindow* window);
void SetVendorName(const wxString& name);
// This one is wxPython specific. If you override MainLoop,
// call this when done.
void AfterMainLoop();
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
%{
#ifdef __WXMSW__ // If building for win32...
extern HINSTANCE wxhInstance;
BOOL WINAPI DllMain(
HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpvReserved // reserved
)
{
wxhInstance = hinstDLL;
return 1;
}
#endif
%}
//----------------------------------------------------------------------
// This code gets added to the module initialization function
//----------------------------------------------------------------------
%{
extern "C" SWIGEXPORT(void,initwindowsc)();
extern "C" SWIGEXPORT(void,initwindows2c)();
extern "C" SWIGEXPORT(void,initeventsc)();
extern "C" SWIGEXPORT(void,initmiscc)();
extern "C" SWIGEXPORT(void,initgdic)();
extern "C" SWIGEXPORT(void,initmdic)();
extern "C" SWIGEXPORT(void,initcontrolsc)();
extern "C" SWIGEXPORT(void,initcontrols2c)();
extern "C" SWIGEXPORT(void,initcmndlgsc)();
%}
%init %{
// We don't want to run the wxEntry or OnInit yet, so we just do the
// beginings of what it would have done... See __wxStart() for the
// rest.
#ifdef __WXMSW__
wxApp::Initialize((WXHINSTANCE)wxhInstance);
#endif
#ifdef __WXGTK__
wxApp::CommonInit();
#endif
// wxPyWindows = new wxHashTable(wxKEY_INTEGER, 100);
// Since these modules are all linked together, initialize them now
// because python won't be able to find their shared library files,
// (since there isn't any.)
initwindowsc();
initwindows2c();
initeventsc();
initmiscc();
initgdic();
initmdic();
initcontrolsc();
initcontrols2c();
initcmndlgsc();
%}
//----------------------------------------------------------------------
// And this gets appended to the shadow class file.
//----------------------------------------------------------------------
%pragma(python) include="_extras.py";
/////////////////////////////////////////////////////////////////////////////
//
// $Log$
// Revision 1.1 1998/08/09 08:25:53 RD
// Initial version
//
//
Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

File diff suppressed because it is too large Load Diff
+2
View File
@@ -0,0 +1,2 @@
EXPORTS
initwxpc
+2
View File
@@ -0,0 +1,2 @@
wxpicon ICON "wxp.ico"
#include "wx/msw/wx.rc"
Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+1
View File
@@ -0,0 +1 @@
set PYTHONPATH=e:\projects\wxWindows\utils
+72
View File
@@ -0,0 +1,72 @@
#!/bin/env python
#----------------------------------------------------------------------------
# Name: test1.py
# Purpose: A minimal wxPython program
#
# Author: Robin Dunn
#
# Created:
# RCS-ID: $Id$
# Copyright: (c) 1998 by Total Control Software
# Licence: wxWindows license
#----------------------------------------------------------------------------
from wxPython import *
#---------------------------------------------------------------------------
class MyFrame(wxFrame):
def __init__(self, parent, id, title):
wxFrame.__init__(self, parent, id, title, wxPoint(100, 100), wxSize(160, 100))
self.Connect(-1, -1, wxEVT_MOVE, self.OnMove)
def OnCloseWindow(self, event):
self.Destroy()
def OnSize(self, event):
size = event.GetSize()
print "size:", size.width, size.height
def OnMove(self, event):
# Hmmm... Doesn't seem to be implmented in wxWin yet...
pos = event.GetPosition()
print "pos:", pos.x, pos.y
#---------------------------------------------------------------------------
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1, "This is a test")
frame.Show(true)
self.SetTopWindow(frame)
return true
#---------------------------------------------------------------------------
def main():
app = MyApp(0)
app.MainLoop()
def t():
import pdb
pdb.run('main()')
if __name__ == '__main__':
main()
#----------------------------------------------------------------------------
#
# $Log$
# Revision 1.1 1998/08/09 08:28:05 RD
# Initial version
#
#
+158
View File
@@ -0,0 +1,158 @@
#!/bin/env python
#----------------------------------------------------------------------------
# Name: test2.py
# Purpose: Testing GDI stuff and events.
#
# Author: Robin Dunn
#
# Created:
# RCS-ID: $Id$
# Copyright: (c) 1998 by Total Control Software
# Licence: wxWindows license
#----------------------------------------------------------------------------
from wxPython import *
#---------------------------------------------------------------------------
class MyCanvas(wxWindow):
def __init__(self, parent):
wxWindow.__init__(self, parent, -1, wxPoint(0, 0), wxPyDefaultSize, wxSUNKEN_BORDER)
self.Connect(-1, -1, wxEVT_LEFT_DOWN, self.OnLeftButtonEvent)
self.Connect(-1, -1, wxEVT_LEFT_UP, self.OnLeftButtonEvent)
self.Connect(-1, -1, wxEVT_MOTION, self.OnLeftButtonEvent)
self.SetCursor(wxStockCursor(wxCURSOR_PENCIL))
bmp = wxBitmap('bitmaps/test2.bmp', wxBITMAP_TYPE_BMP)
print 'bmp OK:', bmp.Ok()
print 'bmp: (%dx%dx%d)' % (bmp.GetWidth(), bmp.GetHeight(), bmp.GetDepth())
self.bmp = bmp
self.lines = []
def OnPaint(self, event):
dc = wxPaintDC(self)
self.DoDrawing(dc)
def DoDrawing(self, dc):
dc.BeginDrawing()
#dc.Clear()
pen1 = wxPen(wxNamedColour('RED'))
dc.SetPen(pen1)
dc.DrawRectangle(5, 5, 50, 50)
dc.SetBrush(wxLIGHT_GREY_BRUSH)
dc.SetPen(wxPen(wxNamedColour('BLUE'), 4))
dc.DrawRectangle(15, 15, 50, 50)
font = wxFont(14, wxSWISS, wxNORMAL, wxNORMAL)
dc.SetFont(font)
dc.SetTextForeground(wxColour(0xFF, 0x20, 0xFF))
te = dc.GetTextExtent("Hello World")
dc.DrawText("Hello World", 60, 65)
dc.SetPen(wxPen(wxNamedColour('VIOLET'), 4))
dc.DrawLine(5, 65+te[1], 60+te[0], 65+te[1])
lst = [(100,110), (150,110), (150,160), (100,160)]
dc.DrawLines(lst, -60)
dc.SetPen(wxGREY_PEN)
dc.DrawPolygon(lst, 75)
dc.SetPen(wxGREEN_PEN)
dc.DrawSpline(lst+[(100,100)])
dc.DrawBitmap(self.bmp, 200, 20)
dc.SetTextForeground(wxColour(0, 0xFF, 0x80))
dc.DrawText("a bitmap", 200, 80)
self.DrawSavedLines(dc)
dc.EndDrawing()
def DrawSavedLines(self, dc):
dc.SetPen(wxPen(wxNamedColour('MEDIUM FOREST GREEN'), 4))
for line in self.lines:
for coords in line:
apply(dc.DrawLine, coords)
def OnLeftButtonEvent(self, event):
if event.LeftDown():
self.x, self.y = event.GetX(), event.GetY()
self.curLine = []
elif event.Dragging():
dc = wxClientDC(self)
dc.BeginDrawing()
dc.SetPen(wxPen(wxNamedColour('MEDIUM FOREST GREEN'), 4))
coords = (self.x, self.y, event.GetX(), event.GetY())
self.curLine.append(coords)
apply(dc.DrawLine, coords)
self.x, self.y = event.GetX(), event.GetY()
dc.EndDrawing()
elif event.LeftUp():
self.lines.append(self.curLine)
self.curLine = []
#---------------------------------------------------------------------------
class MyFrame(wxFrame):
def __init__(self, parent, id, title):
wxFrame.__init__(self, parent, id, title, wxPyDefaultPosition, wxSize(320, 200))
self.canvas = MyCanvas(self)
def OnCloseWindow(self, event):
self.Destroy()
def OnSize(self, event):
w,h = self.GetClientSize()
#self.canvas.SetSize(5, 5, w-10, h-10)
self.canvas.SetDimensions(0, 0, w, h)
#---------------------------------------------------------------------------
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1, "Test 2")
frame.Show(true)
self.SetTopWindow(frame)
return true
#---------------------------------------------------------------------------
def main():
app = MyApp(0)
app.MainLoop()
def t():
import pdb
pdb.run('main()')
if __name__ == '__main__':
main()
#----------------------------------------------------------------------------
#
# $Log$
# Revision 1.1 1998/08/09 08:28:05 RD
# Initial version
#
#
+144
View File
@@ -0,0 +1,144 @@
#!/bin/env python
#----------------------------------------------------------------------------
# Name: test3.py
# Purpose: Testing menus and status lines
#
# Author: Robin Dunn
#
# Created:
# RCS-ID: $Id$
# Copyright: (c) 1998 by Total Control Software
# Licence: wxWindows license
#----------------------------------------------------------------------------
from wxPython import *
#---------------------------------------------------------------------------
class MyCanvas(wxWindow):
def OnPaint(self, event):
dc = wxPaintDC(self)
dc.BeginDrawing()
w, h = self.GetClientSize()
font = wxFont(42, wxSWISS, wxNORMAL, wxNORMAL)
dc.SetFont(font)
st = "Python Rules!"
tw,th, d,e = dc.GetTextExtent(st)
dc.DrawText(st, (w-tw)/2, (h-th)/2)
dc.EndDrawing()
#---------------------------------------------------------------------------
class MyMiniFrame(wxMiniFrame):
def __init__(self, parent, ID, title, pos, size, style):
wxMiniFrame.__init__(self, parent, ID, title, pos, size, style)
panel = wxPanel(self, -1)
ID = NewId()
button = wxButton(panel, ID, "Close Me")
button.SetPosition(wxPoint(15, 15))
self.Connect(ID, -1, wxEVT_COMMAND_BUTTON_CLICKED, self.OnCloseMe)
def OnCloseMe(self, event):
self.Close(true)
def OnCloseWindow(self, event):
self.Destroy()
#---------------------------------------------------------------------------
class MyFrame(wxFrame):
def __init__(self, parent, id, title):
wxFrame.__init__(self, parent, id, title, wxPyDefaultPosition,
wxSize(420, 200))
self.canvas = MyCanvas(self, -1)
self.CreateStatusBar(3)
mainmenu = wxMenuBar()
menu = wxMenu()
menu.Append(100, 'A &Menu Item', 'the help text')
menu.Append(101, '&Another', 'Grok!')
menu.AppendSeparator()
menu.Append(200, 'E&xit', 'Get the heck outta here!')
mainmenu.Append(menu, "&It's a menu!")
self.SetMenuBar(mainmenu)
print menu.GetHelpString(100)
print mainmenu.GetHelpString(101)
print mainmenu.GetHelpString(200)
self.DragAcceptFiles(true)
self.Connect(-1, -1, wxEVT_COMMAND_MENU_SELECTED, self.OnMenuCommand)
self.Connect(-1, -1, wxEVT_DROP_FILES, self.OnDropFiles)
def OnCloseWindow(self, event):
print 'OnCloseWindow'
self.Destroy()
def OnSize(self, event):
w,h = self.GetClientSize()
self.canvas.SetSize(wxSize(w, h))
self.SetStatusText("hello, this is a test: (%d, %d)" % (w,h))
## def OnMenuHighlight(self, event):
## mainmenu = self.GetMenuBar()
## st = mainmenu.GetHelpString(event.GetMenuId())
## self.SetStatusText('['+st+']', 0)
def OnMenuCommand(self, event):
# why isn't this a wxMenuEvent???
print event, event.GetInt()
if event.GetInt() == 200:
self.Close()
elif event.GetInt() == 101:
win = MyMiniFrame(self, -1, "This is a Mini...",
wxPoint(-1, -1), #wxPyDefaultPosition,
wxSize(150, 150),
wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
wxTHICK_FRAME | wxSYSTEM_MENU |
wxTINY_CAPTION_HORIZ)
win.Show(true)
def OnDropFiles(self, event):
fileList = event.GetFiles()
for file in fileList:
print file
#---------------------------------------------------------------------------
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1, "Test 3")
frame.Show(true)
self.SetTopWindow(frame)
return true
#---------------------------------------------------------------------------
def main():
app = MyApp(0)
app.MainLoop()
def t():
import pdb
pdb.run('main()')
if __name__ == '__main__':
main()
#----------------------------------------------------------------------------
#
# $Log$
# Revision 1.1 1998/08/09 08:28:05 RD
# Initial version
#
#

Some files were not shown because too many files have changed in this diff Show More