#include "wx/font.h"
#include "wx/palette.h"
#include "wx/app.h"
+#include "wx/dc.h"
+#include "wx/utils.h"
#include "wx/log.h"
#include <string.h>
#endif
#if !USE_SHARED_LIBRARY
-IMPLEMENT_CLASS(wxColourDatabase, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
-/*
-IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxPoint, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxRealPoint, wxObject)
-*/
+ IMPLEMENT_CLASS(wxColourDatabase, wxList)
+ IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
+ IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
+ IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
+ IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
+ IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
+
+ IMPLEMENT_ABSTRACT_CLASS(wxDCBase, wxObject)
#endif
-wxRect::wxRect()
-{
- x = 0; y = 0; width = 0; height = 0;
-}
-
-wxRect::wxRect(long xx, long yy, long w, long h)
-{
- x = xx; y = yy; width = w; height = h;
-}
-
wxRect::wxRect(const wxPoint& topLeft, const wxPoint& bottomRight)
{
x = topLeft.x;
width = size.x; height = size.y;
}
-wxRect::wxRect(const wxRect& rect)
-{
- x = rect.x;
- y = rect.y;
- width = rect.width;
- height = rect.height;
-}
-
-wxRect& wxRect::operator = (const wxRect& rect)
-{
- x = rect.x; y = rect.y; width = rect.width; height = rect.height;
- return *this;
-}
-
-bool wxRect::operator == (const wxRect& rect)
+bool wxRect::operator==(const wxRect& rect) const
{
return ((x == rect.x) &&
(y == rect.y) &&
(height == rect.height));
}
-bool wxRect::operator != (const wxRect& rect)
+const wxRect& wxRect::operator += (const wxRect& rect)
+{
+ *this = (*this + rect);
+ return ( *this ) ;
+}
+
+wxRect wxRect::operator + (const wxRect& rect) const
+{
+ int x1 = wxMin(this->x, rect.x);
+ int y1 = wxMin(this->y, rect.y);
+ int y2 = wxMax(y+height, rect.height+rect.y);
+ int x2 = wxMax(x+width, rect.width+rect.x);
+ return wxRect(x1, y1, x2-x1, y2-y1);
+}
+
+bool wxRect::Inside(int cx, int cy) const
{
- return ((x != rect.x) ||
- (y != rect.y) ||
- (width != rect.width) ||
- (height != rect.height));
+ return ( (cx >= x) && (cy >= y)
+ && ((cy - y) < height)
+ && ((cx - x) < width)
+ );
}
-wxColourDatabase::wxColourDatabase (int type):
-wxList (type)
+wxColourDatabase::wxColourDatabase (int type) : wxList (type)
{
}
wxString wxColourDatabase::FindName (const wxColour& colour) const
{
- unsigned char red = colour.Red ();
- unsigned char green = colour.Green ();
- unsigned char blue = colour.Blue ();
+ wxString name;
- for (wxNode * node = First (); node; node = node->Next ())
- {
- wxColour *col = (wxColour *) node->Data ();
+ unsigned char red = colour.Red ();
+ unsigned char green = colour.Green ();
+ unsigned char blue = colour.Blue ();
+
+ for (wxNode * node = First (); node; node = node->Next ())
+ {
+ wxColour *col = (wxColour *) node->Data ();
- if (col->Red () == red && col->Green () == green && col->Blue () == blue)
+ if (col->Red () == red && col->Green () == green && col->Blue () == blue)
{
- const wxChar *found = node->GetKeyString();
- if (found)
- return wxString(found);
+ const wxChar *found = node->GetKeyString();
+ if ( found )
+ {
+ name = found;
+
+ break;
+ }
}
- }
- return wxString(""); // Not Found
+ }
+ return name;
}
void wxInitializeStockLists () {