#include <bbwxRadioButton.h>
Public Member Functions | |
RadioButtonWidget (RadioButton *box, wxWindow *parent, int In, wxString title, std::vector< wxString > lstIn) | |
~RadioButtonWidget () | |
int | GetValue () |
void | OnRadioButton (wxEvent &event) |
Private Attributes | |
RadioButton * | mBox |
int | MAX_RADIOBUTTON |
wxRadioButton * | mwxRadioButton [10] |
Definition at line 71 of file bbwxRadioButton.h.
bbwx::RadioButtonWidget::RadioButtonWidget | ( | RadioButton * | box, | |
wxWindow * | parent, | |||
int | In, | |||
wxString | title, | |||
std::vector< wxString > | lstIn | |||
) |
Definition at line 50 of file bbwxRadioButton.cxx.
References MAX_RADIOBUTTON, mwxRadioButton, and OnRadioButton().
00055 : 00056 wxPanel( parent, -1) , 00057 mBox(box) 00058 { 00059 wxPanel *panel = this; 00060 MAX_RADIOBUTTON = lstIn.size(); 00061 int i; 00062 long style=wxRB_GROUP; 00063 for (i=0;i<MAX_RADIOBUTTON; i++) 00064 { 00065 if ( lstIn[i]!=_T("")) 00066 { 00067 //--------------------------------------------------------------------- 00068 // 1) Creation of the components of the widget 00069 // Any top level sub-widget must have the panel returned by panel 00070 // for parent 00071 mwxRadioButton[i] = new wxRadioButton( panel, -1, lstIn[i],wxDefaultPosition, wxDefaultSize, style); 00072 style=0; 00073 if (In==i) 00074 { 00075 mwxRadioButton[i]->SetValue(true); 00076 } 00077 else 00078 { 00079 mwxRadioButton[i]->SetValue(false); 00080 } 00081 Connect( mwxRadioButton[i]->GetId(), 00082 wxEVT_COMMAND_RADIOBUTTON_SELECTED, 00083 (wxObjectEventFunction) 00084 (void (wxPanel::*)(wxEvent&)) 00085 &RadioButtonWidget::OnRadioButton ); 00086 } 00087 else 00088 { 00089 mwxRadioButton[i]=NULL; 00090 } 00091 } 00092 00093 //--------------------------------------------------------------------- 00094 // 2) Insertion of the components in the window 00095 00096 // We use a FlexGridSizer 00097 wxFlexGridSizer *sizer = new wxFlexGridSizer(1); 00098 if (title!=_T("")) 00099 { 00100 sizer->Add( new wxStaticText(panel,-1, title ) ); 00101 } 00102 for (i=0;i<MAX_RADIOBUTTON; i++) 00103 { 00104 if (mwxRadioButton[i]!=NULL) 00105 { 00106 sizer->Add( mwxRadioButton[i],1,wxGROW ); 00107 } 00108 } 00109 sizer->AddGrowableCol(0); 00110 panel->SetSizer(sizer); 00111 00112 // panel->SetAutoLayout(true); 00113 // panel->Layout(); 00114 00115 } //-------------------------------------------------------------------------
bbwx::RadioButtonWidget::~RadioButtonWidget | ( | ) |
int bbwx::RadioButtonWidget::GetValue | ( | ) |
Definition at line 124 of file bbwxRadioButton.cxx.
References MAX_RADIOBUTTON, and mwxRadioButton.
Referenced by OnRadioButton().
00125 { 00126 int result=-1; 00127 int i; 00128 for (i=0;i<MAX_RADIOBUTTON; i++) 00129 { 00130 if ( mwxRadioButton[i]!=NULL) 00131 { 00132 if (mwxRadioButton[i]->GetValue()==true) 00133 { 00134 result=i; 00135 } 00136 } 00137 } 00138 return result; 00139 }
void bbwx::RadioButtonWidget::OnRadioButton | ( | wxEvent & | event | ) |
Definition at line 142 of file bbwxRadioButton.cxx.
References GetValue(), and mBox.
Referenced by RadioButtonWidget().
00143 { 00144 mBox->bbSetOutputOut( GetValue() ); 00145 mBox->bbSetInputIn( GetValue() ); 00146 mBox->bbSignalOutputModification("Out"); 00147 }
RadioButton* bbwx::RadioButtonWidget::mBox [private] |
int bbwx::RadioButtonWidget::MAX_RADIOBUTTON [private] |
wxRadioButton* bbwx::RadioButtonWidget::mwxRadioButton[10] [private] |