diff --git a/wxPython/src/_accel.i b/wxPython/src/_accel.i index 5f0bee9ed2..0cf237d152 100644 --- a/wxPython/src/_accel.i +++ b/wxPython/src/_accel.i @@ -154,7 +154,8 @@ items or or of 3-tuples (flags, keyCode, cmdID) wxAcceleratorTable(int n, const wxAcceleratorEntry* entries); ~wxAcceleratorTable(); - bool Ok() const; + bool IsOk() const; + %pythoncode { Ok = IsOk } }; diff --git a/wxPython/src/_bitmap.i b/wxPython/src/_bitmap.i index f4b5ba82b8..de6246f16f 100644 --- a/wxPython/src/_bitmap.i +++ b/wxPython/src/_bitmap.i @@ -178,8 +178,9 @@ bit depths, the behaviour is platform dependent.", "", } #endif - bool Ok(); - + bool IsOk(); + %pythoncode { Ok = IsOk } + DocDeclStr( int , GetWidth(), "Gets the width of the bitmap in pixels.", ""); @@ -306,7 +307,7 @@ the ``type`` parameter.", ""); #endif #endif - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { def __nonzero__(self): return self.IsOk() } %extend { bool __eq__(const wxBitmap* other) { return other ? (*self == *other) : false; } @@ -745,7 +746,7 @@ passed then BLACK is used. %extend { wxMask(const wxBitmap& bitmap, const wxColour& colour = wxNullColour) { - if ( !colour.Ok() ) + if ( !colour.IsOk() ) return new wxMask(bitmap, *wxBLACK); else return new wxMask(bitmap, colour); diff --git a/wxPython/src/_brush.i b/wxPython/src/_brush.i index 621faac4a0..e990a3b94c 100644 --- a/wxPython/src/_brush.i +++ b/wxPython/src/_brush.i @@ -102,8 +102,9 @@ uninitialised bitmap (`wx.Bitmap.Ok` returns False).", ""); DocDeclStr( - bool , Ok(), + bool , IsOk(), "Returns True if the brush is initialised and valid.", ""); + %pythoncode { Ok = IsOk } #ifdef __WXMAC__ @@ -111,7 +112,7 @@ uninitialised bitmap (`wx.Bitmap.Ok` returns False).", ""); void MacSetTheme(short macThemeBrush); #endif - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { def __nonzero__(self): return self.IsOk() } %property(Colour, GetColour, SetColour, doc="See `GetColour` and `SetColour`"); %property(Stipple, GetStipple, SetStipple, doc="See `GetStipple` and `SetStipple`"); diff --git a/wxPython/src/_colour.i b/wxPython/src/_colour.i index 7d7b80b6d5..23ddd08c3c 100644 --- a/wxPython/src/_colour.i +++ b/wxPython/src/_colour.i @@ -95,9 +95,10 @@ public: "Returns the Alpha value.", ""); DocDeclStr( - bool , Ok(), + bool , IsOk(), "Returns True if the colour object is valid (the colour has been initialised with RGB values).", ""); + %pythoncode { Ok = IsOk } DocDeclStr( void , Set(byte red, byte green, byte blue, byte alpha=wxALPHA_OPAQUE), @@ -172,7 +173,7 @@ is returned if the pixel is invalid (on X, unallocated).", ""); int green = -1; int blue = -1; int alpha = wxALPHA_OPAQUE; - if (self->Ok()) { + if (self->IsOk()) { red = self->Red(); green = self->Green(); blue = self->Blue(); @@ -199,7 +200,9 @@ is returned if the pixel is invalid (on X, unallocated).", ""); asTuple = wx._deprecated(Get, "asTuple is deprecated, use `Get` instead") def __str__(self): return str(self.Get(True)) def __repr__(self): return 'wx.Colour' + str(self.Get(True)) - def __nonzero__(self): return self.Ok() + def __len__(self): return len(self.Get()) + def __getitem__(self, index): return self.Get()[index] + def __nonzero__(self): return self.IsOk() __safe_for_unpickling__ = True def __reduce__(self): return (Colour, self.Get(True)) } diff --git a/wxPython/src/_cursor.i b/wxPython/src/_cursor.i index bb51a4dd83..02e8a7f1cc 100644 --- a/wxPython/src/_cursor.i +++ b/wxPython/src/_cursor.i @@ -140,10 +140,11 @@ On MacOS the cursor is resized to 16x16 if it was larger.", #endif DocDeclStr( - bool , Ok(), + bool , IsOk(), "", ""); + %pythoncode { Ok = IsOk } - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { def __nonzero__(self): return self.IsOk() } #ifdef __WXMSW__ diff --git a/wxPython/src/_datetime.i b/wxPython/src/_datetime.i index 41786ff186..a14241a6c6 100644 --- a/wxPython/src/_datetime.i +++ b/wxPython/src/_datetime.i @@ -617,8 +617,10 @@ public: // is the date valid (True even for non initialized objects)? inline bool IsValid() const; - %pythoncode { Ok = IsValid } - %pythoncode { def __nonzero__(self): return self.Ok() }; + %pythoncode { IsOk = IsValid } + %pythoncode { Ok = IsOk } + + %pythoncode { def __nonzero__(self): return self.IsOk() }; // get the number of seconds since the Unix epoch - returns (time_t)-1 diff --git a/wxPython/src/_dc.i b/wxPython/src/_dc.i index 75e80deaaa..ab5bceb09d 100644 --- a/wxPython/src/_dc.i +++ b/wxPython/src/_dc.i @@ -707,8 +707,9 @@ converting a height, for example.", ""); DocDeclStr( - virtual bool , Ok() const, + virtual bool , IsOk() const, "Returns true if the DC is ok to use.", ""); + %pythoncode { Ok = IsOk } @@ -971,7 +972,7 @@ box doesn't contain anything.", ""); // See below for implementation } - %pythoncode { def __nonzero__(self): return self.Ok() }; + %pythoncode { def __nonzero__(self): return self.IsOk() }; #ifdef __WXMSW__ @@ -1588,7 +1589,8 @@ public: wxMetaFile(const wxString& filename = wxPyEmptyString); ~wxMetaFile(); - bool Ok(); + bool IsOk(); + %pythoncode { Ok = IsOk } bool SetClipboard(int width = 0, int height = 0); wxSize GetSize(); @@ -1599,7 +1601,7 @@ public: const wxString& GetFileName() const; #endif - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { def __nonzero__(self): return self.IsOk() } }; // bool wxMakeMetaFilePlaceable(const wxString& filename, diff --git a/wxPython/src/_font.i b/wxPython/src/_font.i index 82a49c1355..dcfe53b952 100644 --- a/wxPython/src/_font.i +++ b/wxPython/src/_font.i @@ -656,9 +656,10 @@ the closest size is found using a binary search. // was the font successfully created? DocDeclStr( - bool , Ok() const, + bool , IsOk() const, "Returns ``True`` if this font was successfully created.", ""); - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { Ok = IsOk } + %pythoncode { def __nonzero__(self): return self.IsOk() } // comparison diff --git a/wxPython/src/_icon.i b/wxPython/src/_icon.i index 2f91e9371b..0e3ff73d7a 100644 --- a/wxPython/src/_icon.i +++ b/wxPython/src/_icon.i @@ -65,7 +65,8 @@ public: void SetHandle(long handle) { self->SetHandle((WXHANDLE)handle); } } #endif - bool Ok(); + bool IsOk(); + %pythoncode { Ok = IsOk } int GetWidth(); int GetHeight(); int GetDepth(); @@ -77,7 +78,7 @@ public: #endif void CopyFromBitmap(const wxBitmap& bmp); - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { def __nonzero__(self): return self.IsOk() } %property(Depth, GetDepth, SetDepth, doc="See `GetDepth` and `SetDepth`"); %property(Height, GetHeight, SetHeight, doc="See `GetHeight` and `SetHeight`"); @@ -106,7 +107,7 @@ public: // returns True if this object is valid/initialized bool IsOk() const; - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { def __nonzero__(self): return self.IsOk() } // set/get the icon file name void SetFileName(const wxString& filename); diff --git a/wxPython/src/_image.i b/wxPython/src/_image.i index 0c28784711..04650a8d31 100644 --- a/wxPython/src/_image.i +++ b/wxPython/src/_image.i @@ -668,8 +668,9 @@ object, using a MIME type string to specify the image file format.", "", DocDeclStr( - bool , Ok(), + bool , IsOk(), "Returns true if image data is present.", ""); + %pythoncode { Ok = IsOk } DocDeclStr( int , GetWidth(), @@ -1035,7 +1036,7 @@ range -1.0..1.0 where -1.0 is -360 degrees and 1.0 is 360 degrees", ""); "Converts a color in HSV color space to RGB color space.", ""); - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { def __nonzero__(self): return self.IsOk() } %property(AlphaBuffer, GetAlphaBuffer, SetAlphaBuffer, doc="See `GetAlphaBuffer` and `SetAlphaBuffer`"); %property(AlphaData, GetAlphaData, SetAlphaData, doc="See `GetAlphaData` and `SetAlphaData`"); diff --git a/wxPython/src/_notebook.i b/wxPython/src/_notebook.i index baff81bb3e..703c7718c6 100644 --- a/wxPython/src/_notebook.i +++ b/wxPython/src/_notebook.i @@ -154,6 +154,9 @@ public: // NB: this function will _not_ generate PAGE_CHANGING/ED events virtual int SetSelection(size_t n)/* = 0*/; + + // acts as SetSelection but does not generate events + virtual int ChangeSelection(size_t n)/* = 0*/; // cycle thru the pages void AdvanceSelection(bool forward = true); @@ -273,6 +276,13 @@ public: static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + // returns false if the change to nPage is vetoed by the program + bool SendPageChangingEvent(int nPage); + + // sends the event about page change from old to new (or GetSelection() if + // new is -1) + void SendPageChangedEvent(int nPageOld, int nPageNew = -1); + %property(RowCount, GetRowCount, doc="See `GetRowCount`"); %property(ThemeBackgroundColour, GetThemeBackgroundColour, doc="See `GetThemeBackgroundColour`"); }; diff --git a/wxPython/src/_palette.i b/wxPython/src/_palette.i index ca1c1c28e7..3070508c9e 100644 --- a/wxPython/src/_palette.i +++ b/wxPython/src/_palette.i @@ -33,9 +33,10 @@ public: "GetRGB(self, int pixel) -> (R,G,B)"); int GetColoursCount() const; - bool Ok(); + bool IsOk(); + %pythoncode { Ok = IsOk } - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { def __nonzero__(self): return self.IsOk() } %property(ColoursCount, GetColoursCount, doc="See `GetColoursCount`"); }; diff --git a/wxPython/src/_pen.i b/wxPython/src/_pen.i index 40a09b39e5..577c0a936e 100644 --- a/wxPython/src/_pen.i +++ b/wxPython/src/_pen.i @@ -42,7 +42,8 @@ public: int GetStyle(); int GetWidth(); - bool Ok(); + bool IsOk(); + %pythoncode { Ok = IsOk } void SetCap(int cap_style); void SetColour(wxColour& colour); @@ -112,7 +113,7 @@ public: bool __eq__(const wxPen* other) { return other ? (*self == *other) : false; } bool __ne__(const wxPen* other) { return other ? (*self != *other) : true; } } - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { def __nonzero__(self): return self.IsOk() } %property(Cap, GetCap, SetCap, doc="See `GetCap` and `SetCap`"); %property(Colour, GetColour, SetColour, doc="See `GetColour` and `SetColour`"); diff --git a/wxPython/src/_printfw.i b/wxPython/src/_printfw.i index 0cfff0be6b..570bb5355c 100644 --- a/wxPython/src/_printfw.i +++ b/wxPython/src/_printfw.i @@ -70,7 +70,8 @@ public: bool GetCollate(); int GetOrientation(); - bool Ok(); + bool IsOk(); + %pythoncode { Ok = IsOk } const wxString& GetPrinterName(); bool GetColour(); @@ -98,7 +99,7 @@ public: wxString GetFilename() const; void SetFilename( const wxString &filename ); - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { def __nonzero__(self): return self.IsOk() } //char* GetPrivData() const; //int GetPrivDataLen() const; @@ -201,7 +202,8 @@ public: wxPrintData& GetPrintData(); - bool Ok(); + bool IsOk(); + %pythoncode { Ok = IsOk } void SetDefaultInfo(bool flag); void SetDefaultMinMargins(bool flag); @@ -221,7 +223,7 @@ public: // Use paper id in wxPrintData to set this object's paper size void CalculatePaperSizeFromId(); - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { def __nonzero__(self): return self.IsOk() } %property(DefaultInfo, GetDefaultInfo, SetDefaultInfo, doc="See `GetDefaultInfo` and `SetDefaultInfo`"); %property(DefaultMinMargins, GetDefaultMinMargins, SetDefaultMinMargins, doc="See `GetDefaultMinMargins` and `SetDefaultMinMargins`"); @@ -314,13 +316,14 @@ public: bool GetEnableHelp() const; // Is this data OK for showing the print dialog? - bool Ok() const; + bool IsOk() const; + %pythoncode { Ok = IsOk } wxPrintData& GetPrintData(); void SetPrintData(const wxPrintData& printData); - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { def __nonzero__(self): return self.IsOk() } %property(AllPages, GetAllPages, SetAllPages, doc="See `GetAllPages` and `SetAllPages`"); %property(Collate, GetCollate, SetCollate, doc="See `GetCollate` and `SetCollate`"); @@ -692,13 +695,14 @@ public: int GetMaxPage(); int GetMinPage(); - bool Ok(); + bool IsOk(); + %pythoncode { Ok = IsOk } void SetOk(bool ok); virtual bool Print(bool interactive); virtual void DetermineScaling(); - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { def __nonzero__(self): return self.IsOk() } %property(Canvas, GetCanvas, SetCanvas, doc="See `GetCanvas` and `SetCanvas`"); %property(CurrentPage, GetCurrentPage, SetCurrentPage, doc="See `GetCurrentPage` and `SetCurrentPage`");