Attachment "tkLB8.patch" to
ticket [454303ff]
added by
dkf
2001-08-23 16:25:58.
*** tkListbox.c.org Sat Jan 18 23:54:36 1997
--- tkListbox.c Sun Jan 19 00:04:46 1997
***************
*** 167,172 ****
--- 167,173 ----
char *xScrollCmd; /* Command prefix for communicating with
* horizontal scrollbar. NULL means no command
* to issue. Malloc'ed. */
+ int justify; /* justification option */
int flags; /* Various flag bits: see below for
* definitions. */
} Listbox;
***************
*** 259,264 ****
--- 260,267 ----
{TK_CONFIG_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand",
DEF_LISTBOX_SCROLL_COMMAND, Tk_Offset(Listbox, yScrollCmd),
TK_CONFIG_NULL_OK},
+ {TK_CONFIG_JUSTIFY, "-justify", "justify", "Justify",
+ "left", Tk_Offset(Listbox, justify), TK_CONFIG_NULL_OK},
{TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
(char *) NULL, 0, 0}
};
***************
*** 415,420 ****
--- 418,424 ----
listPtr->takeFocus = NULL;
listPtr->xScrollCmd = NULL;
listPtr->yScrollCmd = NULL;
+ listPtr->justify = TK_JUSTIFY_LEFT;
listPtr->flags = 0;
Tk_SetClass(listPtr->tkwin, "Listbox");
***************
*** 1188,1195 ****
}
Tk_GetFontMetrics(listPtr->tkfont, &fm);
y += fm.ascent + listPtr->selBorderWidth;
! x = listPtr->inset + listPtr->selBorderWidth - elPtr->lBearing
! - listPtr->xOffset;
Tk_DrawChars(listPtr->display, pixmap, gc, listPtr->tkfont,
elPtr->text, elPtr->textLength, x, y);
--- 1192,1206 ----
}
Tk_GetFontMetrics(listPtr->tkfont, &fm);
y += fm.ascent + listPtr->selBorderWidth;
! if (listPtr->justify == TK_JUSTIFY_LEFT) {
! x = listPtr->inset + listPtr->selBorderWidth - elPtr->lBearing
! - listPtr->xOffset;
! } else if (listPtr->justify == TK_JUSTIFY_CENTER) {
! x = listPtr->selBorderWidth - elPtr->lBearing
! - listPtr->xOffset + (Tk_Width(tkwin) - elPtr->pixelWidth) / 2;
! } else {
! x = Tk_Width(tkwin) - 2*listPtr->inset - elPtr->pixelWidth;
! }
Tk_DrawChars(listPtr->display, pixmap, gc, listPtr->tkfont,
elPtr->text, elPtr->textLength, x, y);