Add IsOk's

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41774 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2006-10-09 02:36:38 +00:00
parent 6a591c4317
commit 6c2dd16f55
14 changed files with 67 additions and 37 deletions

View File

@ -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 }
};

View File

@ -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);

View File

@ -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`");

View File

@ -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))
}

View File

@ -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__

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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);

View File

@ -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`");

View File

@ -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`");
};

View File

@ -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`");
};

View File

@ -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`");

View File

@ -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`");