void EditorView::onPaint(PaintEvent& ev) { Graphics* g = ev.graphics(); SkinTheme* theme = static_cast<SkinTheme*>(this->theme()); bool selected = false; switch (m_type) { // Only show the view selected if it is the current editor case CurrentEditorMode: selected = (editor()->isActive()); break; // Always show selected case AlwaysSelected: selected = true; break; } theme->drawRect( g, clientBounds(), (selected ? theme->parts.editorSelected().get(): theme->parts.editorNormal().get()), bgColor()); }
void draw_color_button(ui::Graphics* g, const Rect& rc, const app::Color& color, bool hot, bool drag) { SkinTheme* theme = SkinTheme::instance(); int scale = ui::guiscale(); // Draw background (the color) draw_color(g, Rect(rc.x+1*scale, rc.y+1*scale, rc.w-2*scale, rc.h-2*scale), color); // Draw opaque border theme->drawRect( g, rc, theme->parts.colorbar0()->getBitmapNW(), theme->parts.colorbar0()->getBitmapN(), theme->parts.colorbar1()->getBitmapNE(), theme->parts.colorbar1()->getBitmapE(), theme->parts.colorbar3()->getBitmapSE(), theme->parts.colorbar2()->getBitmapS(), theme->parts.colorbar2()->getBitmapSW(), theme->parts.colorbar0()->getBitmapW()); // Draw hot if (hot) { theme->drawRect( g, gfx::Rect(rc.x, rc.y, rc.w, rc.h-1 - 1*scale), theme->parts.colorbarBorderHotfg().get()); } }
void ColorSpectrum::onPaint(ui::PaintEvent& ev) { ui::Graphics* g = ev.graphics(); SkinTheme* theme = static_cast<SkinTheme*>(this->theme()); theme->drawRect(g, clientBounds(), theme->parts.editorNormal().get(), bgColor()); gfx::Rect rc = clientChildrenBounds(); if (rc.isEmpty()) return; int vmid = (align() & HORIZONTAL ? rc.h/2 : rc.w/2); vmid = MAX(1, vmid); for (int y=0; y<rc.h; ++y) { for (int x=0; x<rc.w; ++x) { int u, v, umax; if (align() & HORIZONTAL) { u = x; v = y; umax = MAX(1, rc.w-1); } else { u = y; v = x; umax = MAX(1, rc.h-1); } double hue = 360.0 * u / umax; double sat = (v < vmid ? 100.0 * v / vmid : 100.0); double val = (v < vmid ? 100.0 : 100.0-(100.0 * (v-vmid) / vmid)); gfx::Color color = color_utils::color_for_ui( app::Color::fromHsv( MID(0.0, hue, 360.0), MID(0.0, sat, 100.0), MID(0.0, val, 100.0))); g->putPixel(color, rc.x+x, rc.y+y); } } if (m_color.getType() != app::Color::MaskType) { double hue = m_color.getHue(); double sat = m_color.getSaturation(); double val = m_color.getValue(); double lit = (200.0 - sat) * val / 200.0; gfx::Point pos(rc.x + int(hue * rc.w / 360.0), rc.y + rc.h - int(lit * rc.h / 100.0)); she::Surface* icon = theme->parts.colorWheelIndicator()->bitmap(0); g->drawColoredRgbaSurface( icon, lit > 50.0 ? gfx::rgba(0, 0, 0): gfx::rgba(255, 255, 255), pos.x-icon->width()/2, pos.y-icon->height()/2); } }
void ButtonSet::Item::onPaint(ui::PaintEvent& ev) { SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); Graphics* g = ev.getGraphics(); gfx::Rect rc = getClientBounds(); gfx::Color face; int nw; if (!gfx::is_transparent(getBgColor())) g->fillRect(getBgColor(), g->getClipBounds()); if (isSelected() || hasMouseOver()) { nw = PART_TOOLBUTTON_HOT_NW; face = theme->getColor(ThemeColor::ButtonHotFace); } else { nw = PART_TOOLBUTTON_LAST_NW; face = theme->getColor(ThemeColor::ButtonNormalFace); } Grid::Info info = buttonSet()->getChildInfo(this); if (info.col < info.grid_cols-1) rc.w+=1*jguiscale(); if (info.row < info.grid_rows-1) rc.h+=3*jguiscale(); theme->draw_bounds_nw(g, rc, nw, face); if (m_icon) { g->drawRgbaSurface(m_icon, rc.x + rc.w/2 - m_icon->width()/2, rc.y + rc.h/2 - m_icon->height()/2); } }
void EditorView::onPaint(PaintEvent& ev) { Graphics* g = ev.getGraphics(); Widget* viewport = getViewport(); Widget* child = UI_FIRST_WIDGET(viewport->getChildren()); SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); bool selected = false; switch (m_type) { // Only show the view selected if it is the current editor case CurrentEditorMode: selected = (child == current_editor); break; // Always show selected case AlwaysSelected: selected = true; break; } theme->draw_bounds_nw(g, getClientBounds(), selected ? PART_EDITOR_SELECTED_NW: PART_EDITOR_NORMAL_NW, ColorNone); }
static Size getToolIconSize(Widget* widget) { SkinTheme* theme = static_cast<SkinTheme*>(widget->getTheme()); she::Surface* icon = theme->get_toolicon("configuration"); if (icon) return Size(icon->width(), icon->height()); else return Size(16, 16) * jguiscale(); }
void Tabs::onInitTheme(InitThemeEvent& ev) { Widget::onInitTheme(ev); SkinTheme* theme = static_cast<SkinTheme*>(ev.getTheme()); m_button_left->setBgColor(theme->getColor(ThemeColor::TabSelectedFace)); m_button_right->setBgColor(theme->getColor(ThemeColor::TabSelectedFace)); }
void ColorBar::ScrollableView::onPaint(ui::PaintEvent& ev) { ui::Graphics* g = ev.getGraphics(); SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); theme->draw_bounds_nw(g, getClientBounds(), hasFocus() ? PART_EDITOR_SELECTED_NW: PART_EDITOR_NORMAL_NW, ColorNone); }
StartView::StartView() : Box(JI_VERTICAL) { SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); setBgColor(theme->getColor(ThemeColor::Workspace)); child_spacing = 8 * jguiscale(); addChild(new Label("Welcome to " PACKAGE " v" VERSION)); }
ColorBar::ScrollableView::ScrollableView() { SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); int l = theme->get_part(PART_EDITOR_SELECTED_W)->w; int t = theme->get_part(PART_EDITOR_SELECTED_N)->h; int r = theme->get_part(PART_EDITOR_SELECTED_E)->w; int b = theme->get_part(PART_EDITOR_SELECTED_S)->h; jwidget_set_border(this, l, t, r, b); }
void ColorWheel::onPaint(ui::PaintEvent& ev) { ui::Graphics* g = ev.getGraphics(); SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); theme->drawRect(g, getClientBounds(), theme->parts.editorNormal().get(), getBgColor()); const gfx::Rect& rc = m_clientBounds; for (int y=rc.y; y<rc.y+rc.h; ++y) { for (int x=rc.x; x<rc.x+rc.w; ++x) { app::Color appColor = ColorWheel::pickColor(gfx::Point(x, y)); gfx::Color color; if (appColor.getType() != app::Color::MaskType) { color = color_utils::color_for_ui(appColor); } else { color = theme->colors.editorFace(); } g->putPixel(color, x, y); } } if (m_mainColor.getAlpha() > 0) { int n = getHarmonies(); int boxsize = MIN(rc.w/10, rc.h/10); for (int i=0; i<n; ++i) { app::Color color = getColorInHarmony(i); int hue = color.getHue()-30; int sat = color.getSaturation(); gfx::Point pos = m_wheelBounds.getCenter() + gfx::Point(int(+std::cos(PI*hue/180)*double(m_wheelRadius)*sat/100.0), int(-std::sin(PI*hue/180)*double(m_wheelRadius)*sat/100.0)); she::Surface* icon = theme->parts.colorWheelIndicator()->getBitmap(0); g->drawRgbaSurface(icon, pos.x-icon->width()/2, pos.y-icon->height()/2); g->fillRect(gfx::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255), gfx::Rect(rc.x+rc.w-(n-i)*boxsize, rc.y+rc.h-boxsize, boxsize, boxsize)); } } }
int Tabs::calcTabWidth(Tab* tab) { int border = 4*jguiscale(); #ifdef CLOSE_BUTTON_IN_EACH_TAB SkinTheme* theme = static_cast<SkinTheme*>(this->theme); int close_icon_w = theme->get_part(PART_WINDOW_CLOSE_BUTTON_NORMAL)->w; return (border + text_length(getFont(), tab->text.c_str()) + border + close_icon_w + border); #else return (border + text_length(getFont(), tab->text.c_str()) + border); #endif }
void Tabs::onPreferredSize(PreferredSizeEvent& ev) { SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme()); gfx::Size reqsize(0, theme->get_part(PART_TAB_BOTTOM_NORMAL)->height()); if (!m_list_of_tabs.empty()) { reqsize.h += theme->get_part(PART_TAB_FILLER)->height(); } ev.setPreferredSize(reqsize); }
void onSizeHint(SizeHintEvent& ev) override { SkinTheme* theme = static_cast<SkinTheme*>(this->theme()); ui::Style* style = theme->styles.newsItem(); setText(m_title); gfx::Size sz = theme->calcSizeHint(this, style); if (!m_desc.empty()) sz.h *= 5; ev.setSizeHint(gfx::Size(0, sz.h)); }
void Tabs::drawTab(BITMAP* bmp, JRect box, Tab* tab, int y_delta, bool selected) { // Is the tab outside the bounds of the widget? if (box->x1 >= this->rc->x2 || box->x2 <= this->rc->x1) return; SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme()); int text_color; int face_color; // Selected if (selected) { text_color = theme->get_tab_selected_text_color(); face_color = theme->get_tab_selected_face_color(); } // Non-selected else { text_color = theme->get_tab_normal_text_color(); face_color = theme->get_tab_normal_face_color(); } if (jrect_w(box) > 2) { theme->draw_bounds_nw(bmp, box->x1, box->y1+y_delta, box->x2-1, box->y2-1, (selected) ? PART_TAB_SELECTED_NW: PART_TAB_NORMAL_NW, face_color); jdraw_text(bmp, this->getFont(), tab->text.c_str(), box->x1+4*jguiscale(), (box->y1+box->y2)/2-text_height(this->getFont())/2+1 + y_delta, text_color, face_color, false, jguiscale()); } if (selected) { theme->draw_bounds_nw(bmp, box->x1, box->y2, box->x2-1, this->rc->y2-1, PART_TAB_BOTTOM_SELECTED_NW, theme->get_tab_selected_face_color()); } else { theme->draw_part_as_hline(bmp, box->x1, box->y2, box->x2-1, this->rc->y2-1, PART_TAB_BOTTOM_NORMAL); } #ifdef CLOSE_BUTTON_IN_EACH_TAB BITMAP* close_icon = theme->get_part(PART_WINDOW_CLOSE_BUTTON_NORMAL); set_alpha_blender(); draw_trans_sprite(doublebuffer, close_icon, box->x2-4*jguiscale()-close_icon->w, (box->y1+box->y2)/2-close_icon->h/2+1*jguiscale()); #endif }
EditorView::EditorView(EditorView::Type type) : View() , m_type(type) { SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); int l = theme->get_part(PART_EDITOR_SELECTED_W)->w; int t = theme->get_part(PART_EDITOR_SELECTED_N)->h; int r = theme->get_part(PART_EDITOR_SELECTED_E)->w; int b = theme->get_part(PART_EDITOR_SELECTED_S)->h; jwidget_set_border(this, l, t, r, b); hideScrollBars(); }
void Tabs::calcTabWidth(Tab* tab) { // Cache current tab text tab->text = tab->view->getTabText(); int border = 4*jguiscale(); #ifdef CLOSE_BUTTON_IN_EACH_TAB SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); int close_icon_w = theme->get_part(PART_WINDOW_CLOSE_BUTTON_NORMAL)->width(); tab->width = (border + getFont()->textLength(tab->text.c_str()) + border + close_icon_w + border); #else tab->width = (border + getFont()->textLength(tab->text.c_str()) + border); #endif }
EditorView::EditorView(EditorView::Type type) : View() , m_type(type) { SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); int l = theme->get_part(PART_EDITOR_SELECTED_W)->w; int t = theme->get_part(PART_EDITOR_SELECTED_N)->h; int r = theme->get_part(PART_EDITOR_SELECTED_E)->w; int b = theme->get_part(PART_EDITOR_SELECTED_S)->h; setBorder(gfx::Border(l, t, r, b)); setupScrollbars(); UIContext::instance()->settings()->addObserver(this); }
void ColorButton::onPaint(PaintEvent& ev) { Graphics* g = ev.getGraphics(); SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); gfx::Rect rc = getClientBounds(); gfx::Rect text; jwidget_get_texticon_info(this, NULL, &text, NULL, 0, 0, 0); ui::Color bg = getBgColor(); if (is_transparent(bg)) bg = theme->getColor(ThemeColor::Face); g->fillRect(bg, rc); app::Color color; // When the button is pushed, show the negative if (isSelected()) { color = app::Color::fromRgb(255-m_color.getRed(), 255-m_color.getGreen(), 255-m_color.getBlue()); } // When the button is not pressed, show the real color else color = m_color; draw_color_button(g, rc, true, true, true, true, true, true, true, true, m_pixelFormat, color, hasMouseOver(), false); // Draw text std::string str = m_color.toHumanReadableString(m_pixelFormat, app::Color::ShortHumanReadableString); setTextQuiet(str.c_str()); jwidget_get_texticon_info(this, NULL, &text, NULL, 0, 0, 0); ui::Color textcolor = ui::rgba(255, 255, 255); if (color.isValid()) textcolor = color_utils::blackandwhite_neg(ui::rgba(color.getRed(), color.getGreen(), color.getBlue())); g->drawString(getText(), textcolor, ColorNone, false, text.getOrigin() - getBounds().getOrigin()); }
bool EditorView::onProcessMessage(Message* msg) { switch (msg->type) { case JM_SETPOS: // This avoid the displacement of the widgets in the viewport jrect_copy(this->rc, &msg->setpos.rect); updateView(); return true; case JM_DRAW: { Widget* viewport = getViewport(); Widget* child = reinterpret_cast<JWidget>(jlist_first_data(viewport->children)); JRect pos = jwidget_get_rect(this); SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); bool selected = false; switch (m_type) { // Only show the view selected if it is the current editor case CurrentEditorMode: selected = (child == current_editor); break; // Always show selected case AlwaysSelected: selected = true; break; } theme->draw_bounds_nw(ji_screen, pos->x1, pos->y1, pos->x2-1, pos->y2-1, selected ? PART_EDITOR_SELECTED_NW: PART_EDITOR_NORMAL_NW, false); jrect_free(pos); } return true; } return View::onProcessMessage(msg); }
void onSetDecorativeWidgetBounds() override { SkinTheme* theme = static_cast<SkinTheme*>(this->theme()); Widget* window = parent(); gfx::Rect rect(0, 0, 0, 0); gfx::Size playSize = this->sizeHint(); gfx::Size closeSize = theme->calcSizeHint(this, theme->styles.windowCloseButton()); gfx::Border margin(0, 0, 0, 0); rect.w = playSize.w; rect.h = playSize.h; rect.offset(window->bounds().x2() - theme->styles.windowCloseButton()->margin().width() - closeSize.w - style()->margin().right() - playSize.w, window->bounds().y + style()->margin().top()); setBounds(rect); }
void onSetDecorativeWidgetBounds() override { SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); Widget* window = getParent(); gfx::Rect rect(0, 0, 0, 0); gfx::Size playSize = theme->get_part_size(PART_WINDOW_PLAY_BUTTON_NORMAL); gfx::Size closeSize = theme->get_part_size(PART_WINDOW_CLOSE_BUTTON_NORMAL); rect.w = playSize.w; rect.h = playSize.h; rect.offset(window->getBounds().x2() - 3*guiscale() - playSize.w - 1*guiscale() - closeSize.w, window->getBounds().y + 3*guiscale()); setBounds(rect); }
bool ColorBar::ScrollableView::onProcessMessage(Message* msg) { switch (msg->type) { case JM_DRAW: { SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); theme->draw_bounds_nw(ji_screen, rc->x1, rc->y1, rc->x2-1, rc->y2-1, hasFocus() ? PART_EDITOR_SELECTED_NW: PART_EDITOR_NORMAL_NW, ColorNone); } return true; } return View::onProcessMessage(msg); }
void Tabs::drawTab(Graphics* g, const gfx::Rect& box, Tab* tab, int y_delta, bool selected) { // Is the tab outside the bounds of the widget? if (box.x >= getBounds().x2() || box.x2() <= getBounds().x) return; SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme()); gfx::Color text_color; gfx::Color face_color; // Selected if (selected) { text_color = theme->getColor(ThemeColor::TabSelectedText); face_color = theme->getColor(ThemeColor::TabSelectedFace); } // Non-selected else { text_color = theme->getColor(ThemeColor::TabNormalText); face_color = theme->getColor(ThemeColor::TabNormalFace); } if (box.w > 2) { theme->draw_bounds_nw(g, gfx::Rect(box.x, box.y+y_delta, box.w, box.h), (selected) ? PART_TAB_SELECTED_NW: PART_TAB_NORMAL_NW, face_color); g->drawString(tab->text, text_color, gfx::ColorNone, gfx::Point( box.x + 4*jguiscale(), box.y + box.h/2 - getFont()->height()/2+1 + y_delta)); } if (selected) { theme->draw_bounds_nw(g, gfx::Rect(box.x, box.y2(), box.w, getBounds().y2()-box.y2()), PART_TAB_BOTTOM_SELECTED_NW, theme->getColor(ThemeColor::TabSelectedFace)); } else { theme->draw_part_as_hline(g, gfx::Rect(box.x, box.y2(), box.w, getBounds().y2()-box.y2()), PART_TAB_BOTTOM_NORMAL); } #ifdef CLOSE_BUTTON_IN_EACH_TAB she::Surface* close_icon = theme->get_part(PART_WINDOW_CLOSE_BUTTON_NORMAL); g->drawRgbaSurface(close_icon, box.x2() - 4*jguiscale() - close_icon->width(), box.y + box.h/2 - close_icon->height()/2+1 * jguiscale()); #endif }
void onPaint(PaintEvent& ev) override { SkinTheme* theme = static_cast<SkinTheme*>(this->theme()); Graphics* g = ev.graphics(); gfx::Rect bounds = clientBounds(); ui::Style* style = theme->styles.newsItem(); ui::Style* styleDetail = theme->styles.newsItemDetail(); setText(m_title); gfx::Size textSize = theme->calcSizeHint(this, style); gfx::Rect textBounds(bounds.x, bounds.y, bounds.w, textSize.h); gfx::Rect detailsBounds( bounds.x, bounds.y+textSize.h, bounds.w, bounds.h-textSize.h); theme->paintWidget(g, this, style, textBounds); setText(m_desc); theme->paintWidget(g, this, styleDetail, detailsBounds); }
void SearchEntry::onPaint(ui::PaintEvent& ev) { SkinTheme* theme = static_cast<SkinTheme*>(this->theme()); theme->paintEntry(ev); auto icon = theme->parts.iconSearch()->bitmap(0); Rect bounds = clientBounds(); ev.graphics()->drawColoredRgbaSurface( icon, theme->colors.text(), bounds.x + border().left(), bounds.y + bounds.h/2 - icon->height()/2); if (!text().empty()) { icon = theme->parts.iconClose()->bitmap(0); ev.graphics()->drawColoredRgbaSurface( icon, theme->colors.text(), bounds.x + bounds.w - border().right() - childSpacing() - icon->width(), bounds.y + bounds.h/2 - icon->height()/2); } }
bool ColorBar::ScrollableView::onProcessMessage(Message* msg) { switch (msg->type) { case JM_DRAW: { Viewport* viewport = getViewport(); Widget* child = reinterpret_cast<Widget*>(jlist_first_data(viewport->children)); SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); theme->draw_bounds_nw(ji_screen, rc->x1, rc->y1, rc->x2-1, rc->y2-1, hasFocus() ? PART_EDITOR_SELECTED_NW: PART_EDITOR_NORMAL_NW, false); } return true; } return View::onProcessMessage(msg); }
void draw_color_button(BITMAP* bmp, const Rect& rc, bool outer_nw, bool outer_n, bool outer_ne, bool outer_e, bool outer_se, bool outer_s, bool outer_sw, bool outer_w, PixelFormat pixelFormat, const Color& color, bool hot, bool drag) { SkinTheme* theme = (SkinTheme*)CurrentTheme::get(); int scale = jguiscale(); // Draw background (the color) draw_color(bmp, Rect(rc.x+1*jguiscale(), rc.y+1*jguiscale(), rc.w-((outer_e) ? 2*jguiscale(): 1*jguiscale()), rc.h-((outer_s) ? 2*jguiscale(): 1*jguiscale())), pixelFormat, color); // Draw opaque border { int parts[8] = { outer_nw ? PART_COLORBAR_0_NW: PART_COLORBAR_3_NW, outer_n ? PART_COLORBAR_0_N : PART_COLORBAR_2_N, outer_ne ? PART_COLORBAR_1_NE: (outer_e ? PART_COLORBAR_3_NE: PART_COLORBAR_2_NE), outer_e ? PART_COLORBAR_1_E : PART_COLORBAR_0_E, outer_se ? PART_COLORBAR_3_SE: (outer_s ? PART_COLORBAR_2_SE: (outer_e ? PART_COLORBAR_1_SE: PART_COLORBAR_0_SE)), outer_s ? PART_COLORBAR_2_S : PART_COLORBAR_0_S, outer_sw ? PART_COLORBAR_2_SW: (outer_s ? PART_COLORBAR_3_SW: PART_COLORBAR_1_SW), outer_w ? PART_COLORBAR_0_W : PART_COLORBAR_1_W, }; theme->draw_bounds_array(bmp, rc.x, rc.y, rc.x+rc.w-1, rc.y+rc.h-1, parts); } // Draw hot if (hot) { theme->draw_bounds_nw(bmp, rc.x, rc.y, rc.x+rc.w-1, rc.y+rc.h-1 - (outer_s ? 1*scale: 0), PART_COLORBAR_BORDER_HOTFG_NW); } }
void BackgroundRule::onPaint(ui::Graphics* g, const gfx::Rect& bounds, const char* text) { SkinTheme* theme = static_cast<SkinTheme*>(ui::CurrentTheme::get()); if (m_part && m_part->countBitmaps() > 0) { if (m_part->countBitmaps() == 1) { if (!gfx::is_transparent(m_color)) g->fillRect(m_color, bounds); she::Surface* bmp = m_part->bitmap(0); if (m_repeat == BackgroundRepeat::NO_REPEAT) { g->drawRgbaSurface(bmp, bounds.x, bounds.y); } else { ui::IntersectClip clip(g, bounds); if (!clip) return; for (int y=bounds.y; y<bounds.y2(); y+=bmp->height()) { for (int x=bounds.x; x<bounds.x2(); x+=bmp->width()) { g->drawRgbaSurface(bmp, x, y); if (m_repeat == BackgroundRepeat::REPEAT_Y) break; } if (m_repeat == BackgroundRepeat::REPEAT_X) break; } } } else if (m_part->countBitmaps() == 8) { theme->drawRect(g, bounds, m_part.get(), m_color); } } else if (!gfx::is_transparent(m_color)) { g->fillRect(m_color, bounds); } }
void ToolBar::ToolStrip::onPaint(PaintEvent& ev) { Graphics* g = ev.getGraphics(); SkinTheme* theme = static_cast<SkinTheme*>(getTheme()); ToolBox* toolbox = App::instance()->getToolBox(); Rect toolrc; int index = 0; for (ToolIterator it = toolbox->begin(); it != toolbox->end(); ++it) { Tool* tool = *it; if (tool->getGroup() == m_group) { gfx::Color face; int nw; if (UIContext::instance()->settings()->getCurrentTool() == tool || m_hotTool == tool) { nw = PART_TOOLBUTTON_HOT_NW; face = theme->getColor(ThemeColor::ButtonHotFace); } else { nw = PART_TOOLBUTTON_LAST_NW; face = theme->getColor(ThemeColor::ButtonNormalFace); } toolrc = getToolBounds(index++); toolrc.offset(-getBounds().x, -getBounds().y); theme->draw_bounds_nw(g, toolrc, nw, face); // Draw the tool icon she::Surface* icon = theme->get_toolicon(tool->getId().c_str()); if (icon) { g->drawRgbaSurface(icon, toolrc.x+toolrc.w/2-icon->width()/2, toolrc.y+toolrc.h/2-icon->height()/2); } } } }