/** Draw the buttons on the dialog window. */ void DrawButtons(void) { ButtonNode button; int temp; Assert(dialog); dialog->buttonWidth = GetStringWidth(FONT_MENU, GetCancelString()); temp = GetStringWidth(FONT_MENU, GetOKString()); if(temp > dialog->buttonWidth) { dialog->buttonWidth = temp; } dialog->buttonWidth += 16; dialog->buttonHeight = dialog->lineHeight + 4; ResetButton(&button, dialog->pmap); button.border = 1; button.font = FONT_MENU; button.width = dialog->buttonWidth; button.height = dialog->buttonHeight; button.alignment = ALIGN_CENTER; dialog->okx = dialog->width / 3 - dialog->buttonWidth / 2; dialog->cancelx = 2 * dialog->width / 3 - dialog->buttonWidth / 2; dialog->buttony = dialog->height - dialog->lineHeight - dialog->lineHeight / 2; if(dialog->buttonState == DBS_OK) { button.type = BUTTON_MENU_ACTIVE; } else { button.type = BUTTON_MENU; } button.text = GetOKString(); button.x = dialog->okx; button.y = dialog->buttony; DrawButton(&button); if(dialog->buttonState == DBS_CANCEL) { button.type = BUTTON_MENU_ACTIVE; } else { button.type = BUTTON_MENU; } button.text = GetCancelString(); button.x = dialog->cancelx; button.y = dialog->buttony; DrawButton(&button); }
/** Draw the buttons on the dialog window. */ void DrawButtons(DialogType *dp) { ButtonNode button; int temp; Assert(dp); dp->buttonWidth = GetStringWidth(FONT_MENU, CANCEL_STRING); temp = GetStringWidth(FONT_MENU, OK_STRING); if(temp > dp->buttonWidth) { dp->buttonWidth = temp; } dp->buttonWidth += 16; dp->buttonHeight = dp->lineHeight + 4; ResetButton(&button, dp->node->window, rootGC); button.font = FONT_MENU; button.width = dp->buttonWidth; button.height = dp->buttonHeight; button.alignment = ALIGN_CENTER; dp->okx = dp->width / 3 - dp->buttonWidth / 2; dp->cancelx = 2 * dp->width / 3 - dp->buttonWidth / 2; dp->buttony = dp->height - dp->lineHeight - dp->lineHeight / 2; if(dp->buttonState == DBS_OK) { button.type = BUTTON_TASK_ACTIVE; } else { button.type = BUTTON_TASK; } button.text = OK_STRING; button.x = dp->okx; button.y = dp->buttony; DrawButton(&button); if(dp->buttonState == DBS_CANCEL) { button.type = BUTTON_TASK_ACTIVE; } else { button.type = BUTTON_TASK; } button.text = CANCEL_STRING; button.x = dp->cancelx; button.y = dp->buttony; DrawButton(&button); }
/** Draw a specific task bar. */ void Render(const TaskBarType *bp) { TaskEntry *tp; char *displayName; ButtonNode button; int x, y; if(JUNLIKELY(shouldExit)) { return; } ClearTrayDrawable(bp->cp); if(!taskEntries) { UpdateSpecificTray(bp->cp->tray, bp->cp); return; } ResetButton(&button, bp->cp->pixmap); button.border = settings.trayDecorations == DECO_MOTIF; button.font = FONT_TASKLIST; button.height = bp->itemHeight; button.width = bp->itemWidth; button.text = NULL; x = 0; y = 0; for(tp = taskEntries; tp; tp = tp->next) { if(!ShouldShowEntry(tp)) { continue; } /* Check for an active or urgent window and count clients. */ ClientEntry *cp; unsigned clientCount = 0; button.type = BUTTON_TASK; for(cp = tp->clients; cp; cp = cp->next) { if(ShouldFocus(cp->client, 0)) { const char flash = (cp->client->state.status & STAT_FLASH) != 0; const char active = (cp->client->state.status & STAT_ACTIVE) && IsClientOnCurrentDesktop(cp->client); if(flash || active) { if(button.type == BUTTON_TASK) { button.type = BUTTON_TASK_ACTIVE; } else { button.type = BUTTON_TASK; } } clientCount += 1; } } button.x = x; button.y = y; if(!tp->clients->client->icon) { button.icon = GetDefaultIcon(); } else { button.icon = tp->clients->client->icon; } displayName = NULL; if(tp->clients->client->className && settings.groupTasks) { if(clientCount != 1) { const size_t len = strlen(tp->clients->client->className) + 16; displayName = Allocate(len); snprintf(displayName, len, "%s (%u)", tp->clients->client->className, clientCount); button.text = displayName; } else { button.text = tp->clients->client->className; } } else { button.text = tp->clients->client->name; } DrawButton(&button); if(displayName) { Release(displayName); } if(bp->layout == LAYOUT_HORIZONTAL) { x += bp->itemWidth; } else { y += bp->itemHeight; } } UpdateSpecificTray(bp->cp->tray, bp->cp); }
CStepDlg::CStepDlg(CPaintWidget* pPaint, QListWidget* pList, QWidget* parent) : QDialog(parent), m_pPaint(pPaint), m_pList(pList) { //SuperTerminal sp; MoveValueSum = 0; CorrectNum = 0; GearNum = 0; fd =0; this->setWindowTitle(tr("step")); /*****************************/ //QVBoxLayout *topLayout = new QVBoxLayout();//垂直布局 //QVBoxLayout *testLayout = new QVBoxLayout(); /**************************/ QGridLayout *LeftLayout = new QGridLayout(); QGridLayout *RightLayout = new QGridLayout(); QHBoxLayout *mainLayout = new QHBoxLayout(); mainLayout->addLayout(LeftLayout); mainLayout->addLayout(RightLayout); //m_pButtonMove = new QPushButton(tr("移动")); m_pButtonMove = new QPushButton(QString::fromLocal8Bit("移动")); connect(m_pButtonMove, SIGNAL(clicked()), this, SLOT(MoveButton()));//clicked信号后调用MoveButton()槽函数 connect(m_pButtonMove, SIGNAL(clicked()), this, SLOT(setPosition())); LeftLayout->addWidget(m_pButtonMove,0,0); m_pLineMove = new QLineEdit(this); LeftLayout->addWidget(m_pLineMove,0,1); m_pButtonRecord = new QPushButton(QString::fromLocal8Bit("记录")); connect(m_pButtonRecord, SIGNAL(clicked()), this, SLOT(RecordButton())); connect(m_pButtonRecord, SIGNAL(clicked()), this, SLOT(setPosition())); LeftLayout->addWidget(m_pButtonRecord,1,0); m_pButtonErrnum = new QPushButton(QString::fromLocal8Bit("无法矫正齿位")); connect(m_pButtonErrnum, SIGNAL(clicked()), this, SLOT(ErrnumButton())); connect(m_pButtonErrnum, SIGNAL(clicked()), this, SLOT(setPosition())); LeftLayout->addWidget(m_pButtonErrnum,1,1); m_pButtonZerocorrect = new QPushButton(QString::fromLocal8Bit("零位调整")); connect(m_pButtonZerocorrect, SIGNAL(clicked()), this, SLOT(ZerocorrectButton())); connect(m_pButtonZerocorrect, SIGNAL(clicked()), this, SLOT(setPosition())); LeftLayout->addWidget(m_pButtonZerocorrect,2,0); m_pButtonSinglecorrect = new QPushButton(QString::fromLocal8Bit("单齿调整")); connect(m_pButtonSinglecorrect, SIGNAL(clicked()), this, SLOT(SinglecorrectButton())); connect(m_pButtonSinglecorrect, SIGNAL(clicked()), this, SLOT(setPosition())); LeftLayout->addWidget(m_pButtonSinglecorrect,2,1); m_pButtonDatareset = new QPushButton(QString::fromLocal8Bit("数据重置")); connect(m_pButtonDatareset, SIGNAL(clicked()), this, SLOT(DataresetButton())); connect(m_pButtonDatareset, SIGNAL(clicked()), this, SLOT(setPosition())); LeftLayout->addWidget(m_pButtonDatareset,3,0); m_pComboDataReset = new QComboBox(); m_pComboDataReset->addItem(QString::fromLocal8Bit("")); m_pComboDataReset->addItem(QString::fromLocal8Bit("清除全部数据")); m_pComboDataReset->addItem(QString::fromLocal8Bit("重置矫正数据")); m_pComboDataReset->addItem(QString::fromLocal8Bit("清除全齿数据")); m_pComboDataReset->addItem(QString::fromLocal8Bit("清除半齿数据")); LeftLayout->addWidget(m_pComboDataReset,3,1); m_pButtonForward = new QPushButton(QString::fromLocal8Bit("前进")); connect(m_pButtonForward, SIGNAL(clicked()), this, SLOT(ForwardButton())); connect(m_pButtonForward, SIGNAL(clicked()), this, SLOT(setPosition())); RightLayout->addWidget(m_pButtonForward,0,0); m_pButtonBackward = new QPushButton(QString::fromLocal8Bit("后退")); connect(m_pButtonBackward, SIGNAL(clicked()), this, SLOT(BackwardButton())); connect(m_pButtonBackward, SIGNAL(clicked()), this, SLOT(setPosition())); RightLayout->addWidget(m_pButtonBackward,1,0); m_pButtonReset = new QPushButton(QString::fromLocal8Bit("复位")); connect(m_pButtonReset, SIGNAL(clicked()), this, SLOT(ResetButton())); connect(m_pButtonReset, SIGNAL(clicked()), this, SLOT(setPosition())); RightLayout->addWidget(m_pButtonReset,2,0); m_pLabelPace = new QLabel(QString::fromLocal8Bit("步距")); RightLayout->addWidget(m_pLabelPace,3,0); m_pComboPace = new QComboBox(); m_pComboPace->addItem(QString::fromLocal8Bit("")); m_pComboPace->addItem(QString::fromLocal8Bit("2mm")); m_pComboPace->addItem(QString::fromLocal8Bit("4mm")); m_pComboPace->addItem(QString::fromLocal8Bit("8mm")); m_pComboPace->addItem(QString::fromLocal8Bit("12mm")); RightLayout->addWidget(m_pComboPace,3,1); this->setLayout(mainLayout); /*************接收处理****************/ /* SuperTerminal sp; sp.read_from_serial(); sp.call_handle(); getchar();*/ }