void Button::MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) { // inherited Control::MouseInput(rMouse, iButton, iX, iY, dwKeyParam); // process left down and up if (fEnabled) switch (iButton) { case C4MC_Button_LeftDown: // mark button as being down SetDown(); // remember drag target // no dragging movement will be done w/o drag component assigned // but it should be remembered if the user leaves the button with the mouse down // and then re-enters w/o having released the button if (!rMouse.pDragElement) rMouse.pDragElement = this; break; case C4MC_Button_LeftUp: // only if button was down... (might have dragged here) if (fDown) { // it's now up :) SetUp(true); // process event OnPress(); } break; }; }
void CPropFloorButtonBase::TouchThink(void) { touchAmount = 0; CBaseEntity *pObject = NULL; while ((pObject = gEntList.FindEntityByClassname(pObject, "prop_weighted_cube")) != NULL) { HandleEntityTouch(pObject); } while ((pObject = gEntList.FindEntityByClassname(pObject, "prop_monster_box")) != NULL) { HandleEntityTouch(pObject); } while ((pObject = gEntList.FindEntityByClassname(pObject, "player")) != NULL) { HandleEntityTouch(pObject); } if (touchAmount == 0 && wasTouching) { OnPress(); } else if (touchAmount > 0 && !wasTouching) { OnUnpress(); } SetThink(&CPropFloorButtonBase::TouchThink); SetNextThink(gpGlobals->curtime + TICK_INTERVAL); }
bool Hotkey::_CallBack(MSG* msg){ if(msg->message==WM_HOTKEY) { OnPress((int)msg->wParam); return true; } return false; }
bool Button::KeyButtonUp() { // space press activates button if (!fDown) return false; SetUp(true); if (fEnabled) OnPress(); return true; }
bool Button::OnHotkey(uint32_t cHotkey) { // if hotkey matches, press the button if (this->cHotkey == cHotkey && fEnabled) { OnPress(); return true; } else return false; }
void Button::pressed(){ m_IsPressed = true; // This is the first time button pushed if(!m_IsActive){ m_IsActive = true; m_StartTime = millis(); } if(OnPress != 0){ OnPress(); } }
void Dialog::mousePressEvent(QMouseEvent* e) { if(e->button()==Qt::LeftButton) { this->isDrag=true; } QString *color; QString *title; switch (this->objectType) { case 1: color=new QString("border:2px groove gray;border-radius:10px;padding:2px 4px;background-color: rgb(255, 74, 19)"); title=new QString("开始"); break; case 2: color=new QString("border:2px groove gray;border-radius:10px;padding:2px 4px;background-color: rgb(255, 74, 19)"); title=new QString("结束"); break; case 3: color=new QString("background-color: rgb(33, 224, 255)"); title=new QString("自动"); break; case 4: color=new QString("background-color: rgb(84, 255, 160) "); title=new QString("人工"); break; case 5: color=new QString("background-color:rgb(255, 241, 42)"); title=new QString("条件"); break; default: QMessageBox::information(this, tr("Information"), "请选择节点类型"); return ; } QPushButton *btn=new QPushButton(this); title->append(QString(":%1").arg(this->lst->count(),this->objectType)); btn->setText(*title); btn->setGeometry(QRect(e->x()-50, e->y()-10, 100, 20)); btn->setStyleSheet(*color); btn->show(); btn->setObjectName(QString("btn%1").arg(this->lst->count())); connect(btn, SIGNAL(clicked()), this, SLOT(OnClicked())); connect(btn,SIGNAL(pressed()),this,SLOT(OnPress())); connect(btn,SIGNAL(released()),this,SLOT(OnRelease())); TaskNode *node=new TaskNode(btn,this->objectType); node->params=NULL; node->postTask=NULL; node->prevTask=NULL; node->majorTask=NULL; this->lst->append(node); //this->ui->txtLog->setText(QString(":%1").arg(this->lst->count())); }
void JButton::Press() { if (!m_bPressed) { Frame ext = GetLocalExt(); ext.x += float( m_PressDX ); ext.y += float( m_PressDY ); SetLocalExt( ext ); } m_bPressed = true; SendSignal( "Press" ); SendSignal( "Pressed" ); OnPress(); } // JButton::Press
void wxDynamicSashWindowImpl::OnPress(wxMouseEvent &event) { if (m_leaf) { m_leaf->OnPress(event); } else { m_dragging = m_split; m_drag_x = event.m_x; m_drag_y = event.m_y; DrawSash(m_drag_x, m_drag_y); m_container->CaptureMouse(); } }
void UI_Object::Pressed() { if(OnPress!=NULL) OnPress(); }