/////////////////////////////////////////////////////////////////////////////
-// Name: gdicmn.h
+// Name: wx/gdicmn.h
// Purpose: Common GDI classes, types and declarations
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
-// Copyright: (c)
+// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// headers
// ---------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma interface "gdicmn.h"
-#endif
-
#include "wx/defs.h"
#include "wx/list.h"
#include "wx/string.h"
#include "wx/fontenc.h"
#include "wx/hashmap.h"
+#include "wx/math.h"
// ---------------------------------------------------------------------------
// forward declarations
bool operator==(const wxSize& sz) const { return x == sz.x && y == sz.y; }
bool operator!=(const wxSize& sz) const { return x != sz.x || y != sz.y; }
- wxSize operator+(const wxSize& sz) { return wxSize(x + sz.x, y + sz.y); }
- wxSize operator-(const wxSize& sz) { return wxSize(x - sz.x, y - sz.y); }
- wxSize operator/(const int i) { return wxSize(x / i, y / i); }
- wxSize operator*(const int i) { return wxSize(x * i, y * i); }
+ wxSize operator+(const wxSize& sz) const { return wxSize(x + sz.x, y + sz.y); }
+ wxSize operator-(const wxSize& sz) const { return wxSize(x - sz.x, y - sz.y); }
+ wxSize operator/(int i) const { return wxSize(x / i, y / i); }
+ wxSize operator*(int i) const { return wxSize(x * i, y * i); }
wxSize& operator+=(const wxSize& sz) { x += sz.x; y += sz.y; return *this; }
wxSize& operator-=(const wxSize& sz) { x -= sz.x; y -= sz.y; return *this; }
wxRealPoint operator+(const wxRealPoint& pt) const { return wxRealPoint(x + pt.x, y + pt.y); }
wxRealPoint operator-(const wxRealPoint& pt) const { return wxRealPoint(x - pt.x, y - pt.y); }
- bool operator==(const wxRealPoint& pt) const { return x == pt.x && y == pt.y; }
- bool operator!=(const wxRealPoint& pt) const { return x != pt.x || y != pt.y; }
+ bool operator==(const wxRealPoint& pt) const
+ {
+ return wxIsSameDouble(x, pt.x) && wxIsSameDouble(y, pt.y);
+ }
+ bool operator!=(const wxRealPoint& pt) const { return !(*this == pt); }
};
+
class WXDLLEXPORT wxPoint
{
public:
}
+ // centre this rectangle in the given (usually, but not necessarily,
+ // larger) one
+ wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const
+ {
+ return wxRect(dir & wxHORIZONTAL ? r.x + (r.width - width)/2 : x,
+ dir & wxVERTICAL ? r.y + (r.height - height)/2 : y,
+ width, height);
+ }
+
+ wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const
+ {
+ return CentreIn(r, dir);
+ }
+
public:
int x, y, width, height;
};
// add a new colour to the database
void AddColour(const wxString& name, const wxColour& colour);
+#if WXWIN_COMPATIBILITY_2_6
// deprecated, use Find() instead
wxDEPRECATED( wxColour *FindColour(const wxString& name) );
+#endif // WXWIN_COMPATIBILITY_2_6
#ifdef __WXPM__
extern WXDLLEXPORT_DATA(wxColourDatabase*) wxTheColourDatabase;
-extern WXDLLEXPORT_DATA(const wxChar*) wxPanelNameStr;
+extern WXDLLEXPORT_DATA(const wxChar) wxPanelNameStr[];
extern WXDLLEXPORT_DATA(const wxSize) wxDefaultSize;
extern WXDLLEXPORT_DATA(const wxPoint) wxDefaultPosition;