🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.interviews
Article #329

Requisition and Allocation

#329
From: John Lu
Date: Wed, 15 Apr 1992 09:06
67 lines
2634 bytes
Looks like that building GUI components in IV-3.x is getting quite easy now.

However, I am still struggling w/ drawing multiple glyphs. In particular, I
am experimenting with objects provided in doc/Figure.[ch]. It seems to me
that each glyph is specified in its own "modelling coordinate system",
drawing a _single_ glyph onto the window is just a mapping of this "world
window" onto the canvas viewport(allocation, or perhaps extension). As a
result, specifying the "position" of a glyph deos not make difference in the
graphical output.  This can be demonstrated clearly by the following short 
program using a Circle as example(one has to take another glyph out). 

To model two circles in the world with some relative position, it is wrong
to mix the composition mechanisms such as vbox, hbox etc. wtih the
"world" modeling coordinate system. See the attached example.

Now, my question is that is it possbile to  map a 2D world model 
consisting of multiple objects  onto the screen reasonably easy 
w/o resorting to 2.6 Unidraw ? Could anyone shed some lights or 
better show me some simple working examples ?

Thanks for your help,

-- John

// --- cut here ----
#include <InterViews/session.h>
#include <InterViews/style.h>
#include <InterViews/window.h>
#include <InterViews/background.h>
#include <InterViews/brush.h>
#include <InterViews/layout.h>
#include <IV-look/kit.h>
#include "Figure.h"

int main(int argc, char** argv) {
    Session* session = new Session("Himom", argc, argv);
    Style* style = session->style();
    LayoutKit* layout = LayoutKit::instance();
    Brush* brush = new Brush(1.0);
    session->run_window(
	new ApplicationWindow(
	    new Background(
		layout->variable_span(
		    layout->vbox(
			new Circle(
			    brush, 
			    style->foreground(),
			    nil,
			    -100, -50, 100 // x = -100, y = -50, r = 100
			),
			new Circle(
			    brush, 
			    style->foreground(),
			    nil,
			    -50, -25, 50
			)
		    )
		),
		style->background()
	    )
	)
    );
}
// --- cut here ----
--
-- John Lu 
   luj@ecn.purdue.edu
Technical Details
Message-ID: <1992Apr15.090653.4013@noose.ecn.purdue.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!mips!pacbell.com!att!news.cs.indiana.edu!noose.ecn.purdue.edu!sanandreas.ecn.purdue.edu!luj

Show Full Headers
Complete Article Headers
Newsgroups: comp.windows.interviews
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!mips!pacbell.com!att!news.cs.indiana.edu!noose.ecn.purdue.edu!sanandreas.ecn.purdue.edu!luj
From: luj@sanandreas.ecn.purdue.edu (John Lu)
Subject: Requisition and Allocation
Message-ID: <1992Apr15.090653.4013@noose.ecn.purdue.edu>
Sender: news@noose.ecn.purdue.edu (USENET news)
Cc: dwwhite, luj
Organization: Purdue University Engineering Computing Network
Distribution: usa
Date: Wed, 15 Apr 1992 09:06:53 GMT
Lines: 67