Compare commits
3 commits
26858b795d
...
cf5bcd63b2
Author | SHA1 | Date | |
---|---|---|---|
|
cf5bcd63b2 | ||
|
19abbbf057 | ||
|
9c830c48d6 |
12 changed files with 15 additions and 17 deletions
|
@ -7,7 +7,6 @@ xlib_dep = dependency('x11')
|
||||||
executable(
|
executable(
|
||||||
'ravenapp',
|
'ravenapp',
|
||||||
'./src/Box.cpp',
|
'./src/Box.cpp',
|
||||||
'./src/Events.cpp',
|
|
||||||
'./src/Widget.cpp',
|
'./src/Widget.cpp',
|
||||||
'./src/Button.cpp',
|
'./src/Button.cpp',
|
||||||
'./src/Painter.cpp',
|
'./src/Painter.cpp',
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
|
|
||||||
namespace Raven {
|
namespace Raven {
|
||||||
|
|
||||||
bool Box::contains_point(double x, double y) {
|
bool Box::contains_point(double x, double y) const {
|
||||||
return x >= m_x && m_x + m_width >= x && y >= m_y && m_y + m_height >= y;
|
return x >= m_x && m_x + m_width >= x && y >= m_y && m_y + m_height >= y;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Box::contains_point(Point &point) {
|
bool Box::contains_point(const Point &point) const {
|
||||||
return point.get_x() >= m_x && m_x + m_width >= point.get_x() && point.get_y() >= m_y && m_y + m_height >= point.get_y();
|
return point.get_x() >= m_x && m_x + m_width >= point.get_x() && point.get_y() >= m_y && m_y + m_height >= point.get_y();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Box::contains_box(Box &other) const {
|
bool Box::contains_box(const Box &other) const {
|
||||||
double ax1 = m_x;
|
double ax1 = m_x;
|
||||||
double ax2 = m_x + m_width;
|
double ax2 = m_x + m_width;
|
||||||
double ay1 = m_y;
|
double ay1 = m_y;
|
||||||
|
|
11
src/Box.hpp
11
src/Box.hpp
|
@ -26,14 +26,19 @@ public:
|
||||||
double get_width() { return m_width; }
|
double get_width() { return m_width; }
|
||||||
double get_height() { return m_height; }
|
double get_height() { return m_height; }
|
||||||
|
|
||||||
|
double get_x() const { return m_x; }
|
||||||
|
double get_y() const { return m_y; }
|
||||||
|
double get_width() const { return m_width; }
|
||||||
|
double get_height() const { return m_height; }
|
||||||
|
|
||||||
void set_x(double x) { m_x = x; }
|
void set_x(double x) { m_x = x; }
|
||||||
void set_y(double y) { m_y = y; }
|
void set_y(double y) { m_y = y; }
|
||||||
void set_width(double width) { m_width = width; }
|
void set_width(double width) { m_width = width; }
|
||||||
void set_height(double height) { m_height = height; }
|
void set_height(double height) { m_height = height; }
|
||||||
|
|
||||||
bool contains_point(double x, double y);
|
bool contains_point(double x, double y) const;
|
||||||
bool contains_point(Point &point);
|
bool contains_point(const Point &point) const;
|
||||||
bool contains_box(Box &other) const;
|
bool contains_box(const Box &other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#include <iostream>
|
|
||||||
#include "Button.hpp"
|
#include "Button.hpp"
|
||||||
#include "Box.hpp"
|
#include "Box.hpp"
|
||||||
#include "Window.hpp"
|
#include "Window.hpp"
|
||||||
#include "src/Painter.hpp"
|
#include "Painter.hpp"
|
||||||
#include <pango/pangocairo.h>
|
#include <pango/pangocairo.h>
|
||||||
|
|
||||||
namespace Raven {
|
namespace Raven {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "Painter.hpp"
|
#include "Painter.hpp"
|
||||||
#include "src/RGB.hpp"
|
#include "RGB.hpp"
|
||||||
|
|
||||||
namespace Raven {
|
namespace Raven {
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "Box.hpp"
|
#include "Box.hpp"
|
||||||
#include "Point.hpp"
|
#include "Point.hpp"
|
||||||
#include "src/RGB.hpp"
|
#include "RGB.hpp"
|
||||||
#include <cairomm/cairomm.h>
|
#include <cairomm/cairomm.h>
|
||||||
#include <pango/pangocairo.h>
|
#include <pango/pangocairo.h>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
namespace Raven {
|
namespace Raven {
|
||||||
|
|
||||||
class Point {
|
class Point {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include "Forward.hpp"
|
#include "Forward.hpp"
|
||||||
#include "pango/pango-font.h"
|
#include "pango/pango-font.h"
|
||||||
#include "PropMacros.hpp"
|
#include "PropMacros.hpp"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#include <iostream>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "Widget.hpp"
|
#include "Widget.hpp"
|
||||||
#include "Events.hpp"
|
#include "Events.hpp"
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include "Window.hpp"
|
#include "Window.hpp"
|
||||||
#include "Events.hpp"
|
#include "Events.hpp"
|
||||||
#include "src/Point.hpp"
|
#include "Point.hpp"
|
||||||
|
|
||||||
namespace Raven {
|
namespace Raven {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#include <iostream>
|
|
||||||
#include "Window.hpp"
|
#include "Window.hpp"
|
||||||
#include "Widget.hpp"
|
#include "Widget.hpp"
|
||||||
#include "Button.hpp"
|
#include "Button.hpp"
|
||||||
|
|
Loading…
Reference in a new issue