本文整理汇总了C++中SkinTheme::get_toolicon方法的典型用法代码示例。如果您正苦于以下问题:C++ SkinTheme::get_toolicon方法的具体用法?C++ SkinTheme::get_toolicon怎么用?C++ SkinTheme::get_toolicon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkinTheme
的用法示例。
在下文中一共展示了SkinTheme::get_toolicon方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onPaint
void StatusBar::onPaint(ui::PaintEvent& ev)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
gfx::Color textColor = theme->getColorById(kStatusBarText);
Rect rc = getClientBounds();
Graphics* g = ev.getGraphics();
g->fillRect(getBgColor(), rc);
rc.shrink(Border(2, 1, 2, 2)*guiscale());
int x = rc.x + 4*guiscale();
// Color
if (m_state == SHOW_COLOR) {
// Draw eyedropper icon
she::Surface* icon = theme->get_toolicon("eyedropper");
if (icon) {
g->drawRgbaSurface(icon, x, rc.y + rc.h/2 - icon->height()/2);
x += icon->width() + 4*guiscale();
}
// Draw color
draw_color_button(g, gfx::Rect(x, rc.y, 32*guiscale(), rc.h),
m_color, false, false);
x += (32+4)*guiscale();
// Draw color description
std::string str = m_color.toHumanReadableString(app_get_current_pixel_format(),
app::Color::LongHumanReadableString);
if (m_alpha < 255) {
char buf[256];
sprintf(buf, " \xCE\xB1%d", m_alpha);
str += buf;
}
g->drawString(str, textColor, ColorNone,
gfx::Point(x, rc.y + rc.h/2 - getFont()->height()/2));
x += getFont()->textLength(str.c_str()) + 4*guiscale();
}
// Show tool
if (m_state == SHOW_TOOL) {
// Draw eyedropper icon
she::Surface* icon = theme->get_toolicon(m_tool->getId().c_str());
if (icon) {
g->drawRgbaSurface(icon, x, rc.y + rc.h/2 - icon->height()/2);
x += icon->width() + 4*guiscale();
}
}
// Status bar text
if (getTextLength() > 0) {
g->drawString(getText(), textColor, ColorNone,
gfx::Point(x, rc.y + rc.h/2 - getFont()->height()/2));
x += getFont()->textLength(getText().c_str()) + 4*guiscale();
}
}
示例2: onPaint
void ToolBar::onPaint(ui::PaintEvent& ev)
{
gfx::Rect bounds = getClientBounds();
Graphics* g = ev.getGraphics();
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
gfx::Color normalFace = theme->getColor(ThemeColor::ButtonNormalFace);
gfx::Color hotFace = theme->getColor(ThemeColor::ButtonHotFace);
ToolBox* toolbox = App::instance()->getToolBox();
ToolGroupList::iterator it = toolbox->begin_group();
int groups = toolbox->getGroupsCount();
Rect toolrc;
g->fillRect(theme->getColor(ThemeColor::TabSelectedFace), bounds);
for (int c=0; c<groups; ++c, ++it) {
ToolGroup* tool_group = *it;
Tool* tool = m_selectedInGroup[tool_group];
gfx::Color face;
int nw;
if (UIContext::instance()->settings()->getCurrentTool() == tool ||
m_hotIndex == c) {
nw = PART_TOOLBUTTON_HOT_NW;
face = hotFace;
}
else {
nw = c >= 0 && c < groups-1 ? PART_TOOLBUTTON_NORMAL_NW:
PART_TOOLBUTTON_LAST_NW;
face = normalFace;
}
toolrc = getToolGroupBounds(c);
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);
}
}
// Draw button to show tool configuration
toolrc = getToolGroupBounds(ConfigureToolIndex);
toolrc.offset(-getBounds().x, -getBounds().y);
bool isHot = (m_hotIndex == ConfigureToolIndex);
theme->draw_bounds_nw(g,
toolrc,
isHot ? PART_TOOLBUTTON_HOT_NW:
PART_TOOLBUTTON_LAST_NW,
isHot ? hotFace: normalFace);
she::Surface* icon = theme->get_toolicon("configuration");
if (icon) {
g->drawRgbaSurface(icon,
toolrc.x+toolrc.w/2-icon->width()/2,
toolrc.y+toolrc.h/2-icon->height()/2);
}
// Draw button to show/hide mini editor
toolrc = getToolGroupBounds(MiniEditorVisibilityIndex);
toolrc.offset(-getBounds().x, -getBounds().y);
isHot = (m_hotIndex == MiniEditorVisibilityIndex ||
App::instance()->getMainWindow()->getMiniEditor()->isMiniEditorEnabled());
theme->draw_bounds_nw(g,
toolrc,
isHot ? PART_TOOLBUTTON_HOT_NW:
PART_TOOLBUTTON_LAST_NW,
isHot ? hotFace: normalFace);
icon = theme->get_toolicon("minieditor");
if (icon) {
g->drawRgbaSurface(icon,
toolrc.x+toolrc.w/2-icon->width()/2,
toolrc.y+toolrc.h/2-icon->height()/2);
}
}
示例3: onPaint
void StatusBar::onPaint(ui::PaintEvent& ev)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
ui::Color textColor = theme->getColorById(kStatusBarText);
Rect rc = getClientBounds();
Graphics* g = ev.getGraphics();
g->fillRect(getBgColor(), rc);
rc.shrink(Border(2, 1, 2, 2)*jguiscale());
int x = rc.x + 4*jguiscale();
// Color
if (m_state == SHOW_COLOR) {
// Draw eyedropper icon
BITMAP* icon = theme->get_toolicon("eyedropper");
if (icon) {
g->drawAlphaBitmap(icon, x, rc.y + rc.h/2 - icon->h/2);
x += icon->w + 4*jguiscale();
}
// Draw color
draw_color_button(g, gfx::Rect(x, rc.y, 32*jguiscale(), rc.h),
true, true, true, true,
true, true, true, true,
app_get_current_pixel_format(), m_color,
false, false);
x += (32+4)*jguiscale();
// Draw color description
std::string str = m_color.toHumanReadableString(app_get_current_pixel_format(),
app::Color::LongHumanReadableString);
if (m_alpha < 255) {
char buf[512];
usprintf(buf, ", Alpha %d", m_alpha);
str += buf;
}
g->drawString(str, textColor, ColorNone, false,
gfx::Point(x, rc.y + rc.h/2 - text_height(getFont())/2));
x += ji_font_text_len(getFont(), str.c_str()) + 4*jguiscale();
}
// Show tool
if (m_state == SHOW_TOOL) {
// Draw eyedropper icon
BITMAP* icon = theme->get_toolicon(m_tool->getId().c_str());
if (icon) {
g->drawAlphaBitmap(icon, x, rc.y + rc.h/2 - icon->h/2);
x += icon->w + 4*jguiscale();
}
}
// Status bar text
if (getTextLength() > 0) {
g->drawString(getText(), textColor, ColorNone, false,
gfx::Point(x, rc.y + rc.h/2 - text_height(getFont())/2));
x += ji_font_text_len(getFont(), getText().c_str()) + 4*jguiscale();
}
// Draw progress bar
if (!m_progress.empty()) {
int width = 64;
int x = rc.x2() - (width+4);
for (ProgressList::iterator it = m_progress.begin(); it != m_progress.end(); ++it) {
Progress* progress = *it;
theme->paintProgressBar(g,
gfx::Rect(x, rc.y, width, rc.h),
progress->getPos());
x -= width+4;
}
}
updateSubwidgetsVisibility();
}