| 67 | } |
| 68 | |
| 69 | void ButtonSet::Item::onPaint(ui::PaintEvent& ev) |
| 70 | { |
| 71 | SkinTheme* theme = static_cast<SkinTheme*>(this->theme()); |
| 72 | Graphics* g = ev.graphics(); |
| 73 | gfx::Rect rc = clientBounds(); |
| 74 | gfx::Color fg, bg; |
| 75 | SkinPartPtr nw; |
| 76 | gfx::Rect boxRc, textRc, iconRc; |
| 77 | gfx::Size iconSize; |
| 78 | if (m_icon) |
| 79 | iconSize = m_icon->size(); |
| 80 | |
| 81 | getTextIconInfo( |
| 82 | &boxRc, &textRc, &iconRc, |
| 83 | CENTER | (hasText() ? BOTTOM: MIDDLE), |
| 84 | iconSize.w, iconSize.h); |
| 85 | |
| 86 | Grid::Info info = buttonSet()->getChildInfo(this); |
| 87 | bool isLastCol = (info.col+info.hspan >= info.grid_cols); |
| 88 | bool isLastRow = (info.row+info.vspan >= info.grid_rows); |
| 89 | |
| 90 | if (m_icon || isLastRow) { |
| 91 | textRc.y -= 1*guiscale(); |
| 92 | iconRc.y -= 1*guiscale(); |
| 93 | } |
| 94 | |
| 95 | if (!gfx::is_transparent(bgColor())) |
| 96 | g->fillRect(bgColor(), g->getClipBounds()); |
| 97 | |
| 98 | if (isSelected() || hasMouseOver()) { |
| 99 | if (hasCapture()) { |
| 100 | nw = theme->parts.toolbuttonPushed(); |
| 101 | fg = theme->colors.buttonSelectedText(); |
| 102 | bg = theme->colors.buttonSelectedFace(); |
| 103 | } |
| 104 | else { |
| 105 | nw = (hasFocus() ? theme->parts.toolbuttonHotFocused(): |
| 106 | theme->parts.toolbuttonHot()); |
| 107 | fg = theme->colors.buttonHotText(); |
| 108 | bg = theme->colors.buttonHotFace(); |
| 109 | } |
| 110 | } |
| 111 | else { |
| 112 | nw = (hasFocus() ? theme->parts.toolbuttonFocused(): |
| 113 | theme->parts.toolbuttonLast()); |
| 114 | fg = theme->colors.buttonNormalText(); |
| 115 | bg = theme->colors.buttonNormalFace(); |
| 116 | } |
| 117 | |
| 118 | if (!isLastCol) |
| 119 | rc.w += 1*guiscale(); |
| 120 | |
| 121 | if (!isLastRow) { |
| 122 | if (nw == theme->parts.toolbuttonHotFocused()) |
| 123 | rc.h += 2*guiscale(); |
| 124 | else |
| 125 | rc.h += 3*guiscale(); |
| 126 | } |
nothing calls this directly
no test coverage detected