typedef void (CV_CDECL *CvButtonCallback)(int state, void* userdata);
enum {CV_PUSH_BUTTON = 0, CV_CHECKBOX = 1, CV_RADIOBOX = 2};
-CVAPI(int) cvCreateButton( const char* button_name CV_DEFAULT(NULL),CvButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL) , int button_type CV_DEFAULT(CV_PUSH_BUTTON), bool initial_button_state CV_DEFAULT(0));
+CVAPI(int) cvCreateButton( const char* button_name CV_DEFAULT(NULL),CvButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL) , int button_type CV_DEFAULT(CV_PUSH_BUTTON), int initial_button_state CV_DEFAULT(0));
//----------------------
/* create trackbar and display it on top of given window, set callback */
CVAPI(int) cvCreateTrackbar( const char* trackbar_name, const char* window_name,
- int* value, int count, CvTrackbarCallback on_change);
+ int* value, int count, CvTrackbarCallback on_change CV_DEFAULT(NULL));
typedef void (CV_CDECL *CvTrackbarCallback2)(int pos, void* userdata);
-CV_IMPL int cvCreateButton(const char* button_name,CvButtonCallback on_change, void* userdata , int button_type, bool initial_button_state )
+CV_IMPL int cvCreateButton(const char* button_name,CvButtonCallback on_change, void* userdata , int button_type, int initial_button_state )
{
+ if (initial_button_state < 0 || initial_button_state > 1)
+ return 0;
+
QMetaObject::invokeMethod(&guiMainThread,
"addButton",
Qt::AutoConnection,
Q_ARG(QString, QString(button_name)),
Q_ARG(int, button_type),
- Q_ARG(bool, initial_button_state),
+ Q_ARG(int, initial_button_state),
Q_ARG(void*, (void*)on_change),
Q_ARG(void*, userdata)
);
w->resize(width, height);
}
-void GuiReceiver::addButton(QString button_name, int button_type, bool initial_button_state , void* on_change, void* userdata)
+void GuiReceiver::addButton(QString button_name, int button_type, int initial_button_state , void* on_change, void* userdata)
{
if (!global_control_panel)
label->setText(nameNormalized);
}
-void CvButtonbar::addButton( QString name, CvButtonCallback call, void* userdata, int button_type, bool initial_button_state)
+void CvButtonbar::addButton( QString name, CvButtonCallback call, void* userdata, int button_type, int initial_button_state)
{
QString button_name = name;
void CvPushButton::callCallBack()
{
- callback(-1,userdata);
+ if (callback)
+ callback(-1,userdata);
}
-CvCheckBox::CvCheckBox(CvButtonbar* arg1, QString arg2, CvButtonCallback arg3, void* arg4, bool initial_button_state)
+CvCheckBox::CvCheckBox(CvButtonbar* arg1, QString arg2, CvButtonCallback arg3, void* arg4, int initial_button_state)
{
myparent = arg1;
button_name = arg2;
void CvCheckBox::callCallBack()
{
- callback(this->isChecked(),userdata);
+ if (callback)
+ callback(this->isChecked(),userdata);
}
-CvRadioButton::CvRadioButton(CvButtonbar* arg1, QString arg2, CvButtonCallback arg3, void* arg4, bool initial_button_state)
+CvRadioButton::CvRadioButton(CvButtonbar* arg1, QString arg2, CvButtonCallback arg3, void* arg4, int initial_button_state)
{
myparent = arg1;
button_name = arg2;
void CvRadioButton::callCallBack()
{
- callback(this->isChecked(),userdata);
+ if (callback)
+ callback(this->isChecked(),userdata);
}
CvWinProperties* CvWindow::createParameterWindow()
{
- QString name_paraWindow ="Global control panel";
+ QString name_paraWindow =QFileInfo(QApplication::applicationFilePath()).fileName()+" settings";
CvWinProperties *result = new CvWinProperties(name_paraWindow,this);
return result;
void loadWindowParameters(QString name);
void setOpenGLCallback(QString window_name, void* callbackOpenGL, void* userdata);
void putText(void* arg1, QString text, QPoint org, void* font);
- void addButton(QString button_name, int button_type, bool initial_button_state , void* on_change, void* userdata);
+ void addButton(QString button_name, int button_type, int initial_button_state , void* on_change, void* userdata);
};
public:
CvButtonbar(QWidget* arg, QString bar_name);
~CvButtonbar();
- void addButton( QString button_name, CvButtonCallback call, void* userdata, int button_type, bool initial_button_state);
+ void addButton( QString button_name, CvButtonCallback call, void* userdata, int button_type, int initial_button_state);
private:
void setLabel();
{
Q_OBJECT
public:
- CvCheckBox(CvButtonbar* par, QString button_name, CvButtonCallback call, void* userdata, bool initial_button_state);
+ CvCheckBox(CvButtonbar* par, QString button_name, CvButtonCallback call, void* userdata, int initial_button_state);
private:
CvButtonbar* myparent;
{
Q_OBJECT
public:
- CvRadioButton(CvButtonbar* par, QString button_name, CvButtonCallback call, void* userdata, bool initial_button_state);
+ CvRadioButton(CvButtonbar* par, QString button_name, CvButtonCallback call, void* userdata, int initial_button_state);
private:
CvButtonbar* myparent;
//parameters (will be save/load)
QString param_name;
- QPointer<CvWinProperties> parameters_window ;
+ CvWinProperties* parameters_window ;
int param_flags;
int param_gui_mode;
QVector<QAction*> vect_QActions;