TextLineAdjuster::TextLineAdjuster(TextLine* textLine) : Patch(0), Observer() { LayoutKit* lkit = LayoutKit::instance(); adjustable_ = textLine; adjustable_->attach(Dimension_X, this); adjustable_->attach(Dimension_Y, this); updating_ = false; have_ = false; box_ = lkit->hbox(textLine); body(box_); }
ChoiceItem* MonoKitImpl::make_mover(TelltaleState* t, Beveler b) { const MonoKitInfo& i = *info_; Coord m = 2.0; Glyph* enabled = layout_->margin( new Bevel(nil, b, i.light(), i.flat(), i.dark(), i.thickness()), m ); Glyph* active = layout_->margin( new Bevel(nil, b, i.dark(), i.flat(), i.light(), i.thickness()), m ); Glyph* disabled = new MonoKitForeground(enabled, i.gray_out()); return new ChoiceItem( t, disabled, enabled, enabled, active, active, enabled, active, active, active, disabled ); }
void TextLineAdjuster::addButtons() { WidgetKit* kit = WidgetKit::instance(); LayoutKit* lkit = LayoutKit::instance(); Style* style = kit->style(); Stepper* left = kit->left_mover(adjustable_); Stepper* right = kit->right_mover(adjustable_); Coord mover_size = 15.0; style->find_attribute("mover_size", mover_size); box_->prepend(lkit->h_fixed_span(left, mover_size)); box_->append(lkit->h_fixed_span(right, mover_size)); }
Text31::Text31 ( const Font* f, const Color* fg, const char* text, Transformer* tx ) { _stroke = fg; Resource::ref(_stroke); _font = f; Resource::ref(_font); _t = new Transformer; if (tx != nil) { *_t = *tx; } _fill = fg; /* a hack */ _text = nil; if (text != nil) { _text = new String(text); } LayoutKit* layout = LayoutKit::instance(); _body = layout->overlay(); init(); }
ChoiceItem* MFKitImpl::make_toggle(TelltaleState* t, Beveler b, float scale) { const MFKitInfo& i = *info_; Coord box_size = kit_->font()->width('m') * scale; Glyph* box = layout_->fixed_span(nil, box_size, box_size); Glyph* toggle_out = new Bevel( box, b, i.light(), i.flat(), i.dark(), i.thickness(), false, false ); Glyph* toggle_in = new Bevel( box, b, i.dark(), i.dull(), i.light(), i.thickness(), false, false ); return new ChoiceItem( t, new MFKitForeground(toggle_out, i.gray_out()), toggle_out, toggle_out, toggle_in, toggle_in, toggle_in, toggle_in, toggle_in, toggle_in, new MFKitForeground(toggle_in, i.gray_out()) ); }
void Text31::init () { LayoutKit* layout = LayoutKit::instance(); PolyGlyph* col = layout->vbox(); PolyGlyph* line = layout->hbox(); FontBoundingBox bbox; _font->font_bbox(bbox); Coord lineheight = bbox.ascent() + bbox.descent(); char ch; for (int i = 0; (*_text)[i] != '\0'; i++) { ch = (*_text)[i]; if (ch == '\n') { line->append(layout->strut(_font)); col->append(layout->fixed_dimension(line, Dimension_Y,lineheight)); line = layout->hbox(); } else if (ch == ' ') { line->append(new Character(' ', _font, _stroke)); } else if (ch != ')' && ch != '(') { if (ch == '\\') { ch = (*_text)[++i]; if (isdigit(ch)) { ch -= '0'; ch *= 8; char digit; digit = (*_text)[i++]; ch = (ch * 8) + digit - '0'; digit = (*_text)[i++]; ch = (ch * 8) + digit - '0'; } } line->append(new Character(ch, _font, _stroke)); } } Transformer fixtext; fixtext.translate(0, bbox.descent()); _t->premultiply(fixtext); _body->append(col); }
PolyGraphic::PolyGraphic (Graphic31* gr) : Graphic31 (gr) { LayoutKit* layout = LayoutKit::instance(); _body = layout->overlay(); }