Added skin to scrollbar.

This commit is contained in:
David Capello 2010-06-24 00:09:46 -03:00
parent d6def8fcc4
commit 0467790bcf
4 changed files with 35 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -107,6 +107,8 @@
<part id="colorbar_border_fg" x="0" y="224" w1="5" w2="6" w3="5" h1="5" h2="6" h3="5" />
<part id="colorbar_border_bg" x="16" y="224" w1="5" w2="6" w3="5" h1="5" h2="6" h3="5" />
<part id="colorbar_border_hotfg" x="32" y="224" w1="5" w2="6" w3="5" h1="5" h2="6" h3="5" />
<part id="scrollbar_bg" x="64" y="144" w1="5" w2="6" w3="5" h1="5" h2="6" h3="5" />
<part id="scrollbar_thumb" x="64" y="160" w1="5" w2="6" w3="5" h1="5" h2="6" h3="5" />
</parts>
</skin>

View File

@ -130,6 +130,8 @@ SkinneableTheme::SkinneableTheme()
sheet_mapping["colorbar_border_fg"] = PART_COLORBAR_BORDER_FG_NW;
sheet_mapping["colorbar_border_bg"] = PART_COLORBAR_BORDER_BG_NW;
sheet_mapping["colorbar_border_hotfg"] = PART_COLORBAR_BORDER_HOTFG_NW;
sheet_mapping["scrollbar_bg"] = PART_SCROLLBAR_BG_NW;
sheet_mapping["scrollbar_thumb"] = PART_SCROLLBAR_THUMB_NW;
reload_skin();
}
@ -1324,20 +1326,19 @@ void SkinneableTheme::draw_view_scrollbar(JWidget widget, JRect clip)
x2 = widget->rc->x2-1;
y2 = widget->rc->y2-1;
/* border */
rect(ji_screen, x1, y1, x2, y2, BGCOLOR);
draw_bounds_nw(ji_screen,
x1, y1, x2, y2,
PART_SCROLLBAR_BG_NW,
get_scrollbar_bg_face_color());
/* draw the content */
x1++, y1++, x2--, y2--;
/* horizontal bar */
// Horizontal bar
if (widget->getAlign() & JI_HORIZONTAL) {
u1 = x1+pos;
v1 = y1;
u2 = x1+pos+len-1;
v2 = y2;
}
/* vertical bar */
// Vertical bar
else {
u1 = x1;
v1 = y1+pos;
@ -1345,25 +1346,10 @@ void SkinneableTheme::draw_view_scrollbar(JWidget widget, JRect clip)
v2 = y1+pos+len-1;
}
/* background */
jrectexclude(ji_screen,
x1, y1, x2, y2,
u1, v1, u2, v2, BGCOLOR);
/* 1st border */
if (jwidget_is_selected(widget))
jrectedge(ji_screen, u1, v1, u2, v2,
COLOR_DISABLED, COLOR_BACKGROUND);
else
jrectedge(ji_screen, u1, v1, u2, v2,
COLOR_BACKGROUND, COLOR_DISABLED);
/* bar-block background */
u1++, v1++, u2--, v2--;
if (jwidget_is_enabled(widget) && widget->hasMouseOver())
rectfill(ji_screen, u1, v1, u2, v2, COLOR_HOTFACE);
else
rectfill(ji_screen, u1, v1, u2, v2, BGCOLOR);
draw_bounds_nw(ji_screen,
u1, v1, u2, v2,
PART_SCROLLBAR_THUMB_NW,
get_scrollbar_thumb_face_color());
}
void SkinneableTheme::draw_view_viewport(JWidget widget, JRect clip)

View File

@ -382,6 +382,24 @@ enum {
PART_COLORBAR_BORDER_HOTFG_SW,
PART_COLORBAR_BORDER_HOTFG_W,
PART_SCROLLBAR_BG_NW,
PART_SCROLLBAR_BG_N,
PART_SCROLLBAR_BG_NE,
PART_SCROLLBAR_BG_E,
PART_SCROLLBAR_BG_SE,
PART_SCROLLBAR_BG_S,
PART_SCROLLBAR_BG_SW,
PART_SCROLLBAR_BG_W,
PART_SCROLLBAR_THUMB_NW,
PART_SCROLLBAR_THUMB_N,
PART_SCROLLBAR_THUMB_NE,
PART_SCROLLBAR_THUMB_E,
PART_SCROLLBAR_THUMB_SE,
PART_SCROLLBAR_THUMB_S,
PART_SCROLLBAR_THUMB_SW,
PART_SCROLLBAR_THUMB_W,
PARTS
};
@ -483,6 +501,9 @@ public:
int get_panel_face_color() const { return makecol(125, 146, 158); }
int get_scrollbar_bg_face_color() const { return makecol(125, 146, 158); }
int get_scrollbar_thumb_face_color() const { return makecol(199, 199, 199); }
BITMAP* get_part(int part_i) const { return m_part[part_i]; }
BITMAP* get_toolicon(const char* tool_id) const;