]> git.saurik.com Git - wxWidgets.git/blame - include/wx/position.h
fix PCH-less build after changing timer id type to WPARAM (closes #10901)
[wxWidgets.git] / include / wx / position.h
CommitLineData
97660d42
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: include/wx/position.h
3// Purpose: Common structure and methods for positional information.
4// Author: Vadim Zeitlin, Robin Dunn, Brad Anderson, Bryan Petty
4e4e981f 5// Created: 2007-03-13
97660d42
VZ
6// RCS-ID: $Id$
7// Copyright: (c) 2007 The wxWidgets Team
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_POSITION_H_
12#define _WX_POSITION_H_
13
14#include "wx/gdicmn.h"
15
0ddec397 16class WXDLLIMPEXP_CORE wxPosition
97660d42
VZ
17{
18public:
19 wxPosition() : m_row(0), m_column(0) {}
20 wxPosition(int row, int col) : m_row(row), m_column(col) {}
21
22 // default copy ctor and assignment operator are okay.
23
24 int GetRow() const { return m_row; }
25 int GetColumn() const { return m_column; }
26 int GetCol() const { return GetColumn(); }
27 void SetRow(int row) { m_row = row; }
28 void SetColumn(int column) { m_column = column; }
29 void SetCol(int column) { SetColumn(column); }
30
31 bool operator==(const wxPosition& p) const
32 { return m_row == p.m_row && m_column == p.m_column; }
33 bool operator!=(const wxPosition& p) const
34 { return !(*this == p); }
35
36 wxPosition& operator+=(const wxPosition& p)
37 { m_row += p.m_row; m_column += p.m_column; return *this; }
38 wxPosition& operator-=(const wxPosition& p)
39 { m_row -= p.m_row; m_column -= p.m_column; return *this; }
40 wxPosition& operator+=(const wxSize& s)
41 { m_row += s.y; m_column += s.x; return *this; }
42 wxPosition& operator-=(const wxSize& s)
43 { m_row -= s.y; m_column -= s.x; return *this; }
44
45 wxPosition operator+(const wxPosition& p) const
46 { return wxPosition(m_row + p.m_row, m_column + p.m_column); }
47 wxPosition operator-(const wxPosition& p) const
48 { return wxPosition(m_row - p.m_row, m_column - p.m_column); }
49 wxPosition operator+(const wxSize& s) const
50 { return wxPosition(m_row + s.y, m_column + s.x); }
51 wxPosition operator-(const wxSize& s) const
52 { return wxPosition(m_row - s.y, m_column - s.x); }
53
54private:
55 int m_row;
56 int m_column;
57};
58
59#endif // _WX_POSITION_H_
60