Added support for vertical separators:

- New PART_SEPARATOR_VERT in skin.
- New SkinneableTheme::draw_part_as_vline() function.
This commit is contained in:
David Capello 2010-04-25 15:02:28 -03:00
parent 162e3efd97
commit b8e49466ad
4 changed files with 39 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -87,7 +87,8 @@
<part id="mini_slider_empty" x="48" y="144" w1="5" w2="6" w3="5" h1="5" h2="5" h3="6" />
<part id="mini_slider_full_focused" x="32" y="160" w1="5" w2="6" w3="5" h1="5" h2="5" h3="6" />
<part id="mini_slider_empty_focused" x="48" y="160" w1="5" w2="6" w3="5" h1="5" h2="5" h3="6" />
<part id="separator" x="32" y="80" w="9" h="5" />
<part id="separator_horz" x="32" y="80" w="9" h="5" />
<part id="separator_vert" x="32" y="96" w="5" h="9" />
<part id="combobox_arrow" x="96" y="32" w="16" h="16" />
<part id="toolbutton_normal" x="96" y="0" w1="3" w2="10" w3="3" h1="3" h2="9" h3="4" />
<part id="toolbutton_hot" x="112" y="0" w1="3" w2="10" w3="3" h1="3" h2="9" h3="4" />

View File

@ -110,7 +110,8 @@ SkinneableTheme::SkinneableTheme()
sheet_mapping["mini_slider_empty"] = PART_MINI_SLIDER_EMPTY_NW;
sheet_mapping["mini_slider_full_focused"] = PART_MINI_SLIDER_FULL_FOCUSED_NW;
sheet_mapping["mini_slider_empty_focused"] = PART_MINI_SLIDER_EMPTY_FOCUSED_NW;
sheet_mapping["separator"] = PART_SEPARATOR;
sheet_mapping["separator_horz"] = PART_SEPARATOR_HORZ;
sheet_mapping["separator_vert"] = PART_SEPARATOR_VERT;
sheet_mapping["combobox_arrow"] = PART_COMBOBOX_ARROW;
sheet_mapping["toolbutton_normal"] = PART_TOOLBUTTON_NORMAL_NW;
sheet_mapping["toolbutton_hot"] = PART_TOOLBUTTON_HOT_NW;
@ -1049,7 +1050,15 @@ void SkinneableTheme::draw_separator(JWidget widget, JRect clip)
widget->rc->x1,
widget->rc->y1,
widget->rc->x2-1,
widget->rc->y2-1, PART_SEPARATOR);
widget->rc->y2-1, PART_SEPARATOR_HORZ);
}
if (widget->getAlign() & JI_VERTICAL) {
draw_part_as_vline(ji_screen,
widget->rc->x1,
widget->rc->y1,
widget->rc->x2-1,
widget->rc->y2-1, PART_SEPARATOR_VERT);
}
// text
@ -1649,6 +1658,29 @@ void SkinneableTheme::draw_part_as_hline(BITMAP* bmp, int x1, int y1, int x2, in
}
}
void SkinneableTheme::draw_part_as_vline(BITMAP* bmp, int x1, int y1, int x2, int y2, int part)
{
int y;
set_alpha_blender();
for (y = y1;
y <= y2-m_part[part]->h;
y += m_part[part]->h) {
draw_trans_sprite(bmp, m_part[part], x1, y);
}
if (y <= y2) {
int cx1, cy1, cx2, cy2;
get_clip_rect(bmp, &cx1, &cy1, &cx2, &cy2);
if (my_add_clip_rect(bmp, x1, y, x1+m_part[part]->w-1, y2))
draw_trans_sprite(bmp, m_part[part], x1, y);
set_clip_rect(bmp, cx1, cy1, cx2, cy2);
}
}
void SkinneableTheme::draw_bevel_box(int x1, int y1, int x2, int y2, int c1, int c2, int *bevel)
{
hline(ji_screen, x1+bevel[0], y1, x2-bevel[1], c1); /* top */

View File

@ -238,7 +238,8 @@ enum {
PART_MINI_SLIDER_EMPTY_FOCUSED_SW,
PART_MINI_SLIDER_EMPTY_FOCUSED_W,
PART_SEPARATOR,
PART_SEPARATOR_HORZ,
PART_SEPARATOR_VERT,
PART_COMBOBOX_ARROW,
@ -490,6 +491,7 @@ public:
void draw_bounds_nw(BITMAP* bmp, int x1, int y1, int x2, int y2, int nw, int bg = -1);
void draw_bounds_nw2(BITMAP* bmp, int x1, int y1, int x2, int y2, int x_mid, int nw1, int nw2, int bg1, int bg2);
void draw_part_as_hline(BITMAP* bmp, int x1, int y1, int x2, int y2, int part);
void draw_part_as_vline(BITMAP* bmp, int x1, int y1, int x2, int y2, int part);
// Wrapper to use the new "Rect" class (x, y, w, h)
void draw_bounds_nw(BITMAP* bmp, const Rect& rc, int nw, int bg) {