A bunch of little tweaks

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@8401 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2000-09-19 00:21:48 +00:00
parent 2bd6903d18
commit a927ed1665
12 changed files with 1340 additions and 48 deletions

View File

@@ -9,16 +9,15 @@ class TestPanel(wxPanel):
self.log = log
self.count = 0
wxStaticText(self, -1, "This example uses the wxGauge control.",
wxStaticText(self, -1, "This example shows the wxGauge control.",
wxPoint(45, 15))
#self.g1 = wxGauge(self, -1, 50, wxPoint(40, 50), wxSize(40, 160),
# wxGA_VERTICAL)
#self.g1.SetBezelFace(3)
#self.g1.SetShadowWidth(3)
self.g1 = wxGauge(self, -1, 50, wxPoint(110, 50), wxSize(250, 25))
self.g1.SetBezelFace(3)
self.g1.SetShadowWidth(3)
self.g2 = wxGauge(self, -1, 50, wxPoint(110, 50), wxSize(250, 25),
wxGA_HORIZONTAL)
self.g2 = wxGauge(self, -1, 50, wxPoint(110, 95), wxSize(250, 25),
wxGA_HORIZONTAL|wxGA_SMOOTH)
self.g2.SetBezelFace(5)
self.g2.SetShadowWidth(5)
@@ -29,7 +28,7 @@ class TestPanel(wxPanel):
self.count = self.count + 1
if self.count >= 50:
self.count = 0
#self.g1.SetValue(self.count)
self.g1.SetValue(self.count)
self.g2.SetValue(self.count)

View File

@@ -60,7 +60,7 @@ musicdata = {
class TestListCtrlPanel(wxPanel):
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1)
wxPanel.__init__(self, parent, -1, style=wxWANTS_CHARS)
self.log = log
tID = wxNewId()
@@ -68,8 +68,8 @@ class TestListCtrlPanel(wxPanel):
self.il = wxImageList(16, 16)
idx1 = self.il.Add(wxBitmap('bitmaps/smiles.bmp', wxBITMAP_TYPE_BMP))
self.list = wxListCtrl(self, tID, wxDefaultPosition, wxDefaultSize,
wxLC_REPORT|wxSUNKEN_BORDER)
self.list = wxListCtrl(self, tID,
style=wxLC_REPORT|wxSUNKEN_BORDER)
self.list.SetImageList(self.il, wxIMAGE_LIST_SMALL)
self.list.SetToolTip(wxToolTip("This is a ToolTip!"))
@@ -100,6 +100,7 @@ class TestListCtrlPanel(wxPanel):
self.currentItem = 0
EVT_SIZE(self, self.OnSize)
EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected)
EVT_LIST_ITEM_ACTIVATED(self, tID, self.OnItemActivated)
EVT_LIST_DELETE_ITEM(self, tID, self.OnItemDelete)
EVT_LIST_COL_CLICK(self, tID, self.OnColClick)
EVT_LEFT_DCLICK(self.list, self.OnDoubleClick)
@@ -122,6 +123,10 @@ class TestListCtrlPanel(wxPanel):
self.currentItem = event.m_itemIndex
self.log.WriteText("OnItemSelected: %s\n" % self.list.GetItemText(self.currentItem))
def OnItemActivated(self, event):
self.currentItem = event.m_itemIndex
self.log.WriteText("OnItemActivated: %s\n" % self.list.GetItemText(self.currentItem))
def OnItemDelete(self, event):
self.log.WriteText("OnItemDelete\n")

View File

@@ -12,6 +12,8 @@ class TestPanel(wxPanel):
t = wxTextCtrl(self, 10, "Test it out and see", wxPoint(80, 25), wxSize(150, 20))
t.SetInsertionPoint(0)
EVT_TEXT(self, 10, self.EvtText)
EVT_CHAR(t, self.EvtChar)
wxStaticText(self, -1, "Passsword", wxPoint(5, 50), wxSize(75, 20))
wxTextCtrl(self, 20, "", wxPoint(80, 50), wxSize(150, 20), wxTE_PASSWORD)
@@ -26,6 +28,10 @@ class TestPanel(wxPanel):
self.log.WriteText('EvtText: %s\n' % event.GetString())
def EvtChar(self, event):
self.log.WriteText('EvtChar: %d\n' % event.GetKeyCode())
event.Skip()
#---------------------------------------------------------------------------

View File

@@ -380,7 +380,7 @@ public:
%addmethods {
int __cmp__(wxTreeItemId* other) {
if (! other) return 0;
if (! other) return -1;
return *self != *other;
}
}

View File

@@ -156,6 +156,15 @@ public:
wxPoint GetLogicalPosition(const wxDC& dc);
long GetX();
long GetY();
long m_x, m_y;
bool m_leftDown;
bool m_middleDown;
bool m_rightDown;
bool m_controlDown;
bool m_shiftDown;
bool m_altDown;
bool m_metaDown;
};
//---------------------------------------------------------------------------
@@ -177,6 +186,15 @@ public:
long GetY();
wxPoint GetPosition();
%name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
long m_x, m_y;
long m_keyCode;
bool m_controlDown;
bool m_shiftDown;
bool m_altDown;
bool m_metaDown;
bool m_scanCode;
};
//---------------------------------------------------------------------------

View File

@@ -462,7 +462,7 @@ PyObject* wxPyCallbackHelper::callCallbackObj(PyObject* argTuple) const {
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// These classes can be derived from in Python and passed through the event
// system without loosing anything. They do this by keeping a reference to
// system without losing anything. They do this by keeping a reference to
// themselves and some special case handling in wxPyCallback::EventThunker.

View File

@@ -7327,7 +7327,150 @@ static PyObject *_wrap_new_wxSpinCtrl(PyObject *self, PyObject *args, PyObject *
return _resultobj;
}
#define wxSpinCtrl_GetMax(_swigobj) (_swigobj->GetMax())
static PyObject *_wrap_wxSpinCtrl_GetMax(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxSpinCtrl * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSpinCtrl_GetMax",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_GetMax. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxSpinCtrl_GetMax(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxSpinCtrl_GetMin(_swigobj) (_swigobj->GetMin())
static PyObject *_wrap_wxSpinCtrl_GetMin(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxSpinCtrl * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSpinCtrl_GetMin",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_GetMin. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxSpinCtrl_GetMin(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxSpinCtrl_GetValue(_swigobj) (_swigobj->GetValue())
static PyObject *_wrap_wxSpinCtrl_GetValue(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxSpinCtrl * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSpinCtrl_GetValue",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_GetValue. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxSpinCtrl_GetValue(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxSpinCtrl_SetRange(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetRange(_swigarg0,_swigarg1))
static PyObject *_wrap_wxSpinCtrl_SetRange(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxSpinCtrl * _arg0;
int _arg1;
int _arg2;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","min","max", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxSpinCtrl_SetRange",_kwnames,&_argo0,&_arg1,&_arg2))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_SetRange. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxSpinCtrl_SetRange(_arg0,_arg1,_arg2);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxSpinCtrl_SetValue(_swigobj,_swigarg0) (_swigobj->SetValue(_swigarg0))
static PyObject *_wrap_wxSpinCtrl_SetValue(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxSpinCtrl * _arg0;
int _arg1;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","value", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxSpinCtrl_SetValue",_kwnames,&_argo0,&_arg1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_SetValue. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxSpinCtrl_SetValue(_arg0,_arg1);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
static PyMethodDef controlscMethods[] = {
{ "wxSpinCtrl_SetValue", (PyCFunction) _wrap_wxSpinCtrl_SetValue, METH_VARARGS | METH_KEYWORDS },
{ "wxSpinCtrl_SetRange", (PyCFunction) _wrap_wxSpinCtrl_SetRange, METH_VARARGS | METH_KEYWORDS },
{ "wxSpinCtrl_GetValue", (PyCFunction) _wrap_wxSpinCtrl_GetValue, METH_VARARGS | METH_KEYWORDS },
{ "wxSpinCtrl_GetMin", (PyCFunction) _wrap_wxSpinCtrl_GetMin, METH_VARARGS | METH_KEYWORDS },
{ "wxSpinCtrl_GetMax", (PyCFunction) _wrap_wxSpinCtrl_GetMax, METH_VARARGS | METH_KEYWORDS },
{ "new_wxSpinCtrl", (PyCFunction) _wrap_new_wxSpinCtrl, METH_VARARGS | METH_KEYWORDS },
{ "wxSlider_SetValue", (PyCFunction) _wrap_wxSlider_SetValue, METH_VARARGS | METH_KEYWORDS },
{ "wxSlider_SetTick", (PyCFunction) _wrap_wxSlider_SetTick, METH_VARARGS | METH_KEYWORDS },

View File

@@ -806,6 +806,21 @@ class wxSpinCtrlPtr(wxSpinButtonPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def GetMax(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_GetMax,(self,) + _args, _kwargs)
return val
def GetMin(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_GetMin,(self,) + _args, _kwargs)
return val
def GetValue(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_GetValue,(self,) + _args, _kwargs)
return val
def SetRange(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_SetRange,(self,) + _args, _kwargs)
return val
def SetValue(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_SetValue,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxSpinCtrl instance at %s>" % (self.this,)
class wxSpinCtrl(wxSpinCtrlPtr):

View File

@@ -4678,7 +4678,7 @@ static PyObject *_wrap_wxTreeItemId_IsOk(PyObject *self, PyObject *args, PyObjec
}
static int wxTreeItemId___cmp__(wxTreeItemId *self,wxTreeItemId * other) {
if (! other) return 0;
if (! other) return -1;
return *self != *other;
}
static PyObject *_wrap_wxTreeItemId___cmp__(PyObject *self, PyObject *args, PyObject *kwargs) {

File diff suppressed because it is too large Load Diff

View File

@@ -298,6 +298,55 @@ class wxMouseEventPtr(wxEventPtr):
def GetY(self, *_args, **_kwargs):
val = apply(eventsc.wxMouseEvent_GetY,(self,) + _args, _kwargs)
return val
def __setattr__(self,name,value):
if name == "m_x" :
eventsc.wxMouseEvent_m_x_set(self,value)
return
if name == "m_y" :
eventsc.wxMouseEvent_m_y_set(self,value)
return
if name == "m_leftDown" :
eventsc.wxMouseEvent_m_leftDown_set(self,value)
return
if name == "m_middleDown" :
eventsc.wxMouseEvent_m_middleDown_set(self,value)
return
if name == "m_rightDown" :
eventsc.wxMouseEvent_m_rightDown_set(self,value)
return
if name == "m_controlDown" :
eventsc.wxMouseEvent_m_controlDown_set(self,value)
return
if name == "m_shiftDown" :
eventsc.wxMouseEvent_m_shiftDown_set(self,value)
return
if name == "m_altDown" :
eventsc.wxMouseEvent_m_altDown_set(self,value)
return
if name == "m_metaDown" :
eventsc.wxMouseEvent_m_metaDown_set(self,value)
return
self.__dict__[name] = value
def __getattr__(self,name):
if name == "m_x" :
return eventsc.wxMouseEvent_m_x_get(self)
if name == "m_y" :
return eventsc.wxMouseEvent_m_y_get(self)
if name == "m_leftDown" :
return eventsc.wxMouseEvent_m_leftDown_get(self)
if name == "m_middleDown" :
return eventsc.wxMouseEvent_m_middleDown_get(self)
if name == "m_rightDown" :
return eventsc.wxMouseEvent_m_rightDown_get(self)
if name == "m_controlDown" :
return eventsc.wxMouseEvent_m_controlDown_get(self)
if name == "m_shiftDown" :
return eventsc.wxMouseEvent_m_shiftDown_get(self)
if name == "m_altDown" :
return eventsc.wxMouseEvent_m_altDown_get(self)
if name == "m_metaDown" :
return eventsc.wxMouseEvent_m_metaDown_get(self)
raise AttributeError,name
def __repr__(self):
return "<C wxMouseEvent instance at %s>" % (self.this,)
class wxMouseEvent(wxMouseEventPtr):
@@ -346,6 +395,50 @@ class wxKeyEventPtr(wxEventPtr):
def GetPositionTuple(self, *_args, **_kwargs):
val = apply(eventsc.wxKeyEvent_GetPositionTuple,(self,) + _args, _kwargs)
return val
def __setattr__(self,name,value):
if name == "m_x" :
eventsc.wxKeyEvent_m_x_set(self,value)
return
if name == "m_y" :
eventsc.wxKeyEvent_m_y_set(self,value)
return
if name == "m_keyCode" :
eventsc.wxKeyEvent_m_keyCode_set(self,value)
return
if name == "m_controlDown" :
eventsc.wxKeyEvent_m_controlDown_set(self,value)
return
if name == "m_shiftDown" :
eventsc.wxKeyEvent_m_shiftDown_set(self,value)
return
if name == "m_altDown" :
eventsc.wxKeyEvent_m_altDown_set(self,value)
return
if name == "m_metaDown" :
eventsc.wxKeyEvent_m_metaDown_set(self,value)
return
if name == "m_scanCode" :
eventsc.wxKeyEvent_m_scanCode_set(self,value)
return
self.__dict__[name] = value
def __getattr__(self,name):
if name == "m_x" :
return eventsc.wxKeyEvent_m_x_get(self)
if name == "m_y" :
return eventsc.wxKeyEvent_m_y_get(self)
if name == "m_keyCode" :
return eventsc.wxKeyEvent_m_keyCode_get(self)
if name == "m_controlDown" :
return eventsc.wxKeyEvent_m_controlDown_get(self)
if name == "m_shiftDown" :
return eventsc.wxKeyEvent_m_shiftDown_get(self)
if name == "m_altDown" :
return eventsc.wxKeyEvent_m_altDown_get(self)
if name == "m_metaDown" :
return eventsc.wxKeyEvent_m_metaDown_get(self)
if name == "m_scanCode" :
return eventsc.wxKeyEvent_m_scanCode_get(self)
raise AttributeError,name
def __repr__(self):
return "<C wxKeyEvent instance at %s>" % (self.this,)
class wxKeyEvent(wxKeyEventPtr):

View File

@@ -65,6 +65,12 @@ class FileBrowseButton(wxPanel):
self.fileMode = fileMode
self.changeCallback = changeCallback
# get background to match it
try:
self._bc = parent.GetBackgroundColour()
except:
pass
# create the dialog
self.createDialog(parent, id, pos, size, style )
# Setting a value causes the changeCallback to be called.
@@ -76,7 +82,11 @@ class FileBrowseButton(wxPanel):
def createDialog( self, parent, id, pos, size, style ):
"""Setup the graphic representation of the dialog"""
wxPanel.__init__ (self, parent, id, pos, size, style)
# try to set the background colour
try:
self.SetBackgroundColour(self._bc)
except:
pass
box = wxBoxSizer(wxHORIZONTAL)
self.label = self.createLabel( )
@@ -99,6 +109,10 @@ class FileBrowseButton(wxPanel):
if size.width != -1 or size.height != -1:
self.SetSize(size)
def SetBackgroundColour(self,color):
wxPanel.SetBackgroundColour(self,color)
self.label.SetBackgroundColour(color)
def createLabel( self ):
"""Create the label/caption"""
label = wxStaticText(self, -1, self.labelText, style =wxALIGN_RIGHT )
@@ -125,21 +139,27 @@ class FileBrowseButton(wxPanel):
EVT_BUTTON(button, ID, self.OnBrowse)
return button
def OnBrowse (self, event = None):
""" Going to browse for file... """
current = self.GetValue()
directory = os.path.split(current)
if os.path.isdir( current):
directory = current
current = ''
elif directory and os.path.isdir( directory[0] ):
current = directory[1]
directory = directory [0]
else:
directory = self.startDirectory
dlg = wxFileDialog(self, self.dialogTitle, directory, current, self.fileMask, self.fileMode)
if dlg.ShowModal() == wxID_OK:
self.SetValue (dlg.GetPath())
dlg.Destroy()
def GetValue (self):
""" Convenient access to text control value """
return self.textControl.GetValue ()