X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3ca6a5f04692678cd2d9f3ea0843fc3f5a0b254f..1af9e5c56dedf2ecd79d4f9186f6a8edb5c72448:/wxPython/src/windows.i?ds=sidebyside diff --git a/wxPython/src/windows.i b/wxPython/src/windows.i index 6e95e8e5ab..febdff9118 100644 --- a/wxPython/src/windows.i +++ b/wxPython/src/windows.i @@ -31,10 +31,17 @@ %pragma(python) code = "import wx" + +%{ + static wxString wxPyEmptyStr(""); +%} + //--------------------------------------------------------------------------- class wxEvtHandler { public: + wxEvtHandler(); + bool ProcessEvent(wxEvent& event); void AddPendingEvent(wxEvent& event); //bool SearchEventTable(wxEventTable& table, wxEvent& event); @@ -105,13 +112,13 @@ public: wxWindow* GetWindow(); void SetWindow(wxWindow* window); - // Properties list - %pragma(python) addtoclass = " - _prop_list_ = { - 'window' : ('GetWindow', 'SetWindow'), - } - _prop_list_.update(wxEvtHandler._prop_list_) - " +// // Properties list +// %pragma(python) addtoclass = " +// _prop_list_ = { +// 'window' : ('GetWindow', 'SetWindow'), +// } +// _prop_list_.update(wxEvtHandler._prop_list_) +// " }; %inline %{ @@ -195,8 +202,8 @@ class wxWindow : public wxEvtHandler { public: wxWindow(wxWindow* parent, const wxWindowID id, - const wxPoint& pos = wxPyDefaultPosition, - const wxSize& size = wxPyDefaultSize, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, char* name = "panel"); @@ -329,6 +336,10 @@ public: void SetPosition(const wxPoint& pos) { self->Move(pos); } + + void SetRect(const wxRect& rect, int sizeFlags=wxSIZE_AUTO) { + self->SetSize(rect, sizeFlags); + } } void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1); @@ -337,6 +348,7 @@ public: //void SetPalette(wxPalette* palette); void SetCursor(const wxCursor&cursor); void SetEventHandler(wxEvtHandler* handler); + void SetExtraStyle(long exStyle); void SetTitle(const wxString& title); bool Show(bool show); bool TransferDataFromWindow(); @@ -371,50 +383,61 @@ public: void SetCaret(wxCaret *caret); wxCaret *GetCaret(); - %pragma(python) addtoclass = "# replaces broken shadow method + %pragma(python) addtoclass = "# replaces broken shadow methods def GetCaret(self, *_args, **_kwargs): from misc2 import wxCaretPtr val = apply(windowsc.wxWindow_GetCaret,(self,) + _args, _kwargs) if val: val = wxCaretPtr(val) return val - " - - // Properties list - %pragma(python) addtoclass = " - _prop_list_ = { - 'size' : ('GetSize', 'SetSize'), - 'enabled' : ('IsEnabled', 'Enable'), - 'background' : ('GetBackgroundColour', 'SetBackgroundColour'), - 'foreground' : ('GetForegroundColour', 'SetForegroundColour'), - 'children' : ('GetChildren', None), - 'charHeight' : ('GetCharHeight', None), - 'charWidth' : ('GetCharWidth', None), - 'clientSize' : ('GetClientSize', 'SetClientSize'), - 'font' : ('GetFont', 'SetFont'), - 'grandParent' : ('GetGrandParent', None), - 'handle' : ('GetHandle', None), - 'label' : ('GetLabel', 'SetLabel'), - 'name' : ('GetName', 'SetName'), - 'parent' : ('GetParent', None), - 'position' : ('GetPosition', 'SetPosition'), - 'title' : ('GetTitle', 'SetTitle'), - 'style' : ('GetWindowStyleFlag', 'SetWindowStyleFlag'), - 'visible' : ('IsShown', 'Show'), - 'toolTip' : ('GetToolTip', 'SetToolTip'), - 'sizer' : ('GetSizer', 'SetSizer'), - 'validator' : ('GetValidator', 'SetValidator'), - 'dropTarget' : ('GetDropTarget', 'SetDropTarget'), - 'caret' : ('GetCaret', 'SetCaret'), - 'autoLayout' : ('GetAutoLayout', 'SetAutoLayout'), - 'constraints' : ('GetConstraints', 'SetConstraints'), + def GetSizer(self, *_args, **_kwargs): + from sizers import wxSizerPtr + val = apply(windowsc.wxWindow_GetSizer,(self,) + _args, _kwargs) + if val: val = wxSizerPtr(val) + return val - } - _prop_list_.update(wxEvtHandler._prop_list_) + def GetToolTip(self, *_args, **_kwargs): + from misc2 import wxToolTipPtr + val = apply(windowsc.wxWindow_GetToolTip,(self,) + _args, _kwargs) + if val: val = wxToolTipPtr(val) + return val " + + +// // Properties list +// %pragma(python) addtoclass = " +// _prop_list_ = { +// 'size' : ('GetSize', 'SetSize'), +// 'enabled' : ('IsEnabled', 'Enable'), +// 'background' : ('GetBackgroundColour', 'SetBackgroundColour'), +// 'foreground' : ('GetForegroundColour', 'SetForegroundColour'), +// 'children' : ('GetChildren', None), +// 'charHeight' : ('GetCharHeight', None), +// 'charWidth' : ('GetCharWidth', None), +// 'clientSize' : ('GetClientSize', 'SetClientSize'), +// 'font' : ('GetFont', 'SetFont'), +// 'grandParent' : ('GetGrandParent', None), +// 'handle' : ('GetHandle', None), +// 'label' : ('GetLabel', 'SetLabel'), +// 'name' : ('GetName', 'SetName'), +// 'parent' : ('GetParent', None), +// 'position' : ('GetPosition', 'SetPosition'), +// 'title' : ('GetTitle', 'SetTitle'), +// 'style' : ('GetWindowStyleFlag', 'SetWindowStyleFlag'), +// 'visible' : ('IsShown', 'Show'), +// 'toolTip' : ('GetToolTip', 'SetToolTip'), +// 'sizer' : ('GetSizer', 'SetSizer'), +// 'validator' : ('GetValidator', 'SetValidator'), +// 'dropTarget' : ('GetDropTarget', 'SetDropTarget'), +// 'caret' : ('GetCaret', 'SetCaret'), +// 'autoLayout' : ('GetAutoLayout', 'SetAutoLayout'), +// 'constraints' : ('GetConstraints', 'SetConstraints'), + +// } +// _prop_list_.update(wxEvtHandler._prop_list_) +// " }; -//%clear int* x, int* y; @@ -432,7 +455,6 @@ def wxDLG_SZE(win, size_width, height=None): return win.ConvertDialogSizeToPixels(wxSize(size_width, height)) " -#ifdef __WXMSW__ %inline %{ wxWindow* wxWindow_FindFocus() { return wxWindow::FindFocus(); @@ -440,6 +462,7 @@ def wxDLG_SZE(win, size_width, height=None): %} +#ifdef __WXMSW__ %inline %{ wxWindow* wxWindow_FromHWND(unsigned long hWnd) { wxWindow* win = new wxWindow; @@ -469,8 +492,8 @@ class wxPanel : public wxWindow { public: wxPanel(wxWindow* parent, const wxWindowID id, - const wxPoint& pos = wxPyDefaultPosition, - const wxSize& size = wxPyDefaultSize, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const char* name = "panel"); @@ -497,8 +520,8 @@ public: wxDialog(wxWindow* parent, const wxWindowID id, const wxString& title, - const wxPoint& pos = wxPyDefaultPosition, - const wxSize& size = wxPyDefaultSize, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE, const char* name = "dialogBox"); @@ -517,6 +540,24 @@ public: int GetReturnCode(); void SetReturnCode(int retCode); + + wxSizer* CreateTextSizer( const wxString &message ); + wxSizer* CreateButtonSizer( long flags ); + + %pragma(python) addtoclass = " + # replace swig generated shadow methods to resolve import issues + def CreateTextSizer(self, *_args, **_kwargs): + import sizers + val = apply(windowsc.wxDialog_CreateTextSizer,(self,) + _args, _kwargs) + if val: val = sizers.wxSizerPtr(val) + return val + def CreateButtonSizer(self, *_args, **_kwargs): + import sizers + val = apply(windowsc.wxDialog_CreateButtonSizer,(self,) + _args, _kwargs) + if val: val = sizers.wxSizerPtr(val) + return val +" + }; //--------------------------------------------------------------------------- @@ -525,8 +566,8 @@ class wxScrolledWindow : public wxPanel { public: wxScrolledWindow(wxWindow* parent, const wxWindowID id = -1, - const wxPoint& pos = wxPyDefaultPosition, - const wxSize& size = wxPyDefaultSize, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxHSCROLL | wxVSCROLL, char* name = "scrolledWindow"); @@ -563,7 +604,7 @@ public: void Append(int id, const wxString& item, const wxString& helpString = wxPyEmptyStr, - int checkable = FALSE); + bool checkable = FALSE); %name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu, const wxString& helpString = wxPyEmptyStr); %name(AppendItem)void Append(const wxMenuItem* item); @@ -628,7 +669,7 @@ public: class wxMenuBar : public wxWindow { public: - wxMenuBar(); + wxMenuBar(long style = 0); bool Append(wxMenu *menu, const wxString& title); bool Insert(size_t pos, wxMenu *menu, const wxString& title); @@ -687,6 +728,30 @@ public: wxAcceleratorEntry *GetAccel(); void SetAccel(wxAcceleratorEntry *accel); + static wxString GetLabelFromText(const wxString& text); + + // wxOwnerDrawn methods +#ifdef __WXMSW__ + void SetFont(const wxFont& font); + wxFont& GetFont(); + void SetTextColour(const wxColour& colText); + wxColour& GetTextColour(); + void SetBackgroundColour(const wxColour& colBack); + wxColour& GetBackgroundColour(); + void SetBitmaps(const wxBitmap& bmpChecked, + const wxBitmap& bmpUnchecked = wxNullBitmap); + void SetBitmap(const wxBitmap& bmpChecked); + const wxBitmap& GetBitmap(bool bChecked = TRUE); + void SetMarginWidth(int nWidth); + int GetMarginWidth(); + static int GetDefaultMarginWidth(); + //void SetName(const wxString& strName); + //const wxString& GetName(); + //void SetCheckable(bool checkable); + //bool IsCheckable(); + bool IsOwnerDrawn(); + void ResetOwnerDrawn(); +#endif }; //---------------------------------------------------------------------------