#include "wx/log.h"
#include <string.h>
-#ifdef __WXMSW__
+#if defined(__WXMSW__)
#include "wx/msw/wrapwin.h"
#endif
height++;
}
-wxRect::wxRect(const wxPoint& point, const wxSize& size)
-{
- x = point.x; y = point.y;
- width = size.x; height = size.y;
-}
-
bool wxRect::operator==(const wxRect& rect) const
{
return ((x == rect.x) &&
(height == rect.height));
}
-wxRect& wxRect::operator += (const wxRect& rect)
-{
- *this = (*this + rect);
- return ( *this ) ;
-}
-
-wxRect wxRect::operator + (const wxRect& rect) const
+wxRect wxRect::operator+(const wxRect& rect) const
{
int x1 = wxMin(this->x, rect.x);
int y1 = wxMin(this->y, rect.y);
return wxRect(x1, y1, x2-x1, y2-y1);
}
+wxRect& wxRect::Union(const wxRect& rect)
+{
+ // ignore empty rectangles: union with an empty rectangle shouldn't extend
+ // this one to (0, 0)
+ if ( !width || !height )
+ {
+ *this = rect;
+ }
+ else if ( rect.width && rect.height )
+ {
+ int x1 = wxMin(x, rect.x);
+ int y1 = wxMin(y, rect.y);
+ int y2 = wxMax(y + height, rect.height + rect.y);
+ int x2 = wxMax(x + width, rect.width + rect.x);
+
+ x = x1;
+ y = y1;
+ width = x2 - x1;
+ height = y2 - y1;
+ }
+ //else: we're not empty and rect is empty
+
+ return *this;
+}
+
wxRect& wxRect::Inflate(wxCoord dx, wxCoord dy)
{
x -= dx;
}
else // new colour
{
- (*m_map)[name] = new wxColour(colour);
+ (*m_map)[colName] = new wxColour(colour);
}
}
GetThemeFont(kThemeSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
sizeFont = fontSize ;
-#if __WXMAC_CLASSIC__
+#ifdef __WXMAC_CLASSIC__
wxNORMAL_FONT = new wxFont (fontSize, wxMODERN, wxNORMAL, wxNORMAL , false , wxMacMakeStringFromPascal(fontName) );
#else
wxNORMAL_FONT = new wxFont () ;
#elif defined(__WXMAC__)
wxSWISS_FONT = new wxFont (sizeFont, wxSWISS, wxNORMAL, wxNORMAL); /* Helv */
wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL);
-#if __WXMAC_CLASSIC__
+#ifdef __WXMAC_CLASSIC__
GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
wxSMALL_FONT = new wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , wxMacMakeStringFromPascal( fontName ) );
#else
// wxTheXXXList stuff (semi-obsolete)
// ============================================================================
-wxBitmapList::wxBitmapList()
-{
-}
-
wxBitmapList::~wxBitmapList ()
{
wxList::compatibility_iterator node = GetFirst ();
// a different font if we create it with empty facename, but it is
// still better than never matching anything in the cache at all
// in this case
- if ( same && !facename.IsEmpty() )
+ if ( same && !facename.empty() )
{
const wxString& fontFace = font->GetFaceName();