#945 closed enhancement (fixed)
Dynamic icon for instance depending on the instance state
Reported by: | Jorge | Owned by: | Jorge |
---|---|---|---|
Priority: | high | Milestone: | TOL Packages |
Component: | Interface | Version: | 2.0.1 |
Severity: | major | Keywords: | GUI, icons |
Cc: | Pedro Gea |
Description
In order to improve the flexibility when specifying icons for instances of the classes it is require that besides specifying a name of an image being able to provide a code that could determine the name of the image depending on the state of the instance. A possible prototype could be:
Text GetImageForIcon( NameBlock instance );
The prototype for ImageManager::setIconForClass
should be now
Real ImageManager::setIconForClass( Text className, Anything imageName )
where imageName could be of type Text or Code.
Change History (5)
comment:1 Changed 15 years ago by
Status: | new → accepted |
---|
comment:2 Changed 15 years ago by
(In [2400]) refs #945, ticket done & test updated, the example follows
NameBlock Test0004 = [[ Class @TestA { Real value = 1.0 }; Class @Variable { Set _value = Copy( Empty ); Text getSubType( Real void ) { Grammar( _value[1] ) }; Static @Variable newSerie( Real void ) { @Variable aux = [[ Set _value = [[ Serie Gaussian( 0, 1 ) ]] ]]; aux }; Static @Variable newMatrix( Real row, Real column ) { @Variable aux = [[ Set _value = [[ Matrix Gaussian( row, column, 0, 1 ) ]] ]]; aux } }; Text getIconForVariable( @Variable instance ) { // en este caso podemos retorna el subtipo de la @Variable, en // otro caso se puede hacer la casuistica tan compleja como se // quiera Text instance::getSubType(?) } ]]; Real GuiTools::ImageManager::defineImageFromData ( "checkedBox", "R0lGODdhCwALAJEAAH9/f////wAAAP///ywAAAAACwALAAACLISPRvEPAE8oAMUXCYAgJSEiAYRIQkSCAgTJjgiAoEgSEQGEJIRiA9wdwUcrADs=" ); Real GuiTools::ImageManager::defineImageFromFile( "Matrix", "Matrix.gif" ); Real GuiTools::ImageManager::defineImageFromFile( "Serie", "Serie.gif" ); Real GuiTools::ImageManager::setIconForClass( "Test0004::@TestA", "checkedBox" ); Real GuiTools::ImageManager::setIconForClass( "Test0004::@Variable", Test0004::getIconForVariable ); Test0004::@TestA inst1 = [[ Real value = 1.0 ]]; Test0004::@Variable instSerie = Test0004::@Variable::newSerie(?); Test0004::@Variable instMatrix = Test0004::@Variable::newMatrix(10,10);
comment:3 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
comment:5 Changed 15 years ago by
Note: See
TracTickets for help on using
tickets.
getIconForClass will change to:
and a new method getIconForInstance will be implemented