本文整理汇总了C++中SkinTheme::get_part方法的典型用法代码示例。如果您正苦于以下问题:C++ SkinTheme::get_part方法的具体用法?C++ SkinTheme::get_part怎么用?C++ SkinTheme::get_part使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkinTheme
的用法示例。
在下文中一共展示了SkinTheme::get_part方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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);
}
示例2: 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);
}
示例3: View
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();
}
示例4: View
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);
}
示例5: 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
}
示例6: 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
}
示例7: 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
}
示例8: calcTabWidth
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
}
示例9: onProcessMessage
bool Tabs::onProcessMessage(Message* msg)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
switch (msg->type) {
case JM_REQSIZE:
msg->reqsize.w = 0; // msg->reqsize.h = 4 + jwidget_get_text_height(widget) + 5;
msg->reqsize.h =
theme->get_part(PART_TAB_FILLER)->h +
theme->get_part(PART_TAB_BOTTOM_NORMAL)->h;
return true;
case JM_SETPOS:
jrect_copy(this->rc, &msg->setpos.rect);
setScrollX(m_scrollX);
return true;
case JM_DRAW: {
BITMAP *doublebuffer = create_bitmap(jrect_w(&msg->draw.rect),
jrect_h(&msg->draw.rect));
JRect rect = jwidget_get_rect(this);
jrect_displace(rect, -msg->draw.rect.x1, -msg->draw.rect.y1);
JRect box = jrect_new(rect->x1-m_scrollX,
rect->y1,
rect->x1-m_scrollX+2*jguiscale(),
rect->y1+theme->get_part(PART_TAB_FILLER)->h);
clear_to_color(doublebuffer, theme->get_window_face_color());
theme->draw_part_as_hline(doublebuffer, box->x1, box->y1, box->x2-1, box->y2-1, PART_TAB_FILLER);
theme->draw_part_as_hline(doublebuffer, box->x1, box->y2, box->x2-1, rect->y2-1, PART_TAB_BOTTOM_NORMAL);
box->x1 = box->x2;
// For each tab...
TabsListIterator it, end = m_list_of_tabs.end();
for (it = m_list_of_tabs.begin(); it != end; ++it) {
Tab* tab = *it;
box->x2 = box->x1 + tab->width;
int x_delta = 0;
int y_delta = 0;
// Y-delta for animating tabs (intros and outros)
if (m_ani == ANI_ADDING_TAB && m_selected == tab) {
y_delta = (box->y2 - box->y1) * (ANI_ADDING_TAB_TICKS - m_ani_t) / ANI_ADDING_TAB_TICKS;
}
else if (m_ani == ANI_REMOVING_TAB && m_nextTabOfTheRemovedOne == tab) {
x_delta += m_removedTab->width - m_removedTab->width*(1.0-std::exp(-10.0 * m_ani_t / (double)ANI_REMOVING_TAB_TICKS));
x_delta = MID(0, x_delta, m_removedTab->width);
// Draw deleted tab
if (m_removedTab) {
JRect box2 = jrect_new(box->x1, box->y1, box->x1+x_delta, box->y2);
drawTab(doublebuffer, box2, m_removedTab, 0, false);
jrect_free(box2);
}
}
box->x1 += x_delta;
box->x2 += x_delta;
drawTab(doublebuffer, box, tab, y_delta, (tab == m_selected));
box->x1 = box->x2;
}
if (m_ani == ANI_REMOVING_TAB && m_nextTabOfTheRemovedOne == NULL) {
// Draw deleted tab
if (m_removedTab) {
int x_delta = m_removedTab->width - m_removedTab->width*(1.0-std::exp(-10.0 * m_ani_t / (double)ANI_REMOVING_TAB_TICKS));
x_delta = MID(0, x_delta, m_removedTab->width);
JRect box2 = jrect_new(box->x1, box->y1, box->x1+x_delta, box->y2);
drawTab(doublebuffer, box2, m_removedTab, 0, false);
jrect_free(box2);
box->x1 += x_delta;
box->x2 = box->x1;
}
}
/* fill the gap to the right-side */
if (box->x1 < rect->x2) {
theme->draw_part_as_hline(doublebuffer, box->x1, box->y1, rect->x2-1, box->y2-1, PART_TAB_FILLER);
theme->draw_part_as_hline(doublebuffer, box->x1, box->y2, rect->x2-1, rect->y2-1, PART_TAB_BOTTOM_NORMAL);
}
jrect_free(rect);
jrect_free(box);
blit(doublebuffer, ji_screen, 0, 0,
msg->draw.rect.x1,
msg->draw.rect.y1,
doublebuffer->w,
doublebuffer->h);
//.........这里部分代码省略.........
示例10: onPaint
void Tabs::onPaint(PaintEvent& ev)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
Graphics* g = ev.getGraphics();
gfx::Rect rect = getClientBounds();
gfx::Rect box(rect.x-m_scrollX, rect.y,
2*jguiscale(),
m_list_of_tabs.empty() ? 0: theme->get_part(PART_TAB_FILLER)->height());
g->fillRect(theme->getColorById(kWindowFaceColorId), g->getClipBounds());
theme->draw_part_as_hline(g, box, PART_TAB_FILLER);
theme->draw_part_as_hline(g, gfx::Rect(box.x, box.y2(), box.w, rect.y2()-box.y2()), PART_TAB_BOTTOM_NORMAL);
box.x = box.x2();
// For each tab...
TabsListIterator it, end = m_list_of_tabs.end();
for (it = m_list_of_tabs.begin(); it != end; ++it) {
Tab* tab = *it;
box.w = tab->width;
int x_delta = 0;
int y_delta = 0;
// Y-delta for animating tabs (intros and outros)
if (m_ani == ANI_ADDING_TAB && m_selected == tab) {
y_delta = box.h * (ANI_ADDING_TAB_TICKS - m_ani_t) / ANI_ADDING_TAB_TICKS;
}
else if (m_ani == ANI_REMOVING_TAB && m_nextTabOfTheRemovedOne == tab) {
x_delta += m_removedTab->width - m_removedTab->width*(1.0-std::exp(-10.0 * m_ani_t / (double)ANI_REMOVING_TAB_TICKS));
x_delta = MID(0, x_delta, m_removedTab->width);
// Draw deleted tab
if (m_removedTab) {
gfx::Rect box2(box.x, box.y, x_delta, box.h);
drawTab(g, box2, m_removedTab, 0, false);
}
}
box.x += x_delta;
drawTab(g, box, tab, y_delta, (tab == m_selected));
box.x = box.x2();
}
if (m_ani == ANI_REMOVING_TAB && m_nextTabOfTheRemovedOne == NULL) {
// Draw deleted tab
if (m_removedTab) {
int x_delta = m_removedTab->width - m_removedTab->width*(1.0-std::exp(-10.0 * m_ani_t / (double)ANI_REMOVING_TAB_TICKS));
x_delta = MID(0, x_delta, m_removedTab->width);
gfx::Rect box2(box.x, box.y, x_delta, box.h);
drawTab(g, box2, m_removedTab, 0, false);
box.x += x_delta;
box.w = 0;
}
}
// Fill the gap to the right-side
if (box.x < rect.x2()) {
theme->draw_part_as_hline(g, gfx::Rect(box.x, box.y, rect.x2()-box.x, box.h), PART_TAB_FILLER);
theme->draw_part_as_hline(g, gfx::Rect(box.x, box.y2(), rect.x2()-box.x, rect.y2()-box.y2()), PART_TAB_BOTTOM_NORMAL);
}
}