Hi, On 5 May 2008, at 12:29, Per Inge Mathisen wrote: > On Mon, May 5, 2008 at 1:02 PM, Freddie Witherden > <[EMAIL PROTECTED]> wrote: >>> My suggestion is simply to make it snap to another widget (not >>> necessarily a parent, could be a sibling), and then provide an >>> (x, y) >>> constant offset from it in pixel independent values (millimeters?). >> >> Seems good. So we could say something like: >> >> widgetAdd(parent, child, northSnap, eastSnap, southSnap, westSnap); > > I was thinking more like widgetAdd(parentWidget, > frameOfReferenceWidget, side, offsetX, offsetY); > > Putting an icon in the lowest right side of the main window: > widgetAdd(screen, screen, BottomLeft, 10, 10); > Adding the third button in a row inside a window: widgetAdd(window, > second, Right, 20, 0);
We then have to make the assumption about the size of the first icon (that it is 10 units). This is basically what we have at the moment - adding widgets requires knowledge about the size of other widgets. Lets say at a later date we decide to make our icons a bit bigger, say 12 units. We then need to find all of our widgetAdd calls and fix them. Or am I missing something? >> Take a label widget for example, lets say it has worked out it needs >> to be *at least* 150 pixels large. > > I think we can safely assume that we have no or decide we shall have > no widgets with such pixel precise requirements. Models, text, and > textures can all scale to fit the allocated space. > >>> I would suggest specifying size exactly using a pixel independent >>> value (millimeter? permille of screen size?). >> >> On Linux this would work. This is because X computes the screen DPI >> on the fly. So a piece of 12pt text will be the same size on *all* >> linux systems. Windows assumes a DPI of 96, while OS X assumes >> one of >> 72. > > It is not that hard. > > ( pixel width of screen ) / CONSTANT = x factor > ( pixel height of screen) / CONSTANT = y factor > > We multiply all x, y values, which are in the range 0..CONSTANT, by > these factors and get resolution dependent values. We could even > decide to go the OpenGL way, and decide that the factor is 1.0 and > that x,y values are floating point. Nice idea. :) Regards, Freddie. _______________________________________________ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev