Re: [UFO-devel] Better position management using ufo/glut
Status: Beta
Brought to you by:
schmidtjf
From: Johannes S. <sch...@us...> - 2006-03-05 19:03:21
|
On Saturday 04 March 2006 00:58, Elie `woe` BLETON wrote: > Hi ! > > Thanks for the quick answer. Here are the results of my attempts that > considered your first answers. I think I didn't quite get some points. > > Here they are: > > If you set the layout manager to a NULL pointer > > [UWidget::setLayout(NULL)], the child widgets will be position relatively > > to its parent. > > I assumed that the positionning you are referring to is the one > accessed UWidget::setLocation(int x, int y) (or UWidget::setBounds for > this matter). > I tried to apply the NULL layout to my root pane > (myContext->getRootPane()->setLayout(NULL)), giving arbitrary > coordinates like (42, 42) to my widgets. I doesn't really works as > expected, since the widgets simply disappear. If you do not use a layout manager, you have to specify both, location and size (well, perhaps this should be changed). For most cases, you want the widget to have the so called "preferred size", a computed value where the widget has the size to display all of its content. Try: widget->setSize(widget->getPreferredSize()); > Could you give me a bit more information on the (x,y) coordinate > system you are using (if I'm to trust the docs, (0,0) is top left of > the screen), or perhaps I'm missing some call to get that custom > positonning ? That's correct. (0,0) is the top left corner. > > > I'm looking for a way to get some colors inside the TextEdit > > > component, for "syntax highlighting" purposes. > > > > I'm sorry, this is on the ToDo-list, but there are more important things > > on it, too ... > > I'd be glad to contribute some code if you can provide me some > directions as to "where" to update the code. I assume it could inherit > from UTextEdit class since it could share many properties. Beside the > syntax analysis, perhaps could you provide some hint on "how" to apply > colors to parts of the text. All drawing is usually done using the graphics object. You can set the color (UGraphics::setColor), paint some primitives and text (UGraphics::drawString). > I looked a bit at the font rendered (both basic and ogl) without > seeing anything related to color, but I know from screenshots (alas) > that it's possible - but I'm very reluctant into using CSS styles to > apply the colors (could be heavy for syntax highlighting). > Despite looking at the code (I have no IDE but emacs, grep, less and a > shell - so no "nice" method tree ...), I still don't get to the part > where the widgets are actually *drawn* (UWidget::repaint() .. > UGraphics::? ... ?), and where I could specify the colors. UWidget::paintWidget is a virtual method which you might to overwrite to get your own look. paintWidget by default calls the appropriate style method to draw its background and content. Different text colors, e.g. for labels, are done via setForegroundColor (or setPalette). > > Well, actually, here comes some new questions, so I use your quotes to > > act as separators > > Regarding widgets, do you think I could make some use of glTranslateX > functions in some way or another to provide something a bit more > "dynamic" or "animated" ? If it's possible, where are the available > entry points to the widget drawing code (without having to mess with > UFO code) I do not know exactly what you mean with entry points, but UWidget::paint does the necessary set up of the graphics object and calls paintWidget and other methods to paint the widget and its children. Regards, Johannes |