[LC++][OT] Which structure to choose
julien at c-lab.de
Tue Mar 6 02:47:08 UTC 2007
Thanks for you thoughts and solutions. I have a few questions, because I'm
We are talking about text-widgets. I only mentioned that all the small
displayable elements derive from a common class, so it's clear, that they can
be simply stored in one container.
At the moment each small element (like a butoon, checkbox, text-entry, etc.)
knows the following:
1. Its position (I guess I should move that into the window or panel)
2. its height/width (same as with 1.?)
3. Its display-state (is it there, or is it hidden? - again to the panel?)
4. Its text-data
5. Its attributes (colour, should I move that too? Seems a bit odd, because
the parameter itself belongs to the object and may change according to its
state (clicked, in the focus, etc.)
6. If they have, the elements contain there internal state (toggle button
contains a bool, slider contains and int or float, etc.)
So my container-objects (renderer window, panel...) shoudl contain the
following (roughly speaking):
1. Their elements (of course)
2. Positions and sizes of their elements
3. Position of the cursor
So one question is still left. I try to design a library, which is suited to
display audio and other interactive applications. So there'll be screen with a
lot of different small elements (not just or mostly big blocks of text). And
if I move the cursor I want it to jump to the next element, which is
positioned in the specified direction. So if I move down, it just doesn't move
one line down, but probably, also a bit to the right or left. Which
container-structure would be most suitable for that task?
I thought about it some more and think a simple vector wouldn't be to good.
Do you have a bet on it, or should I just try and see what is most sufficient
on memory and gives fastest results?
Kindest regards and thanks for your help!
Music was my first love and it will be my last (John Miles)
======== FIND MY WEB-PROJECT AT: ========
the Linux TextBased Studio guide
======= AND MY PERSONAL PAGES AT: =======
More information about the tuxCPProgramming