summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-12-10 18:32:14 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2015-12-10 18:32:14 +0100
commit180361cda94f612d3ebfd2c460c24b457fae64d3 (patch)
tree846c879e9ad44ab734d896ca38d9ea7513b6b2a1
parent98d68e221cbf13f0d978b9c997c55c98dff1cbf9 (diff)
Change position types and add size change notifier.
-rw-r--r--plugingui/window.cc44
-rw-r--r--plugingui/window.h12
2 files changed, 12 insertions, 44 deletions
diff --git a/plugingui/window.cc b/plugingui/window.cc
index 30e90ee..9263128 100644
--- a/plugingui/window.cc
+++ b/plugingui/window.cc
@@ -26,8 +26,8 @@
*/
#include "window.h"
-#include "painter.h"
#include <hugin.hpp>
+#include "painter.h"
#ifndef PUGL
#ifdef X11
@@ -101,26 +101,6 @@ void Window::move(size_t x, size_t y)
Widget::move(x, y);
}
-size_t Window::x()
-{
- return _x;
-}
-
-size_t Window::y()
-{
- return _y;
-}
-
-size_t Window::width()
-{
- return _width;
-}
-
-size_t Window::height()
-{
- return _height;
-}
-
size_t Window::windowX()
{
return 0;
@@ -192,6 +172,7 @@ Widget* Window::mouseFocus()
void Window::setMouseFocus(Widget* widget)
{
_mouseFocus = widget;
+
}
void Window::redraw()
@@ -214,6 +195,9 @@ void Window::resized(size_t width, size_t height)
pixbuf.realloc(width, height);
repaintEvent(nullptr);
+
+ // Notify Widget
+ sizeChangeNotifier(width, height);
}
void Window::updateBuffer()
@@ -224,6 +208,12 @@ void Window::updateBuffer()
size_t updateWidth = pixelBuffer->width;
size_t updateHeight = pixelBuffer->height;
+ // Skip buffer if not inside window.
+ if((wpixbuf.width < pixelBuffer->x) || (wpixbuf.height < pixelBuffer->y))
+ {
+ continue;
+ }
+
if(updateWidth > (wpixbuf.width - pixelBuffer->x))
{
updateWidth = (wpixbuf.width - pixelBuffer->x);
@@ -276,16 +266,4 @@ void Window::endPaint()
}
}
-void Window::repaintEvent(RepaintEvent* repaintEvent)
-{
- if(!visible())
- {
- return;
- }
-
- Painter p(*this);
- p.drawImageStretched(0,0, back, width(), height());
- p.drawImage(width() - logo.width(), height() - logo.height(), logo);
-}
-
} // GUI::
diff --git a/plugingui/window.h b/plugingui/window.h
index 7701ad9..1fffbb6 100644
--- a/plugingui/window.h
+++ b/plugingui/window.h
@@ -46,10 +46,6 @@ public:
// From Widget:
void resize(int width, int height) override;
void move(size_t x, size_t y) override;
- size_t x() override;
- size_t y() override;
- size_t width() override;
- size_t height() override;
size_t windowX() override;
size_t windowY() override;
void show() override;
@@ -79,10 +75,7 @@ protected:
void beginPaint();
void endPaint();
- // From Widget:
- void repaintEvent(RepaintEvent* repaintEvent) override;
-
- // For the NativweWindow
+ // For the NativeWindow
friend class NativeWindowX11;
friend class NativeWindowWin32;
friend class NativeWindowPugl;
@@ -97,9 +90,6 @@ protected:
NativeWindow* native{nullptr};
EventHandler* eventhandler{nullptr};
- Image back{":bg.png"};
- Image logo{":logo.png"};
-
size_t maxRefcount{0};
};