Center title vertically within border.
SVN revision: 33308
This commit is contained in:
parent
cc97b1393e
commit
e7ab7972c1
|
@ -112,7 +112,7 @@ BorderWinpartITclassApply(EWin * ewin, int i, int force)
|
|||
|
||||
ITApply(ewb->win, ewin->border->part[i].iclass, is,
|
||||
ewb->state, ewin->state.active, EoIsSticky(ewin),
|
||||
ST_BORDER, ewin->border->part[i].tclass, ts, txt);
|
||||
ST_BORDER, ewin->border->part[i].tclass, ts, txt, 1);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -262,7 +262,7 @@ static void
|
|||
ButtonDraw(Button * b)
|
||||
{
|
||||
ITApply(EoGetWin(b), b->iclass, NULL,
|
||||
b->state, 0, 0, ST_BUTTON, b->tclass, NULL, b->label);
|
||||
b->state, 0, 0, ST_BUTTON, b->tclass, NULL, b->label, 0);
|
||||
EoShapeUpdate(b, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ CoordsShow(EWin * ewin)
|
|||
EobjMap(eo, 0);
|
||||
}
|
||||
|
||||
ITApply(eo->win, ic, NULL, STATE_NORMAL, 1, 0, ST_SOLID, tc, NULL, s);
|
||||
ITApply(eo->win, ic, NULL, STATE_NORMAL, 1, 0, ST_SOLID, tc, NULL, s, 1);
|
||||
|
||||
if (md) /* Assuming that shape change only happens when size changes too */
|
||||
EobjShapeUpdate(eo, 0);
|
||||
|
|
|
@ -440,7 +440,7 @@ DialogDrawButton(Dialog * d __UNUSED__, DButton * db)
|
|||
else
|
||||
{
|
||||
ITApply(db->win, db->iclass, NULL, state, 0, 0,
|
||||
ST_WIDGET, db->tclass, NULL, db->text);
|
||||
ST_WIDGET, db->tclass, NULL, db->text, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1660,7 +1660,7 @@ DialogDrawItem(Dialog * d, DItem * di)
|
|||
else if (!(di->hilited) && (di->clicked))
|
||||
state = STATE_CLICKED;
|
||||
ITApply(di->win, di->iclass, NULL, state, 0, 0,
|
||||
ST_WIDGET, di->tclass, NULL, di->text);
|
||||
ST_WIDGET, di->tclass, NULL, di->text, 0);
|
||||
break;
|
||||
|
||||
case DITEM_AREA:
|
||||
|
|
|
@ -1165,7 +1165,7 @@ ImagestateDrawBevel(ImageState * is, Drawable win, GC gc, int w, int h)
|
|||
void
|
||||
ITApply(Win win, ImageClass * ic, ImageState * is,
|
||||
int state, int active, int sticky, int image_type,
|
||||
TextClass * tc, TextState * ts, const char *text)
|
||||
TextClass * tc, TextState * ts, const char *text, int flags)
|
||||
{
|
||||
int w, h;
|
||||
|
||||
|
@ -1212,7 +1212,7 @@ ITApply(Win win, ImageClass * ic, ImageState * is,
|
|||
|
||||
TextstateTextDraw(ts, win, pmap, text, 0, 0, w, h,
|
||||
&(ic->padding), 0,
|
||||
TextclassGetJustification(tc));
|
||||
TextclassGetJustification(tc), flags);
|
||||
}
|
||||
|
||||
/* Set window pixmap */
|
||||
|
@ -1261,7 +1261,8 @@ void
|
|||
ImageclassApply(ImageClass * ic, Win win, int active, int sticky, int state,
|
||||
int image_type)
|
||||
{
|
||||
ITApply(win, ic, NULL, state, active, sticky, image_type, NULL, NULL, NULL);
|
||||
ITApply(win, ic, NULL, state, active, sticky, image_type, NULL, NULL, NULL,
|
||||
0);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -121,6 +121,7 @@ EImage *ImageclassGetImageBlended(ImageClass * ic, Win win,
|
|||
int image_type);
|
||||
void ITApply(Win win, ImageClass * ic, ImageState * is,
|
||||
int state, int active, int sticky, int image_type,
|
||||
TextClass * tc, TextState * ts, const char *text);
|
||||
TextClass * tc, TextState * ts, const char *text,
|
||||
int flags);
|
||||
|
||||
#endif /* _ICLASS_H */
|
||||
|
|
|
@ -112,7 +112,7 @@ __EXPORT__ void TextstateTextFit(TextState * ts, char **ptext, int *pw,
|
|||
void TextstateTextDraw(TextState * ts, Win win, Drawable draw,
|
||||
const char *text, int x, int y, int w,
|
||||
int h, const EImageBorder * pad,
|
||||
int fsize, int justification);
|
||||
int fsize, int justh, int justv);
|
||||
void TextSize(TextClass * tclass, int active, int sticky,
|
||||
int state, const char *text, int *width,
|
||||
int *height, int fsize);
|
||||
|
|
23
src/text.c
23
src/text.c
|
@ -828,12 +828,12 @@ TextstateTextFit(TextState * ts, char **ptext, int *pw, int textwidth_limit)
|
|||
void
|
||||
TextstateTextDraw(TextState * ts, Win win, Drawable draw, const char *text,
|
||||
int x, int y, int w, int h, const EImageBorder * pad,
|
||||
int fsize __UNUSED__, int justification)
|
||||
int fsize __UNUSED__, int justh, int justv)
|
||||
{
|
||||
const char *str;
|
||||
char **lines;
|
||||
int i, num_lines;
|
||||
int textwidth_limit, offset_x, offset_y;
|
||||
int textwidth_limit, textheight_limit, offset_x, offset_y;
|
||||
int xx, yy, ww, hh, ascent;
|
||||
Pixmap drawable;
|
||||
|
||||
|
@ -865,6 +865,7 @@ TextstateTextDraw(TextState * ts, Win win, Drawable draw, const char *text,
|
|||
h -= pad->top + pad->bottom;
|
||||
}
|
||||
textwidth_limit = w;
|
||||
textheight_limit = h;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -876,11 +877,12 @@ TextstateTextDraw(TextState * ts, Win win, Drawable draw, const char *text,
|
|||
w -= pad->top + pad->bottom;
|
||||
}
|
||||
textwidth_limit = h;
|
||||
textheight_limit = w;
|
||||
}
|
||||
|
||||
#if 0
|
||||
Eprintf("TextstateTextDraw %d,%d %dx%d(%d): %s\n", x, y, w, h,
|
||||
textwidth_limit, text);
|
||||
Eprintf("TextstateTextDraw %d,%d %dx%d(%dx%d): %s\n", x, y, w, h,
|
||||
textwidth_limit, textheight_limit, text);
|
||||
#endif
|
||||
|
||||
xx = x;
|
||||
|
@ -900,9 +902,11 @@ TextstateTextDraw(TextState * ts, Win win, Drawable draw, const char *text,
|
|||
if (ww > textwidth_limit)
|
||||
ts->ops->TextFit(ts, &lines[i], &ww, textwidth_limit);
|
||||
|
||||
if (justv)
|
||||
yy += (textheight_limit - hh) / 2;
|
||||
if (i == 0)
|
||||
yy += ascent;
|
||||
xx = x + (((textwidth_limit - ww) * justification) >> 10);
|
||||
xx = x + (((textwidth_limit - ww) * justh) >> 10);
|
||||
|
||||
im = TextImageGet(win, draw, xx - 1, yy - 1 - ascent,
|
||||
ww + 2, hh + 2, ts);
|
||||
|
@ -931,9 +935,11 @@ TextstateTextDraw(TextState * ts, Win win, Drawable draw, const char *text,
|
|||
if (ww > textwidth_limit)
|
||||
ts->ops->TextFit(ts, &lines[i], &ww, textwidth_limit);
|
||||
|
||||
if (justv)
|
||||
yy += (textheight_limit - hh) / 2;
|
||||
if (i == 0)
|
||||
yy += ascent;
|
||||
xx = x + (((textwidth_limit - ww) * justification) >> 10);
|
||||
xx = x + (((textwidth_limit - ww) * justh) >> 10);
|
||||
|
||||
if (ts->style.orientation != FONT_TO_RIGHT)
|
||||
drawable = ECreatePixmap(win, ww + 2, hh + 2, 0);
|
||||
|
@ -976,7 +982,7 @@ TextstateTextDraw(TextState * ts, Win win, Drawable draw, const char *text,
|
|||
void
|
||||
TextDraw(TextClass * tclass, Win win, Drawable draw, int active, int sticky,
|
||||
int state, const char *text, int x, int y, int w, int h, int fsize,
|
||||
int justification)
|
||||
int justh)
|
||||
{
|
||||
TextState *ts;
|
||||
|
||||
|
@ -987,6 +993,5 @@ TextDraw(TextClass * tclass, Win win, Drawable draw, int active, int sticky,
|
|||
if (!ts)
|
||||
return;
|
||||
|
||||
TextstateTextDraw(ts, win, draw, text, x, y, w, h, NULL, fsize,
|
||||
justification);
|
||||
TextstateTextDraw(ts, win, draw, text, x, y, w, h, NULL, fsize, justh, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue