🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.interviews
Article #1198

questions related fixedspan

#1198
From: "Helen Chang ", sung
Date: Wed, 22 May 1991 19:43
143 lines
3336 bytes
Question 1:

Suppose
	Glyph* in = ...;
	y is Dimension, and size is Coord.
	FixedSpan* out = new FixedSpan( in, y, size);

If the natural size of "in" is smaller than the "size" specified,
is "in" always lay in the middle of "out"?
How can I make "in" align to the top of the fixedspan?

Question 2:

Why is it the append of a LRBox to a FixedSpan only shown once (refer
to the h1 and h2 below)?  How can I make it display everything appended?

Thanks in advance.

Helen Chang


------- 
#include <InterViews/background.h>
#include <InterViews/box.h>
#include <InterViews/color.h>
#include <InterViews/font.h>

#include <InterViews/handler.h>
#include <InterViews/listener.h>
#include <InterViews/margin.h>
#include <InterViews/monoglyph.h>
#include <InterViews/patch.h>
#include <InterViews/sensor.h>

#include <InterViews/fixedspan.h>

#include <InterViews/glyph.h>
#include <InterViews/label.h>
#include <InterViews/window.h>
#include <InterViews/world.h>

#include <string.h>


class TestViewer : public MonoGlyph, public Handler {
public:
	TestViewer(Glyph*, Glyph*);
	void		update();
	void		event() { };
private:
	Listener*	_listener;
        FixedSpan*	_lines;
	Patch*		_textPatch;
};

TestViewer::TestViewer(Glyph* head, Glyph* tail)
	: MonoGlyph(nil), Handler()
{
	World* world	= World::current();
	Color* bg = world->background();
	_lines = new FixedSpan(
			 new TBBox(
			    head, 
			    tail
			    ),
			 Dimension_Y,
			 4.0*inch) ;

	_textPatch = new Patch(_lines);

	Coord side = 0.02 * inch;
	_listener = new Listener(
			new Background(
				new Margin(
					new TBBox(
					    _textPatch
					),
				    side + 1, 0,   side - 1,
				    side + 5, fil, side - 1,
				    side + 5, 0,   side - 1,
				    side + 1, 0,   side - 1
				    ),
				bg),
			this
		     );

	_listener->sensor()->button(true, Event::any);
	_listener->sensor()->key(true);

	body(_listener);
}


void TestViewer::update()
{
	_textPatch->reallocate();
	_textPatch->redraw();

}



static PropertyData props[] = {
    { nil }
};


static OptionDesc options[] = {
    { nil }
};


int main(int argc, char** argv)
{
	World world("Test", argc, argv, options, props);
	Font* f = world.font();
	Color* fg = world.foreground();
	Color* bg = world.background();

	Glyph* g1 = new Label("name", f, fg);
	Glyph* g2 = new Label("end", f, fg);


	LRBox* h1 = new LRBox(g1, g2);
	LRBox* h2 = new LRBox(g2, g1);
	TestViewer* viewer = new TestViewer(g1, g2);

	viewer->append(g1);
	viewer->append(g2);
	viewer->append(h1);
	viewer->append(h2);
	viewer->append(h1);
	viewer->append(h2);

	viewer->update();

	ApplicationWindow window(new Background(viewer, bg));

	window.map();
	world.run();
	return 0;
}
Technical Details
Message-ID: <9105221943.AA00468@rigel.csc.ti.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!stanford.edu!rigel.csc.ti.com!sung

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!stanford.edu!rigel.csc.ti.com!sung
From: sung@rigel.csc.ti.com ("Helen Chang ", sung@csc.ti.com)
Newsgroups: comp.windows.interviews
Subject: questions related fixedspan
Message-ID: <9105221943.AA00468@rigel.csc.ti.com>
Date: 22 May 91 19:43:26 GMT
Sender: news@shelby.stanford.edu (USENET News System)
Organization: Internet-USENET Gateway at Stanford University
Lines: 143