Somewhat related, it would be nice if fl_add_symbol() would accept not only drawing functions but also images, even without additional scaling and rotations. In the symbol table there is an "int" flag field (at the moment this flag is used only with values 0/1 to indicate scalable and non-scalable symbols), other value could indicate that the pointer in the internal table is an image (or other object), not the function and have to be interpreted differently. This can be done by overloading fl_add_symbol() which would set appropriate flag.
The reason for that is that it would simplify drawing icons for instance in menus. At the moment I am doing this by wrapping icon-drawing in symbol-like wrapping functions (using some templates to automate instantiation of wrapping functions). The problem with it is that for each image/icon you need to implement separate function wrapper. Having overloaded fl_add_symbol(const char * name, Fl_Image *, ...) could simplify that and allow drawing image as symbol in any label just by adding it to the table and using "@" convention within labels. To have the symbol API more comprehensive (and for istance remove destructed images) it would require also to add a fl_remove_symbol() function. Alternative approach would be that for instance "@" convention would accept something like "@file:///my/shared/image.png My Label" in which case the shared image (with proper size) would be instantiated and used automatically but in such a case there is a question when/where to keep track of caches (shared images and their the reference counts) as zombie caches could still be alive after eg label change or widget destruction. R. On 24/03/2013 05:22, Greg Ercolano wrote: > I'm working on fixing STR #2772 (removing extraneous code in fl_measure()) > and need to understand in detail how we support '@' symbols in FLTK. > > Question: > I want to verify that '@' symbols in labels (eg. "@->") are only > allowed at either *the very beginning* or *very end* of a string, > or at both ends, and nothing else (ie. not in the middle of a > string, or mixed into multiple lines). > > So in other words, these are OK: > > "@<- Back" > "Next @->" > "@<- He went that way @->" > "@<- Line one\nLine two\nLine three @->" > > .and just about all other variations are not: > > "Something @-> different." > "This @-> is @<- a test." > "This is @->\na test" _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
