本文整理汇总了C++中SkinTheme类的典型用法代码示例。如果您正苦于以下问题:C++ SkinTheme类的具体用法?C++ SkinTheme怎么用?C++ SkinTheme使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SkinTheme类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onPaint
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());
}
示例2: draw_color_button
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());
}
}
示例3: onPaint
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);
}
}
示例4: 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);
}
}
示例5: getViewport
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);
}
示例6: getToolIconSize
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();
}
示例7: 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));
}
示例8: getClientBounds
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);
}
示例9: 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));
}
示例10:
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);
}
示例11: onPaint
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));
}
}
}
示例12: calcTabWidth
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
}
示例13: onPreferredSize
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);
}
示例14: onSizeHint
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));
}
示例15: drawTab
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
}