Matthias Melcher wrote:
> On 09.12.2009, at 01:08, yassine wrote:
> 
>> I created custom symbols using fl_add_symbol, the draw function contain a 
>> draw of a fl_PNG_Image at coordinates 0, 0. When I place the symbol on the 
>> menu item, there is a blank space and the the icon is at the top of the 
>> menu. I have to change the coordinates of the draw function to get the icon 
>> at the correct position.
>> Is there a way to get the relative position of the menu items, note that 
>> predefined symbols are correctly placed.
> 
> The symbols are positioned at the base line of the font. You can use the 
> standard drawing functions to get the baseline and height of the current font.

Hmm, I think that this is not the expected answer to the OP's question.
His problem seems to be to draw his symbol (a png image) at the correct
position within a menu, i.e. to get the x/y coordinates of a specific
menu item.

That said, and looking at the symbol drawing code in fl_symbols.cxx,
I assume that this is not going to work as expected. The symbol
drawing functions are using coordinate transformations to draw the
symbol in the right place, and I also assume that the image drawing
functions don't use the transformation matrix that has been set
before calling the symbol drawing function.

To Yassine: Sorry, I can't help any further, maybe someone else
can shed more light on this. I don't have the time to invetigate
more, but you should take a look at the drawing chapter in the
docs to learn more about which drawing functions use the coordinate
transformation matrix and which don't. In the worst case you would
need to write your own image drawing function that uses only the
drawing functions that honor the transformation matrix.

... or I might be completely wrong with my assumptions ...

Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to