diff --git a/Source/FLTKDialog/FLTKPropertyItemRow.cxx b/Source/FLTKDialog/FLTKPropertyItemRow.cxx index e5607a4be..87b20d043 100644 --- a/Source/FLTKDialog/FLTKPropertyItemRow.cxx +++ b/Source/FLTKDialog/FLTKPropertyItemRow.cxx @@ -1,5 +1,8 @@ #include "FLTKPropertyItemRow.h" +#include +#include #include +#include #include #include #include @@ -7,12 +10,14 @@ namespace fltk { -PropertyItemRow::PropertyItemRow( PropertyItem * pItem ) + +PropertyItemRow::PropertyItemRow( PropertyItem * pItem ):Fl_Tile(0,0,10,10,"") { - m_PropertyItem = pItem; + m_PropertyItem = pItem; m_ItemValue = new ItemValue; + const unsigned int nameWidth = 200; const unsigned int textWidth = 1400; const unsigned int checkWidth = textWidth; @@ -24,31 +29,31 @@ PropertyItemRow::PropertyItemRow( PropertyItem * pItem ) const unsigned int rowHeight = 20; const unsigned int rowSpacing = 20; - Fl_Tile * group = new Fl_Tile(0,0,nameWidth+textWidth,rowHeight,""); + size( nameWidth + textWidth , rowHeight ); // Make the parent Fl_Pack widget at least a row wide. - group->parent()->size( nameWidth + textWidth , rowHeight ); + parent()->size( nameWidth + textWidth , rowHeight ); - Fl_Button * name = new - Fl_Button( firstColumn, 0, nameWidth, rowHeight, - pItem->m_propName.c_str() ); - name->align( FL_ALIGN_CLIP | FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); - name->labelsize(11); - name->box( FL_DOWN_BOX ); - name->callback( NameClickCallback, (void *)pItem ); - - switch( pItem->m_nItemType ) + m_NameButton = new + PropertyNameButtonWithHelp( firstColumn, 0, nameWidth, rowHeight, + m_PropertyItem->m_propName.c_str() ); + + m_NameButton->align( FL_ALIGN_CLIP | FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); + m_NameButton->labelsize(11); + m_NameButton->box( FL_DOWN_BOX ); + m_NameButton->SetHelpText( m_PropertyItem->m_HelpString.c_str() ); + m_NameButton->size( secondColumn, rowHeight ); + + switch( m_PropertyItem->m_nItemType ) { case 1: { - name->size( secondColumn, rowHeight ); - Fl_Input * input = new Fl_Input( secondColumn, 0, textWidth ,rowHeight ,""); - input->value( pItem->m_curValue.c_str() ); + input->value( m_PropertyItem->m_curValue.c_str() ); input->textsize(11); - input->callback( InputTextCallback, (void *)pItem ); + input->callback( InputTextCallback, (void *)m_PropertyItem ); input->when( FL_WHEN_CHANGED ); break; @@ -64,21 +69,20 @@ PropertyItemRow::PropertyItemRow( PropertyItem * pItem ) case 4: { - name->size( secondColumn, rowHeight ); Fl_Button * browseButton = new Fl_Button( secondColumn, 0, browseWidth ,rowHeight ,"..."); browseButton->labelsize(11); Fl_Input * input = new Fl_Input( secondColumn+browseWidth, 0, textWidth ,rowHeight ,""); - input->value( pItem->m_curValue.c_str() ); + input->value( m_PropertyItem->m_curValue.c_str() ); input->textsize(11); m_ItemValue->m_InputText = input; - m_ItemValue->m_PropertyItem = pItem; + m_ItemValue->m_PropertyItem = m_PropertyItem; browseButton->callback( BrowsePathCallback, (void *)m_ItemValue ); - input->callback( InputTextCallback, pItem ); + input->callback( InputTextCallback, m_PropertyItem ); input->when( FL_WHEN_CHANGED ); break; @@ -88,14 +92,14 @@ PropertyItemRow::PropertyItemRow( PropertyItem * pItem ) Fl_Button * button = new Fl_Button( secondColumn, 0, checkWidth ,rowHeight ,""); button->align( FL_ALIGN_INSIDE | FL_ALIGN_LEFT ); - button->callback( CheckButtonCallback, (void *)pItem ); + button->callback( CheckButtonCallback, (void *)m_PropertyItem ); - if( pItem->m_curValue == "ON" ) + if( m_PropertyItem->m_curValue == "ON" ) { button->label(" ON "); button->value(1); } - else if( pItem->m_curValue == "OFF" ) + else if( m_PropertyItem->m_curValue == "OFF" ) { button->label(" OFF "); button->value(0); @@ -107,42 +111,48 @@ PropertyItemRow::PropertyItemRow( PropertyItem * pItem ) case 6: { - name->size( secondColumn, rowHeight ); Fl_Button * browseButton = new Fl_Button( secondColumn, 0, browseWidth ,rowHeight ,"..."); browseButton->labelsize(11); Fl_Input * input = new Fl_Input( secondColumn+browseWidth, 0, textWidth ,rowHeight ,""); - input->value( pItem->m_curValue.c_str() ); + input->value( m_PropertyItem->m_curValue.c_str() ); input->textsize(11); m_ItemValue->m_InputText = input; - m_ItemValue->m_PropertyItem = pItem; + m_ItemValue->m_PropertyItem = m_PropertyItem; browseButton->callback( BrowsePathCallback, (void *)m_ItemValue ); - input->callback( InputTextCallback, pItem ); + input->callback( InputTextCallback, m_PropertyItem ); input->when( FL_WHEN_CHANGED ); break; } break; default: - fl_alert("Unkown item type %d",pItem->m_nItemType); + fl_alert("Unkown item type %d",m_PropertyItem->m_nItemType); break; } - group->end(); + end(); // Close the inclusion of widgets in the Tile object + } + + + PropertyItemRow::~PropertyItemRow( ) { delete m_ItemValue; } + + + void PropertyItemRow:: @@ -167,13 +177,6 @@ CheckButtonCallback( Fl_Widget * widget, void * data) } -void -PropertyItemRow:: -NameClickCallback( Fl_Widget * widget, void * data) -{ - PropertyItem * pItem = (PropertyItem *)data; - fl_message( pItem->m_HelpString.c_str() ); -} void PropertyItemRow:: @@ -186,6 +189,10 @@ InputTextCallback( Fl_Widget * widget, void * data) } + + + + void PropertyItemRow:: BrowsePathCallback( Fl_Widget * widget, void * data) @@ -206,5 +213,27 @@ BrowsePathCallback( Fl_Widget * widget, void * data) } +int +PropertyItemRow:: +handle(int event) +{ + + int status = Fl_Tile::handle( event ); + + switch( event ) + { + case FL_LEAVE: + m_NameButton->HideHelp(); + status = 1; + break; + case FL_MOVE: + m_NameButton->HideHelp(); + status = 1; + break; + } + + return status; +} + } // end namespace fltk diff --git a/Source/FLTKDialog/FLTKPropertyItemRow.h b/Source/FLTKDialog/FLTKPropertyItemRow.h index 09a169220..4803b9a96 100644 --- a/Source/FLTKDialog/FLTKPropertyItemRow.h +++ b/Source/FLTKDialog/FLTKPropertyItemRow.h @@ -1,30 +1,57 @@ -#include "FLTKPropertyList.h" -#include +#ifndef FLTKPropertyItemRow_h +#define FLTKPropertyItemRow_h + +#include "FLTKPropertyList.h" +#include "FLTKPropertyNameButtonWithHelp.h" + +#include #include namespace fltk { -class PropertyItemRow + +/** + + Class to manage a GUI row corresponding to a property + + */ +class PropertyItemRow : public Fl_Tile { + + // Helper class for passing data to callbacks struct ItemValue { PropertyItem * m_PropertyItem; Fl_Input * m_InputText; }; + public: + PropertyItemRow( PropertyItem * ); ~PropertyItemRow(); + int handle(int event); + private: + PropertyItem * m_PropertyItem; ItemValue * m_ItemValue; + // Button that displays the property name and + // manages the popup help blob + PropertyNameButtonWithHelp * m_NameButton; + static void CheckButtonCallback( Fl_Widget *, void *); - static void NameClickCallback( Fl_Widget *, void *); static void InputTextCallback( Fl_Widget *, void *); static void BrowsePathCallback( Fl_Widget *, void *); + }; } // end namespace fltk + + +#endif + + diff --git a/Source/FLTKDialog/Makefile.in b/Source/FLTKDialog/Makefile.in index 2816aefda..4c5417f80 100644 --- a/Source/FLTKDialog/Makefile.in +++ b/Source/FLTKDialog/Makefile.in @@ -22,6 +22,7 @@ CMakeSetupGUIImplementation.o \ FLTKDialog.o \ FLTKPropertyItemRow.o \ FLTKPropertyList.o \ +FLTKPropertyNameButtonWithHelp.o \ ../cmCableClassSet.o \ ../cmCacheManager.o \ ../cmCommands.o \