diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-03-30 17:44:20 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-03-30 17:44:20 +0100 |
commit | 4b7414b3f6869f2bdeb097e4f997498bae9f0aee (patch) | |
tree | 53e9741d7d40f1ff6f77d47fc308b18168dca330 /plugingui/window.cc | |
parent | a1fba9ba11a13f94c524f2ac78206b3fdfb3be74 (diff) |
New box rendering of all widgets. Minor tweaks still missing.
Diffstat (limited to 'plugingui/window.cc')
-rw-r--r-- | plugingui/window.cc | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/plugingui/window.cc b/plugingui/window.cc index 9e06502..f524ee9 100644 --- a/plugingui/window.cc +++ b/plugingui/window.cc @@ -28,8 +28,6 @@ #include "painter.h" -#include "img_back.h" - #include <stdio.h> #include <stdlib.h> @@ -46,7 +44,7 @@ GUI::Window *gwindow = NULL; GUI::Window::Window(GlobalContext *gctx) - : Widget(NULL), wpixbuf(640, 200) + : Widget(NULL), wpixbuf(1000, 1000) { gwindow = this; @@ -85,12 +83,13 @@ void GUI::Window::repaintEvent(GUI::RepaintEvent *e) p.clear(); - p.drawImage(0, 0, (struct __img__*)&img_back); + Image back(":bg.png"); + p.drawImageStretched(0,0, &back, width(), height()); } -void GUI::Window::resize(size_t width, size_t height) +void GUI::Window::resize(int width, int height) { - // printf("Window::resize(%d, %d)\n", width, height); + if(width < 1 || height < 1) return; native->resize(width, height); Widget::resize(width, height); } @@ -129,35 +128,26 @@ GUI::Window *GUI::Window::window() void GUI::Window::beginPaint() { refcount++; - // printf("beginPaint(%d)\n", refcount); } void GUI::Window::endPaint() { - // printf("endPaint(%d)\n", refcount); if(refcount) refcount--; if(!refcount) { updateBuffer(); -#ifdef X11 - //XSendEvent(gctx->display, window, false, ExposureMask, event_send) -#endif/*X11*/ redraw(); } } void GUI::Window::updateBuffer() { - // printf("updateBuffer w:%d h:%d\n", width(), height()); - memset(wpixbuf.buf, 0, wpixbuf.width * wpixbuf.height * 3); std::vector<PixelBufferAlpha *> pl = getPixelBuffers(); std::vector<PixelBufferAlpha *>::iterator pli = pl.begin(); while(pli != pl.end()) { PixelBufferAlpha *pb = *pli; - // printf("Buffer idx %d (%d %d) [%d %d]\n", pb->idx, pb->x, pb->y, - // pb->width, pb->height); for(size_t x = 0; x < pb->width; x++) { for(size_t y = 0; y < pb->height; y++) { unsigned char r,g,b,a; @@ -206,5 +196,4 @@ void GUI::Window::setButtonDownFocus(GUI::Widget *widget) { _buttonDownFocus = widget; native->grabMouse(widget != NULL); - // repaint_r(NULL); } |