* ./hurricane/src/hviewer :

- Feature: ability to hide/show layer of the palette from the code, needs
        the CellWidget to be bound to a palette to work.
This commit is contained in:
Jean-Paul Chaput 2009-02-04 13:30:39 +00:00
parent ecc9c5402f
commit 00e01d50c8
4 changed files with 19 additions and 0 deletions

View File

@ -1329,6 +1329,13 @@ namespace Hurricane {
} }
void CellWidget::setLayerVisible ( const Name& layer, bool visible )
{
if ( !_palette ) return;
_palette->setItemVisible ( layer, visible );
}
bool CellWidget::isDrawable ( const Name& name ) bool CellWidget::isDrawable ( const Name& name )
{ {
PaletteItem* item = (_palette) ? _palette->find(name) : NULL; PaletteItem* item = (_palette) ? _palette->find(name) : NULL;

View File

@ -377,6 +377,16 @@ namespace Hurricane {
} }
void PaletteWidget::setItemVisible ( const Name& name, bool visible )
{
PaletteItem* item = find ( name );
if ( item ) {
item->setItemVisible ( visible );
emit paletteChanged();
}
}
void PaletteWidget::changeStyle () void PaletteWidget::changeStyle ()
{ {
PaletteItems::iterator iitem = _layerItems.begin(); PaletteItems::iterator iitem = _layerItems.begin();

View File

@ -146,6 +146,7 @@ namespace Hurricane {
inline void copyToPrinter ( QPrinter* ); inline void copyToPrinter ( QPrinter* );
inline const float& getScale () const; inline const float& getScale () const;
inline const QPoint& getMousePosition () const; inline const QPoint& getMousePosition () const;
void setLayerVisible ( const Name& layer, bool visible );
bool isDrawable ( const Name& ); bool isDrawable ( const Name& );
bool isDrawableLayer ( const Name& ); bool isDrawableLayer ( const Name& );
bool isDrawableExtension ( const Name& ); bool isDrawableExtension ( const Name& );

View File

@ -69,6 +69,7 @@ namespace Hurricane {
void showAll (); void showAll ();
void hideAll (); void hideAll ();
void changeStyle (); void changeStyle ();
void setItemVisible ( const Name& name, bool visible );
protected: protected:
PaletteItems _layerItems; PaletteItems _layerItems;