bbwx::CommandButtonWidget Class Reference

#include <bbwxCommandButton.h>

Collaboration diagram for bbwx::CommandButtonWidget:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CommandButtonWidget (CommandButton *box, wxWindow *parent, wxString title)
 ~CommandButtonWidget ()
void OnCommandButton (wxEvent &)
void SetLabel (wxString title)
void SetColour (wxColour color)

Private Attributes

CommandButtonmBox
wxButton * mwxCommandButton


Detailed Description

Definition at line 62 of file bbwxCommandButton.h.


Constructor & Destructor Documentation

bbwx::CommandButtonWidget::CommandButtonWidget ( CommandButton box,
wxWindow *  parent,
wxString  title 
)

Definition at line 51 of file bbwxCommandButton.cxx.

References mwxCommandButton, and OnCommandButton().

00054     : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
00055       mBox(box)
00056   { 
00057 
00058     wxPanel *panel      = this;
00059 
00060     mwxCommandButton = new wxButton( panel, -1, title);
00061     Connect( mwxCommandButton->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , 
00062              (wxObjectEventFunction) 
00063              (void (wxPanel::*)(wxEvent&))
00064              &CommandButtonWidget::OnCommandButton ); 
00065     
00066     wxFlexGridSizer *sizer      = new wxFlexGridSizer(1);
00067     sizer -> Add( mwxCommandButton,1,wxGROW | wxALL,10 ); 
00068     sizer       -> AddGrowableCol(0);
00069     
00070     panel       -> SetSizer(sizer);
00071     panel       -> SetAutoLayout(true);
00072     panel       -> Layout();
00073     
00074   }

bbwx::CommandButtonWidget::~CommandButtonWidget (  ) 

Definition at line 76 of file bbwxCommandButton.cxx.

00077   {
00078   }


Member Function Documentation

void bbwx::CommandButtonWidget::OnCommandButton ( wxEvent &   ) 

Definition at line 81 of file bbwxCommandButton.cxx.

References mBox, bbwx::CommandButton::UpdateColour(), and bbwx::CommandButton::UpdateLabel().

Referenced by CommandButtonWidget().

00082   {
00083     // Look for the interpreter or the executer if no interpreter
00084     bbtk::Interpreter::Pointer I;
00085     bbtk::VirtualExec::Pointer E;
00086       if (mBox->bbGetParent() != 0) 
00087         {
00088           bbtk::Factory::Pointer f = boost::dynamic_pointer_cast<bbtk::ComplexBlackBoxDescriptor>(mBox->bbGetParent()->bbGetDescriptor())->GetFactory();
00089           if ((f != 0)&&
00090               (f->GetExecuter()))
00091             {
00092               E = f->GetExecuter();
00093               I = E->GetInterpreter();
00094             }
00095         }
00096       if (I==0) 
00097         {
00098           //      bbtkError("CommandButton::DoProcess() : could not find interpreter");
00099           if (E==0) 
00100             {
00101               // If no executer : create a totally independant interpreter
00102               I = bbtk::Interpreter::New();
00103             }
00104           else 
00105             {
00106               // If executer : create an interpreter using E
00107               I = bbtk::Interpreter::New(E);
00108             }
00109         }
00110       
00111       std::string commandstr(mBox->bbGetInputIn());
00112     
00113     //  bbtk::Interpreter::mGlobalInterpreter->InterpretLine( commandstr );
00114     unsigned int i;
00115     bool ok=true;
00116     int pos1=0,pos2;
00117     pos2 = commandstr.find(";",pos1);
00118     std::string ccommand;
00119     while (ok==true)
00120       {
00121         if (pos2==-1) 
00122           {
00123             ok=false;
00124             ccommand=commandstr.substr(pos1,commandstr.length()-pos1 );
00125           } 
00126         else 
00127           {
00128             ccommand=commandstr.substr(pos1,pos2-pos1);
00129           }
00130         for ( i=0 ; i < ccommand.length() ; i++)
00131           {
00132             if (ccommand[i]==39) // '
00133               {
00134                 ccommand[i]=34;  // "
00135               }
00136           }             
00137         I->InterpretLine( ccommand );
00138         pos1=pos2+1;
00139         pos2 = commandstr.find(";",pos2+1);
00140         
00141       }
00142    
00143     mBox->UpdateLabel();
00144     mBox->UpdateColour();
00145     mBox->bbSignalOutputModification();
00146   }

void bbwx::CommandButtonWidget::SetLabel ( wxString  title  ) 

Definition at line 151 of file bbwxCommandButton.cxx.

References mwxCommandButton.

Referenced by bbwx::CommandButton::UpdateLabel().

00152   {
00153     mwxCommandButton->SetLabel(title);
00154   }

void bbwx::CommandButtonWidget::SetColour ( wxColour  color  ) 

Definition at line 157 of file bbwxCommandButton.cxx.

References mwxCommandButton.

Referenced by bbwx::CommandButton::UpdateColour().

00158   {
00159     mwxCommandButton->SetBackgroundColour(color);
00160   }


Member Data Documentation

Definition at line 73 of file bbwxCommandButton.h.

Referenced by OnCommandButton().

Definition at line 74 of file bbwxCommandButton.h.

Referenced by CommandButtonWidget(), SetColour(), and SetLabel().


The documentation for this class was generated from the following files:

Generated on Tue Oct 21 16:06:53 2008 for wx by  doxygen 1.5.6