Article View: comp.windows.interviews
Article #1125Re: How to display a composition?
From: Paul Calder
Date: Fri, 10 May 1991 19:20
Date: Fri, 10 May 1991 19:20
54 lines
2054 bytes
2054 bytes
Helen Chang asks about updating Compositions and offers some sample
code.
Compositions take a list of glyphs and break it into smaller pieces.
Then they build composite glyphs for each of the pieces. This
functionality is usually associated with formatting text; breaking
paragraphs into lines and lines into columns are classic applications
of Compositions.
Helen, I can't see why your example needs a Composition at all. If
you just want to display a column of Labels (and have the display
update when you add new items) then a simpler arrangement will
suffice. Something like this, perhaps...
========
class TestViewer : public MonoGlyph, public Handler {
public:
TestViewer(Font*, Color*);
virtual void event() {}
void item_append(Glyph* );
void update();
private:
Listener* _listener;
TBBox* _lines;
Patch* _textPatch;
};
TestViewer::TestViewer(Font* f, Color* fg)
: MonoGlyph(nil), Handler()
{
_lines = new TBBox();
_textPatch = new Patch(_lines);
_listener = new Listener(_textPatch, this);
_listener->sensor()->button(true, Event::any);
_listener->sensor()->key(true);
body(_listener);
}
void TestViewer::item_append(Glyph* g)
{ _lines->append(g);
}
void TestViewer::update()
{ _textPatch->reallocate();
}
--
Paul Calder
Computer Systems Lab
Stanford University
calder@lurch.stanford.edu
Technical Details
Message-ID:
<CALDER.91May10122016@uluru.stanford.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!mips!swrinde!elroy.jpl.nasa.gov!lll-winken!decwrl!stanford.edu!leland.Stanford.EDU!portia!calderReferences:
<9105101454.AA02649@rigel.csc.ti.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!mips!swrinde!elroy.jpl.nasa.gov!lll-winken!decwrl!stanford.edu!leland.Stanford.EDU!portia!calder From: calder@uluru.stanford.edu (Paul Calder) Newsgroups: comp.windows.interviews Subject: Re: How to display a composition? Message-ID: <CALDER.91May10122016@uluru.stanford.edu> Date: 10 May 91 19:20:16 GMT References: <9105101454.AA02649@rigel.csc.ti.com> Sender: news@leland.Stanford.EDU (Mr News) Reply-To: calder@lurch.stanford.edu Organization: Stanford University Lines: 54 In-Reply-To: sung@rigel.csc.ti.com's message of 10 May 91 14:54:25 GMT