#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)
+bool wxRect::operator==(const wxRect& rect) const
{
- x = rect.x;
- y = rect.y;
- width = rect.width;
- height = rect.height;
+ return ((x == rect.x) &&
+ (y == rect.y) &&
+ (width == rect.width) &&
+ (height == rect.height));
}
-wxRect& wxRect::operator = (const wxRect& rect)
+const wxRect& wxRect::operator += (const wxRect& rect)
{
- x = rect.x; y = rect.y; width = rect.width; height = rect.height;
- return *this;
+ *this = (*this + rect);
+ return ( *this ) ;
}
-bool wxRect::operator == (const wxRect& rect)
+wxRect wxRect::operator + (const wxRect& rect) const
{
- return ((x == rect.x) &&
- (y == rect.y) &&
- (width == rect.width) &&
- (height == rect.height));
+ 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::operator != (const wxRect& rect)
+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)
{
}
#ifdef __WXMSW__
else return NULL;
#endif
+#ifdef __WXPM__
+ else return NULL;
+#endif
// TODO for other implementations. This should really go into
// platform-specific directories.
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 ();
- if (col->Red () == red && col->Green () == green && col->Blue () == blue)
+ for (wxNode * node = First (); node; node = node->Next ())
+ {
+ wxColour *col = (wxColour *) node->Data ();
+
+ 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 () {
//#if defined(__X__)
// each_font->GetFontId () == FamilyOrFontId) /* New font system */
//#else
- each_font->GetFamily () == FamilyOrFontId &&
- ((each_font->GetFaceName() == "") || each_font->GetFaceName() == Face))
+#if defined(__WXGTK__)
+ (each_font->GetFamily() == FamilyOrFontId ||
+ (each_font->GetFamily() == wxSWISS && FamilyOrFontId == wxDEFAULT)) &&
+#else
+ each_font->GetFamily() == FamilyOrFontId &&
+#endif
+ ((each_font->GetFaceName() == _T("")) || each_font->GetFaceName() == Face))
//#endif
return each_font;
}