| 55 | } |
| 56 | |
| 57 | bool ScrollBar::onProcessMessage(Message* msg) |
| 58 | { |
| 59 | #define MOUSE_IN(x1, y1, x2, y2) \ |
| 60 | ((mousePos.x >= (x1)) && (mousePos.x <= (x2)) && \ |
| 61 | (mousePos.y >= (y1)) && (mousePos.y <= (y2))) |
| 62 | |
| 63 | switch (msg->type()) { |
| 64 | |
| 65 | case kMouseDownMessage: { |
| 66 | gfx::Point mousePos = static_cast<MouseMessage*>(msg)->position(); |
| 67 | int x1, y1, x2, y2; |
| 68 | int u1, v1, u2, v2; |
| 69 | bool ret = false; |
| 70 | int pos, len; |
| 71 | |
| 72 | getScrollBarThemeInfo(&pos, &len); |
| 73 | |
| 74 | m_wherepos = pos; |
| 75 | m_whereclick = (align() & HORIZONTAL) ? |
| 76 | mousePos.x: |
| 77 | mousePos.y; |
| 78 | |
| 79 | x1 = bounds().x; |
| 80 | y1 = bounds().y; |
| 81 | x2 = bounds().x2()-1; |
| 82 | y2 = bounds().y2()-1; |
| 83 | |
| 84 | u1 = x1 + border().left(); |
| 85 | v1 = y1 + border().top(); |
| 86 | u2 = x2 - border().right(); |
| 87 | v2 = y2 - border().bottom(); |
| 88 | |
| 89 | Point scroll = m_delegate->viewScroll(); |
| 90 | |
| 91 | if (align() & HORIZONTAL) { |
| 92 | // in the bar |
| 93 | if (MOUSE_IN(u1+pos, v1, u1+pos+len-1, v2)) { |
| 94 | // capture mouse |
| 95 | } |
| 96 | // left |
| 97 | else if (MOUSE_IN(x1, y1, u1+pos-1, y2)) { |
| 98 | scroll.x -= m_delegate->visibleSize().w/2; |
| 99 | ret = true; |
| 100 | } |
| 101 | // right |
| 102 | else if (MOUSE_IN(u1+pos+len, y1, x2, y2)) { |
| 103 | scroll.x += m_delegate->visibleSize().w/2; |
| 104 | ret = true; |
| 105 | } |
| 106 | } |
| 107 | else { |
| 108 | // in the bar |
| 109 | if (MOUSE_IN(u1, v1+pos, u2, v1+pos+len-1)) { |
| 110 | // capture mouse |
| 111 | } |
| 112 | // left |
| 113 | else if (MOUSE_IN(x1, y1, x2, v1+pos-1)) { |
| 114 | scroll.y -= m_delegate->visibleSize().h/2; |
nothing calls this directly
no test coverage detected