[email protected] wrote:
> What I'd like to do is make an Fl_Button with a 2 character
> label, rendering the first character in one font and the
> second in another. Possible?
If it is just a one-off, you could make a small image with the
two characters on it, and apply it as the button's image().
Otherwise, make a class MyButton that derives from Fl_Button,
and override the draw() method. Copy/paste the code for
Fl_Button::draw()
(from the fltk Fl_Button.cxx source file) into your widget, and
modify to taste, using fl_font() and fl_draw() to draw each character.
Looking at the draw() code from 1.3.x:
void Fl_Button::draw() {
if (type() == FL_HIDDEN_BUTTON) return;
Fl_Color col = value() ? selection_color() : color();
draw_box(value() ? (down_box()?down_box():fl_down(box())) : box(), col);
draw_backdrop();
if (labeltype() == FL_NORMAL_LABEL && value()) {
Fl_Color c = labelcolor();
labelcolor(fl_contrast(c, col));
draw_label();
labelcolor(c);
} else draw_label();
if (Fl::focus() == this) draw_focus();
}
..you'd want to take a copy of that code, and replace the draw_label()
calls with your own fl_color()/fl_font()/fl_draw() calls.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk