From 37471a3486a566159bcf0c7ebd68f9064287d0fa Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 13 Mar 2013 21:03:14 +0100 Subject: Use new painter clear function. --- plugingui/button.cc | 4 +++- plugingui/checkbox.cc | 2 ++ plugingui/combobox.cc | 26 +++++++++++++++++++------- plugingui/filebrowser.cc | 31 ++++++++++++++++++------------- plugingui/knob.cc | 2 ++ plugingui/lineedit.cc | 2 ++ plugingui/listbox.cc | 23 +++++++++++++++++++++-- plugingui/window.cc | 3 +++ 8 files changed, 70 insertions(+), 23 deletions(-) diff --git a/plugingui/button.cc b/plugingui/button.cc index b65f318..85d5425 100644 --- a/plugingui/button.cc +++ b/plugingui/button.cc @@ -64,7 +64,9 @@ void GUI::Button::repaintEvent(GUI::RepaintEvent *e) Painter p(this); - float alpha = 0.8; + p.clear(); + + float alpha = 0.9; if(hasKeyboardFocus()) { p.setColour(Colour(0.6, alpha)); diff --git a/plugingui/checkbox.cc b/plugingui/checkbox.cc index 5888d3c..da3ce4b 100644 --- a/plugingui/checkbox.cc +++ b/plugingui/checkbox.cc @@ -74,6 +74,8 @@ void GUI::CheckBox::repaintEvent(GUI::RepaintEvent *e) Painter p(this); + p.clear(); + float alpha = 0.8; int box = width()direction == 1) { if(e->x > (width() - btn_size) && e->y < (width() - 1)) { if(e->y > 0 && e->y < btn_size) { + if(e->direction == -1) return; scroll_offset--; if(scroll_offset < 0) scroll_offset = 0; repaintEvent(NULL); @@ -263,6 +265,7 @@ void GUI::ListBox::buttonEvent(ButtonEvent *e) } if(e->y > (height() - btn_size) && e->y < (height() - 1)) { + if(e->direction == -1) return; scroll_offset++; if(scroll_offset > (items.size() - 1)) scroll_offset = (items.size() - 1); @@ -271,6 +274,8 @@ void GUI::ListBox::buttonEvent(ButtonEvent *e) } } + + if(e->direction == -1) { int skip = scroll_offset; size_t yoffset = padding / 2; for(int idx = skip; idx < (int)items.size(); idx++) { @@ -286,5 +291,19 @@ void GUI::ListBox::buttonEvent(ButtonEvent *e) repaintEvent(NULL); } + if(e->direction != -1) { + int skip = scroll_offset; + size_t yoffset = padding / 2; + for(int idx = skip; idx < (int)items.size(); idx++) { + yoffset += font.textHeight() + padding; + if(e->y < (int)yoffset - (padding / 2)) { + marked = idx; + break; + } + } + + repaintEvent(NULL); + } + if(e->doubleclick && sel_handler) sel_handler(sel_ptr); } diff --git a/plugingui/window.cc b/plugingui/window.cc index 1795d62..9e06502 100644 --- a/plugingui/window.cc +++ b/plugingui/window.cc @@ -82,6 +82,9 @@ void GUI::Window::setCaption(std::string caption) void GUI::Window::repaintEvent(GUI::RepaintEvent *e) { Painter p(this); + + p.clear(); + p.drawImage(0, 0, (struct __img__*)&img_back); } -- cgit v1.2.3