]> git.saurik.com Git - wxWidgets.git/commitdiff
various tweaks and updates
authorRobin Dunn <robin@alldunn.com>
Sun, 12 May 2002 03:20:42 +0000 (03:20 +0000)
committerRobin Dunn <robin@alldunn.com>
Sun, 12 May 2002 03:20:42 +0000 (03:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15520 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

13 files changed:
wxPython/demo/wxOGL.py
wxPython/demo/wxPopupWindow.py
wxPython/src/helpers.cpp
wxPython/src/misc2.i
wxPython/src/msw/misc2.cpp
wxPython/src/msw/misc2.py
wxPython/src/msw/utils.cpp
wxPython/src/msw/windows.cpp
wxPython/src/msw/windows.py
wxPython/src/msw/windows2.cpp
wxPython/src/utils.i
wxPython/src/windows.i
wxPython/src/windows2.i

index 32b0676cfaf1cac2e2bfc28fbe23e71dd0ceee05..0b2af68b53f367d57ef89b00612b30698fd5a4f3 100644 (file)
@@ -166,11 +166,7 @@ class TestWindow(wxShapeCanvas):
             # for some reason, the shapes have to be moved for the line to show up...
             fromShape.Move(dc, fromShape.GetX(), fromShape.GetY())
 
-##         EVT_PAINT(self, self.OnPaint)
-
-##     def OnPaint(self, evt):
-##         evt.Skip()
-##         print "TheLists:", wxThePenList.GetCount(), wxTheBrushList.GetCount(), wxTheFontList.GetCount()
+            EVT_WINDOW_DESTROY(self, self.OnDestroy)
 
 
     def MyAddShape(self, shape, x, y, pen, brush, text):
@@ -194,7 +190,8 @@ class TestWindow(wxShapeCanvas):
 
 
 
-    def __del__(self):
+    def OnDestroy(self, evt):
+        # Do some cleanup
         for shape in self.diagram.GetShapeList():
             if shape.GetParent() == None:
                 shape.SetCanvas(None)
index c9ac6d4c189f612cf0947491ac433169cfd8e40f..809024a675e4b04eb4b28a0dae03cbce596454bd 100644 (file)
@@ -52,27 +52,24 @@ class TestPopup(wxPopupWindow):
         self.Destroy()
 
 
-class TestPopupWithListbox(wxPopupWindow):
-    def __init__(self, parent, style, log):
-        wxPopupWindow.__init__(self, parent, style)
-        import keyword
-        self.lb = wxListBox(self, -1, choices = keyword.kwlist)
-
-        #sz = self.lb.GetBestSize()
-        self.SetSize((150, 75)) #sz)
-        self.lb.SetSize(self.GetClientSize())
-        self.lb.SetFocus()
-
-        EVT_LEFT_DOWN(self.lb, self.OnLeft)
-        EVT_LISTBOX(self, -1, self.OnListBox)
-
-
-    def OnLeft(self, evt):
-        print "OnLeft", evt.GetEventObject()
-        evt.Skip()
-    def OnListBox(self, evt):
-        print "OnListBox", evt.GetEventObject()
-        evt.Skip()
+## class TestPopupWithListbox(wxPopupWindow):
+##     def __init__(self, parent, style, log):
+##         wxPopupWindow.__init__(self, parent, style)
+##         import keyword
+##         self.lb = wxListBox(self, -1, choices = keyword.kwlist)
+##         #sz = self.lb.GetBestSize()
+##         self.SetSize((150, 75)) #sz)
+##         self.lb.SetSize(self.GetClientSize())
+##         self.lb.SetFocus()
+##         EVT_LEFT_DOWN(self.lb, self.OnLeft)
+##         EVT_LISTBOX(self, -1, self.OnListBox)
+
+##     def OnLeft(self, evt):
+##         print "OnLeft", evt.GetEventObject()
+##         evt.Skip()
+##     def OnListBox(self, evt):
+##         print "OnListBox", evt.GetEventObject()
+##         evt.Skip()
 
 
 
@@ -145,17 +142,17 @@ class TestPanel(wxPanel):
         win.Popup()
 
 
-    def OnShowPopupListbox(self, evt):
-        win = TestPopupWithListbox(self, wxNO_BORDER, self.log)
+##     def OnShowPopupListbox(self, evt):
+##         win = TestPopupWithListbox(self, wxNO_BORDER, self.log)
 
-        # Show the popup right below or above the button
-        # depending on available screen space...
-        btn = evt.GetEventObject()
-        pos = btn.ClientToScreen( (0,0) )
-        sz =  btn.GetSize()
-        win.Position(pos, (0, sz.height))
+##         # Show the popup right below or above the button
+##         # depending on available screen space...
+##         btn = evt.GetEventObject()
+##         pos = btn.ClientToScreen( (0,0) )
+##         sz =  btn.GetSize()
+##         win.Position(pos, (0, sz.height))
 
-        win.Show(true)
+##         win.Show(true)
 
 #---------------------------------------------------------------------------
 
index 72f84096ac7043aecd26c66a052b6aa1aa71f2e0..4188b1ebb9dedca6adbd4bc21dfbaa85ab17a58c 100644 (file)
@@ -182,6 +182,8 @@ void __wxPreStart()
     wxPyTMutex = new wxMutex;
 #endif
 
+    wxApp::CheckBuildOptions(wxBuildOptions());
+
     // Bail out if there is already a wxApp created.  This means that the
     // toolkit has already been initialized, as in embedding wxPython in
     // a C++ wxWindows app, so we don't need to call wxEntryStart.
index 64e505ac8d18525d6a2dd7325a900486b6ac69cc..ddcb749eb300f3a19392446e2335f5147e1926df 100644 (file)
@@ -328,12 +328,12 @@ public:
     // return true if the port has certain feature
     static bool HasFeature(wxSystemFeature index);
 
-//     // Get system screen design (desktop, pda, ..) used for
-//     // laying out various dialogs.
-//     static wxSystemScreen GetScreen();
+   // Get system screen design (desktop, pda, ..) used for
+   // laying out various dialogs.
+   static wxSystemScreen GetScreen();
 
-//     // Override default.
-//     static void SetScreen( wxSystemScreen screen );
+   // Override default.
+   static void SetScreen( wxSystemScreen screen );
 
 };
 
@@ -673,12 +673,9 @@ void wxLogStatus(const wxString& szFormat);
 %name(wxLogStatusFrame)void wxLogStatus(wxFrame *pFrame, const wxString& szFormat);
 void wxLogSysError(const wxString& szFormat);
 
-
 // wxLogFatalError helper: show the (fatal) error to the user in a safe way,
 // i.e. without using wxMessageBox() for example because it could crash
-
-// TODO:  Why am I getting a link error on this???
-// void wxSafeShowMessage(const wxString& title, const wxString& text);
+void wxSafeShowMessage(const wxString& title, const wxString& text);
 
 
 
index 144f2a386413e0ee6290e11a974831b2eb7a1fef..51ec40fb62045c3d4e176b4869495ede99dec0cc 100644 (file)
@@ -2324,6 +2324,46 @@ static PyObject *_wrap_wxLogSysError(PyObject *self, PyObject *args, PyObject *k
     return _resultobj;
 }
 
+static PyObject *_wrap_wxSafeShowMessage(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxString * _arg0;
+    wxString * _arg1;
+    PyObject * _obj0 = 0;
+    PyObject * _obj1 = 0;
+    char *_kwnames[] = { "title","text", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxSafeShowMessage",_kwnames,&_obj0,&_obj1)) 
+        return NULL;
+{
+    _arg0 = wxString_in_helper(_obj0);
+    if (_arg0 == NULL)
+        return NULL;
+}
+{
+    _arg1 = wxString_in_helper(_obj1);
+    if (_arg1 == NULL)
+        return NULL;
+}
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    wxSafeShowMessage(*_arg0,*_arg1);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+{
+    if (_obj0)
+        delete _arg0;
+}
+{
+    if (_obj1)
+        delete _arg1;
+}
+    return _resultobj;
+}
+
 static PyObject *_wrap_wxExecute(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     long  _result;
@@ -2494,6 +2534,43 @@ static PyObject *_wrap_wxSystemSettings_HasFeature(PyObject *self, PyObject *arg
     return _resultobj;
 }
 
+static PyObject *_wrap_wxSystemSettings_GetScreen(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxSystemScreen  _result;
+    char *_kwnames[] = {  NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxSystemSettings_GetScreen",_kwnames)) 
+        return NULL;
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (wxSystemScreen )wxSystemSettings::GetScreen();
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+static PyObject *_wrap_wxSystemSettings_SetScreen(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxSystemScreen  _arg0;
+    char *_kwnames[] = { "screen", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"i:wxSystemSettings_SetScreen",_kwnames,&_arg0)) 
+        return NULL;
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    wxSystemSettings::SetScreen(_arg0);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
 static void *SwigwxToolTipTowxObject(void *ptr) {
     wxToolTip *src;
     wxObject *dest;
@@ -10092,12 +10169,15 @@ static PyMethodDef misc2cMethods[] = {
         { "wxToolTip_GetTip", (PyCFunction) _wrap_wxToolTip_GetTip, METH_VARARGS | METH_KEYWORDS },
         { "wxToolTip_SetTip", (PyCFunction) _wrap_wxToolTip_SetTip, METH_VARARGS | METH_KEYWORDS },
         { "new_wxToolTip", (PyCFunction) _wrap_new_wxToolTip, METH_VARARGS | METH_KEYWORDS },
+        { "wxSystemSettings_SetScreen", (PyCFunction) _wrap_wxSystemSettings_SetScreen, METH_VARARGS | METH_KEYWORDS },
+        { "wxSystemSettings_GetScreen", (PyCFunction) _wrap_wxSystemSettings_GetScreen, METH_VARARGS | METH_KEYWORDS },
         { "wxSystemSettings_HasFeature", (PyCFunction) _wrap_wxSystemSettings_HasFeature, METH_VARARGS | METH_KEYWORDS },
         { "wxSystemSettings_GetMetric", (PyCFunction) _wrap_wxSystemSettings_GetMetric, METH_VARARGS | METH_KEYWORDS },
         { "wxSystemSettings_GetFont", (PyCFunction) _wrap_wxSystemSettings_GetFont, METH_VARARGS | METH_KEYWORDS },
         { "wxSystemSettings_GetColour", (PyCFunction) _wrap_wxSystemSettings_GetColour, METH_VARARGS | METH_KEYWORDS },
         { "wxWaveData", (PyCFunction) _wrap_wxWaveData, METH_VARARGS | METH_KEYWORDS },
         { "wxExecute", (PyCFunction) _wrap_wxExecute, METH_VARARGS | METH_KEYWORDS },
+        { "wxSafeShowMessage", (PyCFunction) _wrap_wxSafeShowMessage, METH_VARARGS | METH_KEYWORDS },
         { "wxLogSysError", (PyCFunction) _wrap_wxLogSysError, METH_VARARGS | METH_KEYWORDS },
         { "wxLogStatusFrame", (PyCFunction) _wrap_wxLogStatusFrame, METH_VARARGS | METH_KEYWORDS },
         { "wxLogStatus", (PyCFunction) _wrap_wxLogStatus, METH_VARARGS | METH_KEYWORDS },
index 9bb9b56c59af7a77bfc61b6bab939062646db54a..e13293f3862f0c4bcb90554fc0924f8c3fc698e5 100644 (file)
@@ -1109,6 +1109,8 @@ wxLogStatusFrame = misc2c.wxLogStatusFrame
 
 wxLogSysError = misc2c.wxLogSysError
 
+wxSafeShowMessage = misc2c.wxSafeShowMessage
+
 wxExecute = misc2c.wxExecute
 
 def wxWaveData(*_args, **_kwargs):
@@ -1130,6 +1132,10 @@ wxSystemSettings_GetMetric = misc2c.wxSystemSettings_GetMetric
 
 wxSystemSettings_HasFeature = misc2c.wxSystemSettings_HasFeature
 
+wxSystemSettings_GetScreen = misc2c.wxSystemSettings_GetScreen
+
+wxSystemSettings_SetScreen = misc2c.wxSystemSettings_SetScreen
+
 wxToolTip_Enable = misc2c.wxToolTip_Enable
 
 wxToolTip_SetDelay = misc2c.wxToolTip_SetDelay
index b6a5ed494500a0e9b6176732336707744fe80bfb..852d4640f5bc98eaa3696da30e90ea36c54213aa 100644 (file)
@@ -7883,8 +7883,9 @@ SWIGEXPORT(void) initutilsc() {
         PyDict_SetItemString(d,"wxCONFIG_USE_GLOBAL_FILE", PyInt_FromLong((long) wxCONFIG_USE_GLOBAL_FILE));
         PyDict_SetItemString(d,"wxCONFIG_USE_RELATIVE_PATH", PyInt_FromLong((long) wxCONFIG_USE_RELATIVE_PATH));
 
-    wxClassInfo::CleanUpClasses();
-    wxClassInfo::InitializeClasses();
+    // These are no longer needed since utils is back in the core
+//      wxClassInfo::CleanUpClasses();
+//      wxClassInfo::InitializeClasses();
         PyDict_SetItemString(d,"wxConfigBase_Type_Unknown", PyInt_FromLong((long) wxConfigBase::Type_Unknown));
         PyDict_SetItemString(d,"wxConfigBase_Type_String", PyInt_FromLong((long) wxConfigBase::Type_String));
         PyDict_SetItemString(d,"wxConfigBase_Type_Boolean", PyInt_FromLong((long) wxConfigBase::Type_Boolean));
index b374af6227eb66e50e95681f25b0098e650067d5..a7c52b50322db5d2e289692cb7ea1f490d0bc959 100644 (file)
@@ -6322,6 +6322,43 @@ static PyObject *_wrap_wxWindow_SetDefaultItem(PyObject *self, PyObject *args, P
     return _resultobj;
 }
 
+#define wxWindow_SetTmpDefaultItem(_swigobj,_swigarg0)  (_swigobj->SetTmpDefaultItem(_swigarg0))
+static PyObject *_wrap_wxWindow_SetTmpDefaultItem(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxWindow * _arg0;
+    wxWindow * _arg1;
+    PyObject * _argo0 = 0;
+    PyObject * _argo1 = 0;
+    char *_kwnames[] = { "self","win", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxWindow_SetTmpDefaultItem",_kwnames,&_argo0,&_argo1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_SetTmpDefaultItem. Expected _wxWindow_p.");
+        return NULL;
+        }
+    }
+    if (_argo1) {
+        if (_argo1 == Py_None) { _arg1 = NULL; }
+        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxWindow_SetTmpDefaultItem. Expected _wxWindow_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    wxWindow_SetTmpDefaultItem(_arg0,_arg1);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
 #define wxWindow_WarpPointer(_swigobj,_swigarg0,_swigarg1)  (_swigobj->WarpPointer(_swigarg0,_swigarg1))
 static PyObject *_wrap_wxWindow_WarpPointer(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
@@ -11719,6 +11756,7 @@ static PyMethodDef windowscMethods[] = {
         { "wxWindow_ReleaseMouse", (PyCFunction) _wrap_wxWindow_ReleaseMouse, METH_VARARGS | METH_KEYWORDS },
         { "wxWindow_CaptureMouse", (PyCFunction) _wrap_wxWindow_CaptureMouse, METH_VARARGS | METH_KEYWORDS },
         { "wxWindow_WarpPointer", (PyCFunction) _wrap_wxWindow_WarpPointer, METH_VARARGS | METH_KEYWORDS },
+        { "wxWindow_SetTmpDefaultItem", (PyCFunction) _wrap_wxWindow_SetTmpDefaultItem, METH_VARARGS | METH_KEYWORDS },
         { "wxWindow_SetDefaultItem", (PyCFunction) _wrap_wxWindow_SetDefaultItem, METH_VARARGS | METH_KEYWORDS },
         { "wxWindow_GetDefaultItem", (PyCFunction) _wrap_wxWindow_GetDefaultItem, METH_VARARGS | METH_KEYWORDS },
         { "wxWindow_OnPaint", (PyCFunction) _wrap_wxWindow_OnPaint, METH_VARARGS | METH_KEYWORDS },
index d3bba2d6d41f39369d59b9301c00a2e3f0333b90..74caad7e2bd6e5df76667921562b6ad7c01228ab 100644 (file)
@@ -616,6 +616,9 @@ class wxWindowPtr(wxEvtHandlerPtr):
     def SetDefaultItem(self, *_args, **_kwargs):
         val = apply(windowsc.wxWindow_SetDefaultItem,(self,) + _args, _kwargs)
         return val
+    def SetTmpDefaultItem(self, *_args, **_kwargs):
+        val = apply(windowsc.wxWindow_SetTmpDefaultItem,(self,) + _args, _kwargs)
+        return val
     def WarpPointer(self, *_args, **_kwargs):
         val = apply(windowsc.wxWindow_WarpPointer,(self,) + _args, _kwargs)
         return val
index bd34654764f007354a3c21f4be1dfaae373426fb..5b95846b6ef4be98942bdb490df8bf8a3d4c7dbd 100644 (file)
@@ -68,6 +68,7 @@ extern PyObject *SWIG_newvarlink(void);
 
     // Put some wx default wxChar* values into wxStrings.
     DECLARE_DEF_STRING(NOTEBOOK_NAME);
+    DECLARE_DEF_STRING(PanelNameStr);
 
     static const wxChar* wxSplitterNameStr = wxT("splitter");
     DECLARE_DEF_STRING(SplitterNameStr);
index 8c48ba0950145b81b6fc0019a2873f0331a2e989..f90583d8af8c53e55985dcb424b92d1da4d2921c 100644 (file)
@@ -1064,8 +1064,9 @@ wxLongLong wxGetLocalTimeMillis();
 //---------------------------------------------------------------------------
 
 %init %{
-    wxClassInfo::CleanUpClasses();
-    wxClassInfo::InitializeClasses();
+    // These are no longer needed since utils is back in the core
+//      wxClassInfo::CleanUpClasses();
+//      wxClassInfo::InitializeClasses();
 %}
 
 //---------------------------------------------------------------------------
index 484cfeb360a50cac525713bc059adfe9db2731d2..23986b87fee2a56f7b0457ed7f95eba27a92dc7d 100644 (file)
@@ -448,7 +448,7 @@ public:
 
     wxWindow* GetDefaultItem();
     wxWindow* SetDefaultItem(wxWindow *btn);
-
+    void SetTmpDefaultItem(wxWindow *win);
 
     // move the mouse to the specified position
     void WarpPointer(int x, int y);
index e838ba28a2cecc4842631d0fae4e252879f483b9..ba38a8a43a6eb469fa7b1889730d5d767e7718a8 100644 (file)
@@ -30,6 +30,7 @@
 %{
     // Put some wx default wxChar* values into wxStrings.
     DECLARE_DEF_STRING(NOTEBOOK_NAME);
+    DECLARE_DEF_STRING(PanelNameStr);
 
     static const wxChar* wxSplitterNameStr = wxT("splitter");
     DECLARE_DEF_STRING(SplitterNameStr);
@@ -298,4 +299,74 @@ public:
 };
 #endif
 
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+// wxPyWindow derives from wxWindow and adds support for overriding many of
+// the virtual methods in Python derived classes.
+
+// Do wxPyControl too.
+
+//  %{
+//  class wxPyWindow : public wxWindow
+//  {
+//      DECLARE_DYNAMIC_CLASS(wxPyWindow)
+//  public:
+//      wxPyWindow(wxWindow* parent, const wxWindowID id,
+//                 const wxPoint& pos = wxDefaultPosition,
+//                 const wxSize& size = wxDefaultSize,
+//                 long style = 0,
+//                 const wxString& name = wxPyPanelNameStr)
+//          : wxWindow(parent, id, pos, size, style, name) {}
+
+
+//      // Which of these should be done???
+//      DoSetSize
+//      DoGetSize
+//      DoSetClientSize
+//      DoGetClientSize
+//      DoGetPosition
+//      DoSetVirtualSize
+//      DoGetVirtualSize
+
+//      GetClientAreaOrigin
+//      Fit
+//      SetSizeHints
+//      SetVirtualSizeHints
+//      GetMaxSize
+//      Show
+//      Enable
+//      SetFocus
+//      SetFocusFromKbd
+//      AcceptsFocus
+//      AcceptsFocusFromKeyboard
+//      GetDefaultItem
+//      SetDefaultItem
+//      IsTopLevel
+//      AddChild
+//      RemoveChild
+//      Validate
+//      TransferDataToWindow
+//      TransferDataFromWindow
+//      InitDialog
+//      SetBackgroundColour
+//      SetForegroundColour
+//      GetCharHeight
+//      GetCharWidth
+//      DoClientToScreen
+//      DoScreenToClient
+//      DoHitTest
+//      DoPopupMenu
+//      DoSetToolTip
+//      DoCaptureMouse
+//      DoReleaseMouse
+//      DoMoveWindow
+
+
+//      PYPRIVATE;
+//  };
+
+
+//  %}
+
+
 //---------------------------------------------------------------------------