summaryrefslogtreecommitdiffstats
path: root/Source/FLTKDialog/FLTKPropertyItemRow.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/FLTKDialog/FLTKPropertyItemRow.cxx')
-rw-r--r--Source/FLTKDialog/FLTKPropertyItemRow.cxx105
1 files changed, 67 insertions, 38 deletions
diff --git a/Source/FLTKDialog/FLTKPropertyItemRow.cxx b/Source/FLTKDialog/FLTKPropertyItemRow.cxx
index e5607a4..87b20d0 100644
--- a/Source/FLTKDialog/FLTKPropertyItemRow.cxx
+++ b/Source/FLTKDialog/FLTKPropertyItemRow.cxx
@@ -1,5 +1,8 @@
#include "FLTKPropertyItemRow.h"
+#include <Fl/Fl.H>
+#include <Fl/Fl_Window.H>
#include <Fl/Fl_Button.H>
+#include <Fl/Fl_Box.H>
#include <Fl/Fl_Input.H>
#include <Fl/Fl_Tile.H>
#include <Fl/fl_ask.H>
@@ -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 );
-
- 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 )
+ parent()->size( nameWidth + textWidth , rowHeight );
+
+ 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