]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/contrib/gizmos/gizmos.i
non-PCH build fix (according to Tinderbox).
[wxWidgets.git] / wxPython / contrib / gizmos / gizmos.i
index b5348751cc2519463b2629ed2adc4595ee1ed12d..65ddbbc35a8d8c7f4323c19c84faff961cd202ce 100644 (file)
 // Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
 // Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
-%module gizmos
+%define DOCSTRING
+"Various *gizmo* classes: `DynamicSashWindow`, `EditableListBox`,
+`LEDNumberCtrl`, `TreeListCtrl`, etc."
+%enddef
+
+%module(package="wx", docstring=DOCSTRING) gizmos
 
 
 %{
 
 
 %{
-#include "wxPython.h"
+#include "wx/wxPython/wxPython.h"
+#include "wx/wxPython/pyclasses.h"
+
 #include <wx/gizmos/dynamicsash.h>
 #include <wx/gizmos/editlbox.h>
 #include <wx/gizmos/splittree.h>
 #include <wx/gizmos/ledctrl.h>
 #include <wx/gizmos/dynamicsash.h>
 #include <wx/gizmos/editlbox.h>
 #include <wx/gizmos/splittree.h>
 #include <wx/gizmos/ledctrl.h>
-%}
+#include <wx/gizmos/statpict.h>
 
 
-//---------------------------------------------------------------------------
+#include <wx/listctrl.h>
+#include <wx/treectrl.h>
+#include <wx/imaglist.h>
 
 
-%include typemaps.i
-%include my_typemaps.i
+%}
 
 
-%extern wx.i
-%extern windows.i
-%extern _defs.i
-%extern events.i
-%extern controls.i
+//---------------------------------------------------------------------------
 
 
+%import windows.i
+%import controls.i
+%pythoncode { import wx }
+%pythoncode { __docfilter__ = wx._core.__DocFilter(globals()) }
 
 
-//----------------------------------------------------------------------
 
 
-%{
-    // Put some wx default wxChar* values into wxStrings.
-    static const wxString wxPyDynamicSashNameStr(wxT("dynamicSashWindow"));
-    static const wxString wxPyEditableListBoxNameStr(wxT("editableListBox"));
-%}
+MAKE_CONST_WXSTRING2(DynamicSashNameStr,     wxT("dynamicSashWindow"));
+MAKE_CONST_WXSTRING2(EditableListBoxNameStr, wxT("editableListBox"));
+MAKE_CONST_WXSTRING(StaticPictureNameStr);                     
+    
+MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
 
 
-///----------------------------------------------------------------------
+//---------------------------------------------------------------------------
 
 enum {
 
 enum {
-    wxEVT_DYNAMIC_SASH_SPLIT,
-    wxEVT_DYNAMIC_SASH_UNIFY,
-
     wxDS_MANAGE_SCROLLBARS,
     wxDS_DRAG_CORNER,
 };
 
     wxDS_MANAGE_SCROLLBARS,
     wxDS_DRAG_CORNER,
 };
 
+%constant wxEventType wxEVT_DYNAMIC_SASH_SPLIT;
+%constant wxEventType wxEVT_DYNAMIC_SASH_UNIFY;
+
 
 /*
     wxDynamicSashSplitEvents are sent to your view by wxDynamicSashWindow
 
 /*
     wxDynamicSashSplitEvents are sent to your view by wxDynamicSashWindow
@@ -127,41 +134,37 @@ public:
 
 */
 
 
 */
 
+MustHaveApp(wxDynamicSashWindow);
+
 class wxDynamicSashWindow : public wxWindow {
 public:
 class wxDynamicSashWindow : public wxWindow {
 public:
-    wxDynamicSashWindow(wxWindow *parent, wxWindowID id,
+    %pythonAppend wxDynamicSashWindow         "self._setOORInfo(self)"
+    %pythonAppend wxDynamicSashWindow()       ""
+
+    wxDynamicSashWindow(wxWindow *parent, wxWindowID id=-1,
                         const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
                         long style = wxCLIP_CHILDREN | wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER,
                         const wxString& name = wxPyDynamicSashNameStr);
                         const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
                         long style = wxCLIP_CHILDREN | wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER,
                         const wxString& name = wxPyDynamicSashNameStr);
-    %name(wxPreDynamicSashWindow)wxDynamicSashWindow();
+    %RenameCtor(PreDynamicSashWindow, wxDynamicSashWindow());
 
 
-    bool Create(wxWindow *parent, wxWindowID id,
+    bool Create(wxWindow *parent, wxWindowID id=-1,
                 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
                 long style = wxCLIP_CHILDREN | wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER,
                 const wxString& name = wxPyDynamicSashNameStr);
 
                 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
                 long style = wxCLIP_CHILDREN | wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER,
                 const wxString& name = wxPyDynamicSashNameStr);
 
-    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
-    %pragma(python) addtomethod = "wxPreDynamicSashWindow:val._setOORInfo(val)"
-
     wxScrollBar *GetHScrollBar(const wxWindow *child) const;
     wxScrollBar *GetVScrollBar(const wxWindow *child) const;
 };
 
 
 
     wxScrollBar *GetHScrollBar(const wxWindow *child) const;
     wxScrollBar *GetVScrollBar(const wxWindow *child) const;
 };
 
 
 
-//----------------------------------------------------------------------
-// Python functions to act like the event macros
-
-%pragma(python) code = "
-def EVT_DYNAMIC_SASH_SPLIT(win, id, func):
-    win.Connect(id, -1, wxEVT_DYNAMIC_SASH_SPLIT, func)
+%pythoncode {
+EVT_DYNAMIC_SASH_SPLIT = wx.PyEventBinder( wxEVT_DYNAMIC_SASH_SPLIT, 1 )
+EVT_DYNAMIC_SASH_UNIFY = wx.PyEventBinder( wxEVT_DYNAMIC_SASH_UNIFY, 1 )
+}
 
 
-def EVT_DYNAMIC_SASH_UNIFY(win, id, func):
-    win.Connect(id, -1, wxEVT_DYNAMIC_SASH_UNIFY, func)
-"
-
-//----------------------------------------------------------------------
-//----------------------------------------------------------------------
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
 
 enum {
     wxEL_ALLOW_NEW,
 
 enum {
     wxEL_ALLOW_NEW,
@@ -171,33 +174,51 @@ enum {
 
 // This class provides a composite control that lets the
 // user easily enter list of strings
 
 // This class provides a composite control that lets the
 // user easily enter list of strings
+MustHaveApp(wxEditableListBox);
 class wxEditableListBox : public wxPanel
 {
 public:
 class wxEditableListBox : public wxPanel
 {
 public:
-    wxEditableListBox(wxWindow *parent, wxWindowID id,
-                      const wxString& label,
+    %pythonAppend wxEditableListBox         "self._setOORInfo(self)"
+    %pythonAppend wxEditableListBox()       ""
+
+    wxEditableListBox(wxWindow *parent, wxWindowID id=-1,
+                      const wxString& label = wxPyEmptyString,
                       const wxPoint& pos = wxDefaultPosition,
                       const wxSize& size = wxDefaultSize,
                       long style = wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE,
                       const wxString& name = wxPyEditableListBoxNameStr);
 
                       const wxPoint& pos = wxDefaultPosition,
                       const wxSize& size = wxDefaultSize,
                       long style = wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE,
                       const wxString& name = wxPyEditableListBoxNameStr);
 
-    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
     void SetStrings(const wxArrayString& strings);
 
     //void GetStrings(wxArrayString& strings);
 
     void SetStrings(const wxArrayString& strings);
 
     //void GetStrings(wxArrayString& strings);
-    %addmethods {
+    %extend {
         PyObject* GetStrings() {
             wxArrayString strings;
             self->GetStrings(strings);
             return wxArrayString2PyList_helper(strings);
         }
     }
         PyObject* GetStrings() {
             wxArrayString strings;
             self->GetStrings(strings);
             return wxArrayString2PyList_helper(strings);
         }
     }
+
+    wxPyListCtrl* GetListCtrl();
+    wxBitmapButton* GetDelButton();
+    wxBitmapButton* GetNewButton();
+    wxBitmapButton* GetUpButton();
+    wxBitmapButton* GetDownButton();
+    wxBitmapButton* GetEditButton();
+
+    %property(DelButton, GetDelButton, doc="See `GetDelButton`");
+    %property(DownButton, GetDownButton, doc="See `GetDownButton`");
+    %property(EditButton, GetEditButton, doc="See `GetEditButton`");
+    %property(ListCtrl, GetListCtrl, doc="See `GetListCtrl`");
+    %property(NewButton, GetNewButton, doc="See `GetNewButton`");
+    %property(Strings, GetStrings, SetStrings, doc="See `GetStrings` and `SetStrings`");
+    %property(UpButton, GetUpButton, doc="See `GetUpButton`");
 };
 
 
 
 };
 
 
 
-//----------------------------------------------------------------------
+//---------------------------------------------------------------------------
 
 
 /*
 
 
 /*
@@ -212,14 +233,18 @@ public:
     typedef wxTreeCtrl wxPyTreeCtrl;
 %}
 
     typedef wxTreeCtrl wxPyTreeCtrl;
 %}
 
+MustHaveApp(wxRemotelyScrolledTreeCtrl);
+
 class wxRemotelyScrolledTreeCtrl: public wxPyTreeCtrl
 {
 public:
 class wxRemotelyScrolledTreeCtrl: public wxPyTreeCtrl
 {
 public:
+    %pythonAppend wxRemotelyScrolledTreeCtrl         "self._setOORInfo(self)"
+    %pythonAppend wxRemotelyScrolledTreeCtrl()       ""
+
     wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id,
                                const wxPoint& pos = wxDefaultPosition,
                                const wxSize& size = wxDefaultSize,
                                long style = wxTR_HAS_BUTTONS);
     wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id,
                                const wxPoint& pos = wxDefaultPosition,
                                const wxSize& size = wxDefaultSize,
                                long style = wxTR_HAS_BUTTONS);
-    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 
     void HideVScrollbar();
 
 
     void HideVScrollbar();
@@ -238,6 +263,9 @@ public:
     // events happen such as node expansion
     void SetCompanionWindow(wxWindow* companion);
     wxWindow* GetCompanionWindow() const;
     // events happen such as node expansion
     void SetCompanionWindow(wxWindow* companion);
     wxWindow* GetCompanionWindow() const;
+
+    %property(CompanionWindow, GetCompanionWindow, SetCompanionWindow, doc="See `GetCompanionWindow` and `SetCompanionWindow`");
+    %property(ScrolledWindow, GetScrolledWindow, doc="See `GetScrolledWindow`");
 };
 
 
 };
 
 
@@ -261,17 +289,17 @@ public:
 
     virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect) {
         bool found;
 
     virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect) {
         bool found;
-        wxPyBeginBlockThreads();
+        wxPyBlock_t blocked = wxPyBeginBlockThreads();
         if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) {
         if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) {
-            PyObject* dcobj = wxPyMake_wxObject(&dc);
-            PyObject* idobj = wxPyConstructObject((void*)&id, "wxTreeItemId", FALSE);
-            PyObject* recobj= wxPyConstructObject((void*)&rect, "wxRect", FALSE);
+            PyObject* dcobj = wxPyMake_wxObject(&dc,false);
+            PyObject* idobj = wxPyConstructObject((void*)&id, wxT("wxTreeItemId"), false);
+            PyObject* recobj= wxPyConstructObject((void*)&rect, wxT("wxRect"), false);
             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", dcobj, idobj, recobj));
             Py_DECREF(dcobj);
             Py_DECREF(idobj);
             Py_DECREF(recobj);
         }
             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", dcobj, idobj, recobj));
             Py_DECREF(dcobj);
             Py_DECREF(idobj);
             Py_DECREF(recobj);
         }
-        wxPyEndBlockThreads();
+        wxPyEndBlockThreads(blocked);
         if (! found)
             wxTreeCompanionWindow::DrawItem(dc, id, rect);
     }
         if (! found)
             wxTreeCompanionWindow::DrawItem(dc, id, rect);
     }
@@ -281,19 +309,25 @@ public:
 %}
 
 
 %}
 
 
-%name(wxTreeCompanionWindow) class wxPyTreeCompanionWindow: public wxWindow
+MustHaveApp(wxPyTreeCompanionWindow);
+
+%rename(TreeCompanionWindow) wxPyTreeCompanionWindow;
+class wxPyTreeCompanionWindow: public wxWindow
 {
 public:
 {
 public:
+    %pythonAppend wxPyTreeCompanionWindow         "self._setOORInfo(self);self._setCallbackInfo(self, TreeCompanionWindow)"
+    %pythonAppend wxPyTreeCompanionWindow()       ""
+
     wxPyTreeCompanionWindow(wxWindow* parent, wxWindowID id = -1,
                             const wxPoint& pos = wxDefaultPosition,
                             const wxSize& size = wxDefaultSize,
                             long style = 0);
     void _setCallbackInfo(PyObject* self, PyObject* _class);
     wxPyTreeCompanionWindow(wxWindow* parent, wxWindowID id = -1,
                             const wxPoint& pos = wxDefaultPosition,
                             const wxSize& size = wxDefaultSize,
                             long style = 0);
     void _setCallbackInfo(PyObject* self, PyObject* _class);
-    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxTreeCompanionWindow)"
-    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
     wxRemotelyScrolledTreeCtrl* GetTreeCtrl() const;
     void SetTreeCtrl(wxRemotelyScrolledTreeCtrl* treeCtrl);
 
     wxRemotelyScrolledTreeCtrl* GetTreeCtrl() const;
     void SetTreeCtrl(wxRemotelyScrolledTreeCtrl* treeCtrl);
+
+    %property(TreeCtrl, GetTreeCtrl, SetTreeCtrl, doc="See `GetTreeCtrl` and `SetTreeCtrl`");
 };
 
 
 };
 
 
@@ -305,18 +339,22 @@ public:
  * than the usual one.
  */
 
  * than the usual one.
  */
 
+MustHaveApp(wxThinSplitterWindow);
+
 class wxThinSplitterWindow: public wxSplitterWindow
 {
 public:
 class wxThinSplitterWindow: public wxSplitterWindow
 {
 public:
+    %pythonAppend wxThinSplitterWindow         "self._setOORInfo(self)"
+    %pythonAppend wxThinSplitterWindow()       ""
+
     wxThinSplitterWindow(wxWindow* parent, wxWindowID id = -1,
                          const wxPoint& pos = wxDefaultPosition,
                          const wxSize& size = wxDefaultSize,
                          long style = wxSP_3D | wxCLIP_CHILDREN);
     wxThinSplitterWindow(wxWindow* parent, wxWindowID id = -1,
                          const wxPoint& pos = wxDefaultPosition,
                          const wxSize& size = wxDefaultSize,
                          long style = wxSP_3D | wxCLIP_CHILDREN);
-    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
-
 };
 
 
 };
 
 
+
 /*
  * wxSplitterScrolledWindow
  *
 /*
  * wxSplitterScrolledWindow
  *
@@ -326,19 +364,23 @@ public:
  * scroll appropriately.
  */
 
  * scroll appropriately.
  */
 
+MustHaveApp(wxSplitterScrolledWindow);
+
 class wxSplitterScrolledWindow: public wxScrolledWindow
 {
 public:
 class wxSplitterScrolledWindow: public wxScrolledWindow
 {
 public:
+    %pythonAppend wxSplitterScrolledWindow         "self._setOORInfo(self)"
+    %pythonAppend wxSplitterScrolledWindow()       ""
+
     wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id = -1,
                              const wxPoint& pos = wxDefaultPosition,
                              const wxSize& size = wxDefaultSize,
                              long style = 0);
     wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id = -1,
                              const wxPoint& pos = wxDefaultPosition,
                              const wxSize& size = wxDefaultSize,
                              long style = 0);
-    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 };
 
 
 };
 
 
-//----------------------------------------------------------------------
-//----------------------------------------------------------------------
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
 
 
 enum wxLEDValueAlign
 
 
 enum wxLEDValueAlign
@@ -353,54 +395,106 @@ enum wxLEDValueAlign
 };
 
 
 };
 
 
+MustHaveApp(wxLEDNumberCtrl);
+
 class wxLEDNumberCtrl :        public wxControl
 {
 public:
 class wxLEDNumberCtrl :        public wxControl
 {
 public:
-    // Constructors.
+    %pythonAppend wxLEDNumberCtrl         "self._setOORInfo(self)"
+    %pythonAppend wxLEDNumberCtrl()       ""
+
     wxLEDNumberCtrl(wxWindow *parent, wxWindowID id = -1,
                     const wxPoint& pos = wxDefaultPosition,
                     const wxSize& size = wxDefaultSize,
                     long style =  wxLED_ALIGN_LEFT | wxLED_DRAW_FADED);
     wxLEDNumberCtrl(wxWindow *parent, wxWindowID id = -1,
                     const wxPoint& pos = wxDefaultPosition,
                     const wxSize& size = wxDefaultSize,
                     long style =  wxLED_ALIGN_LEFT | wxLED_DRAW_FADED);
-    %name(wxPreLEDNumberCtrl) wxLEDNumberCtrl();
+    %RenameCtor(PreLEDNumberCtrl,  wxLEDNumberCtrl());
 
 
-    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
-    %pragma(python) addtomethod = "wxPreLEDNumberCtrl:val._setOORInfo(val)"
-
-    // Create functions.
     bool Create(wxWindow *parent, wxWindowID id = -1,
                     const wxPoint& pos = wxDefaultPosition,
                     const wxSize& size = wxDefaultSize,
                     long style = wxLED_ALIGN_LEFT | wxLED_DRAW_FADED);
 
     bool Create(wxWindow *parent, wxWindowID id = -1,
                     const wxPoint& pos = wxDefaultPosition,
                     const wxSize& size = wxDefaultSize,
                     long style = wxLED_ALIGN_LEFT | wxLED_DRAW_FADED);
 
-    wxLEDValueAlign GetAlignment() const { return m_Alignment; }
-    bool GetDrawFaded() const { return m_DrawFaded; }
-    const wxString &GetValue() const { return m_Value; }
+    wxLEDValueAlign GetAlignment() const;
+    bool GetDrawFaded() const;
+    const wxString &GetValue() const;
 
     void SetAlignment(wxLEDValueAlign Alignment, bool Redraw = true);
     void SetDrawFaded(bool DrawFaded, bool Redraw = true);
     void SetValue(const wxString &Value, bool Redraw = true);
 
 
     void SetAlignment(wxLEDValueAlign Alignment, bool Redraw = true);
     void SetDrawFaded(bool DrawFaded, bool Redraw = true);
     void SetValue(const wxString &Value, bool Redraw = true);
 
+    %property(Alignment, GetAlignment, SetAlignment, doc="See `GetAlignment` and `SetAlignment`");
+    %property(DrawFaded, GetDrawFaded, SetDrawFaded, doc="See `GetDrawFaded` and `SetDrawFaded`");
+    %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`");
 };
 
 };
 
-//----------------------------------------------------------------------
-//----------------------------------------------------------------------
 
 
-%init %{
 
 
-    wxClassInfo::CleanUpClasses();
-    wxClassInfo::InitializeClasses();
+//----------------------------------------------------------------------
 
 
-    wxPyPtrTypeMap_Add("wxTreeCompanionWindow", "wxPyTreeCompanionWindow");
-%}
+%include _treelist.i
 
 
+//----------------------------------------------------------------------
 
 
-%pragma(python) include="_gizmoextras.py";
+enum
+{
+    wxSCALE_HORIZONTAL,
+    wxSCALE_VERTICAL,
+    wxSCALE_UNIFORM,
+    wxSCALE_CUSTOM    
+};
 
 
-//----------------------------------------------------------------------
-//----------------------------------------------------------------------
+MustHaveApp(wxStaticPicture);
 
 
+class wxStaticPicture : public wxControl
+{
+public:
+    %pythonAppend wxStaticPicture         "self._setOORInfo(self)"
+    %pythonAppend wxStaticPicture()       ""
+
+    wxStaticPicture( wxWindow* parent, wxWindowID id=-1,
+                     const wxBitmap& label=wxNullBitmap,
+                     const wxPoint& pos = wxDefaultPosition,
+                     const wxSize& size = wxDefaultSize,
+                     long style = 0,
+                     const wxString& name = wxPyStaticPictureNameStr );
+
+    %RenameCtor(PreStaticPicture, wxStaticPicture());
+
+    bool Create( wxWindow* parent, wxWindowID id=-1,
+                 const wxBitmap& label=wxNullBitmap,
+                 const wxPoint& pos = wxDefaultPosition,
+                 const wxSize& size = wxDefaultSize,
+                 long style = 0,
+                 const wxString& name = wxPyStaticPictureNameStr );
+
+    void SetBitmap( const wxBitmap& bmp );
+    wxBitmap GetBitmap() const;
+    void SetIcon( const wxIcon& icon );
+    wxIcon GetIcon() const;
+
+    void SetAlignment( int align );
+    int GetAlignment() const;
+
+    void SetScale( int scale );
+    int GetScale() const; 
+
+    void SetCustomScale( float sx, float sy );
+    void GetCustomScale( float* OUTPUT, float* OUTPUT ) const;
+
+    %property(Alignment, GetAlignment, SetAlignment, doc="See `GetAlignment` and `SetAlignment`");
+    %property(Bitmap, GetBitmap, SetBitmap, doc="See `GetBitmap` and `SetBitmap`");
+    %property(Icon, GetIcon, SetIcon, doc="See `GetIcon` and `SetIcon`");
+    %property(Scale, GetScale, SetScale, doc="See `GetScale` and `SetScale`");
+};
 
 
 
 
+//----------------------------------------------------------------------
+//----------------------------------------------------------------------
 
 
+%init %{
+    wxPyPtrTypeMap_Add("wxTreeCompanionWindow", "wxPyTreeCompanionWindow");
+%}
 
 
+//----------------------------------------------------------------------
+//----------------------------------------------------------------------