本文整理汇总了C++中SkinTheme::getColor方法的典型用法代码示例。如果您正苦于以下问题:C++ SkinTheme::getColor方法的具体用法?C++ SkinTheme::getColor怎么用?C++ SkinTheme::getColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkinTheme
的用法示例。
在下文中一共展示了SkinTheme::getColor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getClientBounds
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);
}
}
示例2: onInitTheme
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));
}
示例3: drawTab
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
}
示例4: Box
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));
}
示例5: getToolBounds
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);
}
}
}
}
示例6: onPaint
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());
}
示例7: 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);
}
}
示例8: onPaint
void FileList::onPaint(ui::PaintEvent& ev)
{
Graphics* g = ev.getGraphics();
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
View* view = View::getView(this);
gfx::Rect vp = view->getViewportBounds();
gfx::Rect bounds = getClientBounds();
int x, y = bounds.y;
int evenRow = 0;
gfx::Color bgcolor;
gfx::Color fgcolor;
she::Surface* thumbnail = NULL;
int thumbnail_y = 0;
g->fillRect(theme->getColor(ThemeColor::Background), bounds);
// rows
for (FileItemList::iterator
it=m_list.begin(), end=m_list.end(); it!=end; ++it) {
IFileItem* fi = *it;
gfx::Size itemSize = getFileItemSize(fi);
if (fi == m_selected) {
fgcolor = theme->getColor(ThemeColor::FileListSelectedRowText);
bgcolor = theme->getColor(ThemeColor::FileListSelectedRowFace);
}
else {
bgcolor = evenRow ? theme->getColor(ThemeColor::FileListEvenRowFace):
theme->getColor(ThemeColor::FileListOddRowFace);
if (fi->isFolder() && !fi->isBrowsable())
fgcolor = theme->getColor(ThemeColor::FileListDisabledRowText);
else
fgcolor = evenRow ? theme->getColor(ThemeColor::FileListEvenRowText):
theme->getColor(ThemeColor::FileListOddRowText);
}
x = bounds.x+2*jguiscale();
// Item background
g->fillRect(bgcolor, gfx::Rect(bounds.x, y, bounds.w, itemSize.h));
if (fi->isFolder()) {
int icon_w = getFont()->textLength("[+]");
g->drawUIString("[+]", fgcolor, bgcolor, gfx::Point(x, y+2*jguiscale()));
x += icon_w+2*jguiscale();
}
// item name
g->drawString(
fi->getDisplayName().c_str(),
fgcolor, bgcolor, gfx::Point(x, y+2*jguiscale()));
// draw progress bars
double progress;
ThumbnailGenerator::WorkerStatus workerStatus =
ThumbnailGenerator::instance()->getWorkerStatus(fi, progress);
if (workerStatus == ThumbnailGenerator::WorkingOnThumbnail) {
int barw = 64*jguiscale();
theme->paintProgressBar(g,
gfx::Rect(
bounds.x2()-2*jguiscale()-barw,
y+itemSize.h/2-3*jguiscale(),
barw, 6*jguiscale()),
progress);
}
// Thumbnail position
if (fi == m_selected) {
thumbnail = fi->getThumbnail();
if (thumbnail)
thumbnail_y = y + itemSize.h/2;
}
y += itemSize.h;
evenRow ^= 1;
}
// Draw the thumbnail
if (thumbnail) {
x = vp.x+vp.w - 2*jguiscale() - thumbnail->width();
y = thumbnail_y - thumbnail->height()/2 + getBounds().y;
y = MID(vp.y+2*jguiscale(), y, vp.y+vp.h-3*jguiscale()-thumbnail->height());
x -= getBounds().x;
y -= getBounds().y;
g->blit(thumbnail, 0, 0, x, y, thumbnail->width(), thumbnail->height());
g->drawRect(gfx::rgba(0, 0, 0),
gfx::Rect(x-1, y-1, thumbnail->width()+1, thumbnail->height()+1));
}
}