コード例 #1
0
ファイル: moc_header.cpp プロジェクト: commshare/QtDesktop
int Header::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: mouse_release((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
        case 1: mouse_move((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
        case 2: mouse_left_press((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
        case 3: mouse_left_press(); break;
        case 4: mouse_right_press(); break;
        case 5: mouse_mid_press(); break;
        case 6: mouse_double_click(); break;
        case 7: frame_close(); break;
        case 8: quit_frame(); break;
        default: ;
        }
        _id -= 9;
    }
    return _id;
}
コード例 #2
0
ファイル: frame.cpp プロジェクト: Fxrh/antico
void Frame::create_borders()
{
    layout = new QGridLayout(this); // 3x3 grid for window borders
    layout->setMargin(0);
    layout->setSpacing(0);
    setLayout(layout);

    // center frame where client apps is shown
    c_bdr = new Border(this);
    layout->addWidget(c_bdr, 1, 1);
    // top left border (icon)
    tl_bdr = new Border(this);
    tl_bdr->setToolTip(tr("Minimize(L)/Maximize(R)"));
    tl_bdr->setFixedSize(top_bdr_height, top_bdr_height);
    tl_bdr->setPixmap(minmax_pix);
    tl_bdr->setScaledContents(true);
    tl_bdr->setAlignment(Qt::AlignCenter);
    layout->addWidget(tl_bdr, 0, 0);
    // top right border (icon)
    tr_bdr = new Border(this);
    tr_bdr->setToolTip(tr("Close"));
    tr_bdr->setFixedSize(top_bdr_height, top_bdr_height);
    tr_bdr->setPixmap(close_pix);
    tr_bdr->setScaledContents(true);
    tr_bdr->setAlignment(Qt::AlignCenter);
    layout->addWidget(tr_bdr, 0, 2);
    // top mid header border (header frame)
    tm_bdr = new Header(cl_icon(), cl_name(), this);
    tm_bdr->set_pixmap(QPixmap(header_active_pix), QPixmap(header_inactive_pix), title_color);
    tm_bdr->setFixedHeight(top_bdr_height);
    layout->addWidget(tm_bdr, 0, 1);
    // bottom mid border
    bm_bdr = new Border(this);
    bm_bdr->setFixedHeight(bottom_bdr_height);
    bm_bdr->setCursor(Qt::SizeVerCursor);
    layout->addWidget(bm_bdr, 2, 1);
    // bottom left border
    bl_bdr = new Border(this);
    bl_bdr->setFixedSize(top_bdr_height, bottom_bdr_height);
    bl_bdr->setCursor(Qt::SizeBDiagCursor);
    layout->addWidget(bl_bdr, 2, 0);
    // bottom right border
    br_bdr = new Border(this);
    br_bdr->setFixedSize(top_bdr_height, bottom_bdr_height);
    br_bdr->setCursor(Qt::SizeFDiagCursor);
    layout->addWidget(br_bdr, 2, 2);
    // left border
    l_bdr = new Border(this);
    l_bdr->setCursor(Qt::SizeHorCursor);
    layout->addWidget(l_bdr, 1, 0);
    // right border
    r_bdr = new Border(this);
    r_bdr->setCursor(Qt::SizeHorCursor);
    layout->addWidget(r_bdr, 1, 2);

    if (frame_type == "Dialog") // no Max/Min on Dialog frames
    {
        tl_bdr->setEnabled(false);
    }

    // top left (icon)
    connect(tl_bdr, SIGNAL(mouse_left_press()), this, SLOT(iconify_it()));
    connect(tl_bdr, SIGNAL(mouse_right_press()), this, SLOT(maximize_it()));
    // top right (icon)
    connect(tr_bdr, SIGNAL(mouse_left_press()), this, SLOT(destroy_it()));
    // top mid (title bar)
    connect(tm_bdr, SIGNAL(mouse_double_click()), this, SLOT(iconify_it()));
    connect(tm_bdr, SIGNAL(mouse_left_press(QMouseEvent *)), this, SLOT(press_top_mid(QMouseEvent *)));
    connect(tm_bdr, SIGNAL(mouse_right_press()), this, SLOT(maximize_it()));
    connect(tm_bdr, SIGNAL(mouse_move(QMouseEvent *)), this, SLOT(move_top_mid(QMouseEvent *)));
    // bottom left
    connect(bl_bdr, SIGNAL(mouse_left_press(QMouseEvent *)), this, SLOT(press_bottom_left(QMouseEvent *)));
    connect(bl_bdr, SIGNAL(mouse_move(QMouseEvent *)), this, SLOT(move_bottom_left(QMouseEvent *)));
    // bottom right
    connect(br_bdr, SIGNAL(mouse_left_press(QMouseEvent *)), this, SLOT(press_bottom_right(QMouseEvent *)));
    connect(br_bdr, SIGNAL(mouse_move(QMouseEvent *)), this, SLOT(move_bottom_right(QMouseEvent *)));
    // bottom mid
    connect(bm_bdr, SIGNAL(mouse_left_press(QMouseEvent *)), this, SLOT(press_bottom_mid(QMouseEvent *)));
    connect(bm_bdr, SIGNAL(mouse_move(QMouseEvent *)), this, SLOT(move_bottom_mid(QMouseEvent *)));
    // left
    connect(l_bdr, SIGNAL(mouse_left_press(QMouseEvent *)), this, SLOT(press_left(QMouseEvent *)));
    connect(l_bdr, SIGNAL(mouse_move(QMouseEvent *)), this, SLOT(move_left(QMouseEvent *)));
    // right
    connect(r_bdr, SIGNAL(mouse_left_press(QMouseEvent *)), this, SLOT(press_right(QMouseEvent *)));
    connect(r_bdr, SIGNAL(mouse_move(QMouseEvent *)), this, SLOT(move_right(QMouseEvent *)));
}