Description: Is possible to do something like this,menus with rounded borders and the "snake" in a native style? Where I can find some documentation for coding native style for kde 3.1?
Personaly I don't need any extra snake effect to burn CPU cycles, it is already fine thew ay it works now in every OS except BE.
What I would really really like is rounded borders.
Too bad that it seems to be VERY hard to do things like this, it would be very nice, there is 1thing I want to know, i saw in the dotNET style that the internal border is rounder, the internal border of a windows is so different from the menu?
All the above people are wrong, except perhaps for benv57 - I'm not sure about that ;-)
This would be possible in a theme, and I don't think it would require any more redraws than the current styles. You'd need to apply a mask to the popup window each time the selection changed for the little snakey bit on the left. Then, you'd simply have some logic to draw the correct shape and outline. This would be pretty fast - certainly not visably slower than other styles.
The only problem I can think of is knowing where the previous submenu was. For example, if you bring up a popup menu towards the right edge of the screen, any other submenus open to the left of it. I'm not sure if it's possible for a theme to determine which side it was opened from.
It's unfortunatly not possible due to a limitation in Qt style engine without a ugly hack as the shadow one... I've already tried things like that.
The problem is that the outer shape of a menu is a rectangle and cannot be changed. The only possible way is to take parts of the screen and redraw them on the menu.
You'll have to wait for trolltech to implement a menu mask...
I'm no C++ coder of any merit, but I can just imagine the number of redraws you would have to do to keep the 'snake' selection lined up as you moused-over each menu entry...
Well, I suppose it would depend on if KDE/QT only redraws the menu entry the mouse is over or if it redraws the whole menu. If it redraws the whole menu, then I think it could be done more easily -- but I can see where redrawing the whole menu would be a waste of CPU time...
Too bad native themes can't be done in pyQT, because then I might be able to do something. lol
Unless I am very much mistaken, it is quite possible to code native themes in PyQt. At least with PyQt for Qt 2 it was possible; I even devoted a chapter to it in my book on PyQt. The relevant base classes for Qt 3 are all implemented in PyQt, so I guess it's just a matter of giving it a try.
The real problem is, of course, that you can use those styles only from PyQt applications.
Why can't the menus line up(like they do in the picture) and have a purple bar light up on the right edge to make the snake? It would only redraw that section like a menu highlight.
yeah, I think you are somewhat right ... I don't have (maybe a little) programming skills, but the menu need some kind of adaption. If a pointed windows is open, still keep overlay. If you again open a window on the next, create a overlay with direction ... well, I told you I wasn't a programmer :)
I can't tell you for a KDE/QT-style, but basically the problems are assumptions in the underlying layers:
- X11 assumes that every application wants (exactly) rectangular windows and provides exactly that. There is a way around that (the SHAPE extension) but it complicates things a bit.
- Toolkits (like Qt) often assume that their themes all want to provide (exactly) rectangular windows and model their API to represent that (I don't know if this is true for Qt, but I assume so, 'cause I've never seen a QT/KDE-Style that doesn't use rectangular windows).
I'd say the task at hand is possible, but quite hard ('though not "extremly hard, only the ones with m4d progr4mming skillz might try!").
If you're not a programmer, it's hard to explain. Even if you're a programmer, but not a Qt/KDE programmer, it's hard. But I'll try.
What Qt will do when it needs to draw a menu is to first ask the style to draw the whole menu box as a blank panel. Then it will ask the style to draw each individual menu item. The actual menu items are not widgets, so the style will receive information on the item active/inactive state and the region in which it should be drawn.
One piece of information that Qt does NOT supply to the style is whether a menu item is before or after the active menu item. This is the big problem. When you are drawing an inactive menu item, you do not know whether you need to draw the vertical part of the snake or not.
Without delving into the Qt sources, the only way I can think to solve this problem would be to subclass the whole QPopupMenu class. But then only applications that used your new class would get this new functionality.
Why not just draw the inactive items as normal, and then draw the entire blue bar along with the active one. Even if QT gives you a specific region to draw in, I'd assume you can go outside that by using a different QRect.
I might try this over the weekend :-)
Yes, but it would be insanely hard to do it. I don't think this is ever going to appear in anything other than BeOS, but then, if some person with "m4d programming skillz" gets *really* bored...
Did you gimp the screenshot after the fact, or did you set up your desktop to do this, then take a screenshot?
If the latter, what did you have to do to produce the effect?
Ratings & Comments
18 Comments
Personaly I don't need any extra snake effect to burn CPU cycles, it is already fine thew ay it works now in every OS except BE. What I would really really like is rounded borders.
And that wasn't used in any official release of BeOS, anyway.
Too bad that it seems to be VERY hard to do things like this, it would be very nice, there is 1thing I want to know, i saw in the dotNET style that the internal border is rounder, the internal border of a windows is so different from the menu?
All the above people are wrong, except perhaps for benv57 - I'm not sure about that ;-) This would be possible in a theme, and I don't think it would require any more redraws than the current styles. You'd need to apply a mask to the popup window each time the selection changed for the little snakey bit on the left. Then, you'd simply have some logic to draw the correct shape and outline. This would be pretty fast - certainly not visably slower than other styles. The only problem I can think of is knowing where the previous submenu was. For example, if you bring up a popup menu towards the right edge of the screen, any other submenus open to the left of it. I'm not sure if it's possible for a theme to determine which side it was opened from.
It's unfortunatly not possible due to a limitation in Qt style engine without a ugly hack as the shadow one... I've already tried things like that. The problem is that the outer shape of a menu is a rectangle and cannot be changed. The only possible way is to take parts of the screen and redraw them on the menu. You'll have to wait for trolltech to implement a menu mask...
Why can't you do like the shadow hack with a solid color instead of transperancy?
why would it he hard to program that feature? i mean, im no programmer, but why would it be do difficult or time consuming? --upgrdman
I'm no C++ coder of any merit, but I can just imagine the number of redraws you would have to do to keep the 'snake' selection lined up as you moused-over each menu entry... Well, I suppose it would depend on if KDE/QT only redraws the menu entry the mouse is over or if it redraws the whole menu. If it redraws the whole menu, then I think it could be done more easily -- but I can see where redrawing the whole menu would be a waste of CPU time... Too bad native themes can't be done in pyQT, because then I might be able to do something. lol
Unless I am very much mistaken, it is quite possible to code native themes in PyQt. At least with PyQt for Qt 2 it was possible; I even devoted a chapter to it in my book on PyQt. The relevant base classes for Qt 3 are all implemented in PyQt, so I guess it's just a matter of giving it a try.
The real problem is, of course, that you can use those styles only from PyQt applications.
Why can't the menus line up(like they do in the picture) and have a purple bar light up on the right edge to make the snake? It would only redraw that section like a menu highlight.
yeah, I think you are somewhat right ... I don't have (maybe a little) programming skills, but the menu need some kind of adaption. If a pointed windows is open, still keep overlay. If you again open a window on the next, create a overlay with direction ... well, I told you I wasn't a programmer :)
I can't tell you for a KDE/QT-style, but basically the problems are assumptions in the underlying layers: - X11 assumes that every application wants (exactly) rectangular windows and provides exactly that. There is a way around that (the SHAPE extension) but it complicates things a bit. - Toolkits (like Qt) often assume that their themes all want to provide (exactly) rectangular windows and model their API to represent that (I don't know if this is true for Qt, but I assume so, 'cause I've never seen a QT/KDE-Style that doesn't use rectangular windows). I'd say the task at hand is possible, but quite hard ('though not "extremly hard, only the ones with m4d progr4mming skillz might try!").
If you're not a programmer, it's hard to explain. Even if you're a programmer, but not a Qt/KDE programmer, it's hard. But I'll try. What Qt will do when it needs to draw a menu is to first ask the style to draw the whole menu box as a blank panel. Then it will ask the style to draw each individual menu item. The actual menu items are not widgets, so the style will receive information on the item active/inactive state and the region in which it should be drawn. One piece of information that Qt does NOT supply to the style is whether a menu item is before or after the active menu item. This is the big problem. When you are drawing an inactive menu item, you do not know whether you need to draw the vertical part of the snake or not. Without delving into the Qt sources, the only way I can think to solve this problem would be to subclass the whole QPopupMenu class. But then only applications that used your new class would get this new functionality.
Why not just draw the inactive items as normal, and then draw the entire blue bar along with the active one. Even if QT gives you a specific region to draw in, I'd assume you can go outside that by using a different QRect. I might try this over the weekend :-)
Yes, but it would be insanely hard to do it. I don't think this is ever going to appear in anything other than BeOS, but then, if some person with "m4d programming skillz" gets *really* bored...
Ad far as I know, it's screenshot from BeOS. so long, red
Did you gimp the screenshot after the fact, or did you set up your desktop to do this, then take a screenshot? If the latter, what did you have to do to produce the effect?
Its BeOS