Thread: [UFO-devel] Better position management using ufo/glut
Status: Beta
Brought to you by:
schmidtjf
From: Elie `w. B. <dro...@gm...> - 2006-03-02 23:27:40
|
Hello everyone, I subscribed to this mailing lists for a week now and I didn't get any mail from it, so I'm quite surprised. I hope there are still some people left reading. I'm having problems getting libufo positioning my controls the way I want them. I can force the root pane (or the context ?) to take a subset of the GLUT area, but the controls inside of it are ordered automatically (well, it's possible to force the widgets to get displayed horizontally or vertically, but that's not what I'm looking for). I'm looking for a way to position them by hand, ideally in relative coordinates - but I can cope with absolute screen/context coordinates as well. On a different subject, I tried to use frames, but it seems they don't work in a glut context since any call to myWindow->createFrame() returns a NULL pointer. Is there a way to get this working, or is it simply impossible ? Last, I'm looking for a way to get some colors inside the TextEdit component, for "syntax highlighting" purposes. I have the feeling that I will have to code it myself some way, but if someone have some advice on the subject, I'd be glad to hear it. Thanks for your advices, -- Elie `woe` BLETON http://www.lwo-lab.net EPITA - B2 2009 - http://www.epita.fr |
From: Johannes S. <sch...@us...> - 2006-03-03 12:43:08
|
Hi, Am Freitag, 3. M=E4rz 2006 00:27 schrieb Elie `woe` BLETON: > I subscribed to this mailing lists for a week now and I didn't get any > mail from it, so I'm quite surprised.=20 I have to pass some of my degree exams these weeks, so I am quite busy. And some people still insist on writing emails directly to me :) > I hope there are still some people left reading. > > I'm having problems getting libufo positioning my controls the way I > want them. I can force the root pane (or the context ?) to take a > subset of the GLUT area, but the controls inside of it are ordered > automatically (well, it's possible to force the widgets to get > displayed horizontally or vertically, but that's not what I'm looking > for). I'm looking for a way to position them by hand, ideally in > relative coordinates - but I can cope with absolute screen/context > coordinates as well. If you set the layout manager to a NULL pointer [UWidget::setLayout(NULL)],= =20 the child widgets will be position relatively to its parent. > On a different subject, I tried to use frames, but it seems they don't > work in a glut context since any call to myWindow->createFrame() > returns a NULL pointer. Is there a way to get this working, or is it > simply impossible ? Usually you create an internal frame (class UInternalFrame) and add it to t= he=20 root pane (URootPane::addFrame(UInternalFrame*)). That should work. > Last, I'm looking for a way to get some colors inside the TextEdit > component, for "syntax highlighting" purposes. I have the feeling that > I will have to code it myself some way, but if someone have some > advice on the subject, I'd be glad to hear it. I'm sorry, this is on the ToDo-list, but there are more important things on= =20 it, too ... Thanks for considering libUFO. If there are still questions left, don't=20 hesitate to ask. Regards, Johannes |
From: Elie `w. B. <dro...@gm...> - 2006-03-03 23:58:52
|
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. 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 ? > > 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. 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. > Well, actually, here comes some new questions, so I use your quotes to ac= t 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) Thanks again, -- Elie `woe` BLETON http://www.lwo-lab.net EPITA - B2 2009 - http://www.epita.fr |
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 |