1. wxHtmlHelpController and related classes

2. the C++ versions of wxSizer and firends, Python versions are
   'depreciated'
3. wxPyEvent and wxPyCommandEvent, event classes that can carry some
   python objects through the event system and safely come back out
   again.
4. wxGridSizer and wxFlexGridSizer
5. wxValidator
6. wxPyOnDemandOutputWindow
7. several tweaks, fixes and additions of missing methods, etc.
8. and probably several other things I am forgetting since CVS was
   down so long...


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3758 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
1999-09-30 07:11:20 +00:00
parent 2348eaee20
commit 2f90df854e
62 changed files with 10668 additions and 2215 deletions

251
utils/wxPython/src/sizers.i Normal file
View File

@@ -0,0 +1,251 @@
/////////////////////////////////////////////////////////////////////////////
// Name: sizers.i
// Purpose: SWIG definitions of the wxSizer family of classes
//
// Author: Robin Dunn
//
// Created: 18-Sept-1999
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
%module sizers
%{
#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
%import controls.i
%pragma(python) code = "import wx"
%pragma(python) code = "import string"
//---------------------------------------------------------------------------
%{
class wxPyUserData : public wxObject {
public:
wxPyUserData(PyObject* obj) { m_obj = obj; Py_INCREF(m_obj); }
~wxPyUserData() {
bool doSave = wxPyRestoreThread();
Py_DECREF(m_obj);
wxPySaveThread(doSave);
}
PyObject* m_obj;
};
%}
//---------------------------------------------------------------------------
class wxSizerItem {
public:
// No need to ever create one directly in Python...
//wxSizerItem( int width, int height, int option, int flag, int border, wxObject* userData);
//wxSizerItem( wxWindow *window, int option, int flag, int border, wxObject* userData );
//wxSizerItem( wxSizer *sizer, int option, int flag, int border, wxObject* userData );
wxSize GetSize();
wxSize CalcMin();
void SetDimension( wxPoint pos, wxSize size );
bool IsWindow();
bool IsSizer();
bool IsSpacer();
wxWindow *GetWindow();
wxSizer *GetSizer();
int GetOption();
int GetFlag();
int GetBorder();
// wxObject* GetUserData();
%addmethods {
// Assume that the user data is a wxPyUserData object and return the contents
PyObject* GetUserData() {
wxPyUserData* data = (wxPyUserData*)self->GetUserData();
if (data) {
Py_INCREF(data->m_obj);
return data->m_obj;
} else {
Py_INCREF(Py_None);
return Py_None;
}
}
}
};
//---------------------------------------------------------------------------
class wxSizer {
public:
// wxSizer(); **** abstract, can't instantiate
// ~wxSizer();
%addmethods {
void Destroy() { delete self; }
void AddWindow(wxWindow *window, int option=0, int flag=0, int border=0,
PyObject* userData=NULL) {
wxPyUserData* data = NULL;
if (userData) data = new wxPyUserData(userData);
self->Add(window, option, flag, border, data);
}
void AddSizer(wxSizer *sizer, int option=0, int flag=0, int border=0,
PyObject* userData=NULL) {
wxPyUserData* data = NULL;
if (userData) data = new wxPyUserData(userData);
self->Add(sizer, option, flag, border, data);
}
void AddSpacer(int width, int height, int option=0, int flag=0,
int border=0, PyObject* userData=NULL) {
wxPyUserData* data = NULL;
if (userData) data = new wxPyUserData(userData);
self->Add(width, height, option, flag, border, data);
}
void PrependWindow(wxWindow *window, int option=0, int flag=0, int border=0,
PyObject* userData=NULL) {
wxPyUserData* data = NULL;
if (userData) data = new wxPyUserData(userData);
self->Prepend(window, option, flag, border, data);
}
void PrependSizer(wxSizer *sizer, int option=0, int flag=0, int border=0,
PyObject* userData=NULL) {
wxPyUserData* data = NULL;
if (userData) data = new wxPyUserData(userData);
self->Prepend(sizer, option, flag, border, data);
}
void PrependSpacer(int width, int height, int option=0, int flag=0,
int border=0, PyObject* userData=NULL) {
wxPyUserData* data = NULL;
if (userData) data = new wxPyUserData(userData);
self->Prepend(width, height, option, flag, border, data);
}
}
%name(RemoveWindow)bool Remove( wxWindow *window );
%name(RemoveSizer)bool Remove( wxSizer *sizer );
%name(RemovePos)bool Remove( int pos );
%pragma(python) addtoclass = "
def Add(self, *args):
if type(args[0]) == type(1):
apply(self.AddSpacer, args)
elif string.find(args[0].this, 'Sizer') != -1:
apply(self.AddSizer, args)
else:
apply(self.AddWindow, args)
def Prepend(self, *args):
if type(args[0]) == type(1):
apply(self.PrependSpacer, args)
elif string.find(args[0].this, 'Sizer') != -1:
apply(self.PrependSizer, args)
else:
apply(self.PrependWindow, args)
def Remove(self, *args):
if type(args[0]) == type(1):
apply(self.RemovePos, args)
elif string.find(args[0].this, 'Sizer') != -1:
apply(self.RemoveSizer, args)
else:
apply(self.RemoveWindow, args)
def AddMany(self, widgets):
for childinfo in widgets:
if type(childinfo) != type(()):
childinfo = (childinfo, )
apply(self.Add, childinfo)
"
void SetDimension( int x, int y, int width, int height );
wxSize GetSize();
wxPoint GetPosition();
wxSize GetMinSize();
// void RecalcSizes() = 0;
// wxSize CalcMin() = 0;
void Layout();
void Fit( wxWindow *window );
void SetSizeHints( wxWindow *window );
// wxList& GetChildren();
%addmethods {
PyObject* GetChildren() {
wxList& list = self->GetChildren();
return wxPy_ConvertList(&list, "wxSizerItem");
}
}
};
//---------------------------------------------------------------------------
// Use this one for deriving Python classes from
%{
class wxPySizer : public wxSizer {
DECLARE_DYNAMIC_CLASS(wxPySizer);
public:
wxPySizer() : wxSizer() {};
DEC_PYCALLBACK___pure(RecalcSizes);
DEC_PYCALLBACK_wxSize__pure(CalcMin);
PYPRIVATE;
};
IMP_PYCALLBACK___pure(wxPySizer, wxSizer, RecalcSizes);
IMP_PYCALLBACK_wxSize__pure(wxPySizer, wxSizer, CalcMin);
IMPLEMENT_DYNAMIC_CLASS(wxPySizer, wxSizer);
%}
class wxPySizer : public wxSizer {
public:
wxPySizer();
void _setSelf(PyObject* self);
%pragma(python) addtomethod = "__init__:self._setSelf(self)"
};
//---------------------------------------------------------------------------
class wxBoxSizer : public wxSizer {
public:
wxBoxSizer(int orient = wxHORIZONTAL);
int GetOrientation();
};
//---------------------------------------------------------------------------
class wxStaticBoxSizer : public wxBoxSizer {
public:
wxStaticBoxSizer(wxStaticBox *box, int orient = wxHORIZONTAL);
wxStaticBox *GetStaticBox();
};
//---------------------------------------------------------------------------