Thread View: comp.windows.interviews
1 messages
1 total messages
Started by Bill Poitras
Tue, 12 Jan 1993 19:09
Re: Scrolling
Author: Bill Poitras
Date: Tue, 12 Jan 1993 19:09
Date: Tue, 12 Jan 1993 19:09
89 lines
2869 bytes
2869 bytes
A couple people have asked for me for an example of a string selector. Here is the code in my stuff. It may not be usable out the box, but should be enought to get you started.
--
Telltale* timsStringSelectorImpl::makeTelltale(
const char* str, TelltaleState* ts)
{
WidgetKit* kit = WidgetKit::instance();
kit->style(_style);
LayoutKit* layout = LayoutKit::instance();
Glyph* label = new Target(
layout->h_margin(
kit->fancy_label(str),
3.0, 0.0, 0.0, 15.0, fil, 0.0
),
TargetPrimitiveHit
);
Telltale* telltale = new ChoiceItem(
ts,
label,
kit->bright_inset_frame(label)
);
return telltale;
}
//
void timsStringSelectorImpl::make()
{
LayoutKit* layout = LayoutKit::instance();
WidgetKit* kit = WidgetKit::instance();
kit->style(_style);
const Font* f = kit->font();
FontBoundingBox fbox;
f->font_bbox(fbox);
long r = 10;
(void)getAttribute("rows",r);
Coord height = r * ( fbox.ascent() + fbox.descent()) + 1.0;
long w = 10;
(void)getAttribute("columns",w);
Coord width = w * fbox.width();
long s = -1;
if (_browser != nil)
s = _browser->selected();
_browser = new FileBrowser(
kit,
new ActionCallback(timsStringSelectorImpl)(
this, &timsStringSelectorImpl::accept
),
new ActionCallback(timsStringSelectorImpl)(
this, &timsStringSelectorImpl::reject
)
);
for (ListUpdater(StringList) i(*_list);i.more();i.next())
{
TelltaleState* ts = new TelltaleState(TelltaleState::is_enabled);
Telltale* t = makeTelltale(i.cur(),ts);
_browser->append_selectable(ts);
_browser->append(t);
}
_browser->select(s);
Glyph* g = layout->hbox(
layout->vcenter(
kit->inset_frame(
layout->margin(
layout->natural_span(_browser, width, height), 1.0
)
),
1.0
),
kit->inset_frame( kit->vscroll_bar(_browser->adjustable()))
);
body(g);
}
--
+-----------------+-------------------------------+-------------------------+
| Bill Poitras | Molecular Simulations Inc. | Tel (408)522-9229 |
| (bill) | Sunnyvale, CA USA | |
| | FAX (408)732-0831 | bill@west.msi.com |
+-----------------+-------------------------------+-------------------------+
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads