Esempio n. 1
0
int CheckClickLabel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: labelclicked((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: checkclicked((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: labelclick((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: checkclick((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Esempio n. 2
0
// ------------------------------------------------------------------------------------------------
//
//
int InstEditor::mouseupdate(int cur_element) {
                        int i = (MousePressY/8) - this->y;
    KBKey key,act=0;
    key = Keys.checkkey();

    
    
    
    //    int old_cur_sel = cur_sel;
//   int old_y_start = y_start;
/*
    if (!bMouseIsDown)
        mousestate = 0;
    if (mousestate) {
        int i = (LastY/8) - this->y ;
        if (cur_sel+y_start != i) {
            if (i<0) {
                if (y_start >0 ) {
                    setCursor(y_start-1);
//                    y_start--;
                    act++;
                }
            } else
            if (i>ysize && cur_sel==ysize && y_start<num_elements-ysize-1) {
//                y_start++;
                setCursor(y_start+cur_sel+1);
                act++;
            } else
            if (i<=ysize && i+y_start<num_elements && i+y_start>=0) {
                setCursor(i+y_start);
                act++;
            }
        }
    }
    if (key) {
        switch(key) {
            case DIK_MOUSE_1_ON:
                if (checkclick(col(this->x),row(this->y),col(this->x+this->xsize),row(this->y+this->ysize+1))) {
                    int i = (MousePressY/8) - this->y;
                    if (cur_element == this->ID && i==this->cur_sel) {
                        LBNode *p = this->getNode(this->cur_sel+this->y_start);
                        if (p)
                            OnSelect( p );
                    }
                    mousestate = 1;
                    if (i<=ysize && i<num_elements)
                        setCursor(i+y_start);                    
                    act++;
                }
                break;
            case DIK_MOUSE_1_OFF:
                if (mousestate) {
                    act++;
                }
                mousestate=0;
                break;
        }
    }
    if (cur_sel != old_cur_sel || y_start != old_y_start)
        OnSelectChange();
    if (act)  key = Keys.getkey();
    if (act) {
        need_refresh++;
        need_redraw++;
        return this->ID;
    }

    return cur_element;
*/
    if (mousestate) {
        int i = (LastY/8)-this->y;
        if (cursor != i) {
            act++;
            cursor = i;
        }
        int j = (LastX/8) - this->x;
        if (text_cursor != j) {
            this->text_cursor = j;
            act++;
        }
    }
    if (key) {
        switch(key) {
            case DIK_MOUSE_1_ON:
                if (checkclick(col(this->x),row(this->y),col(this->x+this->xsize),row(this->y+this->ysize))) {
                    int i = (MousePressY/8) - this->y;// + list_start;
                    int j = (MousePressX/8) - this->x;
                    this->text_cursor = j;
                    this->cursor = i;
                    act++;
                    mousestate = 1;
                    
                }
                break;
            case DIK_MOUSE_1_OFF:
                if (mousestate) {
                    act++;
                }
                mousestate=0;
                break;

        }
    }
    if (act) {
        key = Keys.getkey();
        need_refresh++;
        need_redraw++;
        if (cursor>ysize-1)
            cursor = ysize-1;
        if (cursor<0)
            cursor=0;
        if (text_cursor<0)
            text_cursor = 0;
        if (text_cursor>24) text_cursor=24;     

        return this->ID;
    }
    return cur_element;
}