bool LinkLabel::onProcessMessage(Message* msg) { switch (msg->type) { case JM_SETCURSOR: // TODO theme stuff if (isEnabled()) { jmouse_set_cursor(kHandCursor); return true; } break; case JM_MOUSEENTER: case JM_MOUSELEAVE: // TODO theme stuff if (isEnabled()) invalidate(); break; case JM_BUTTONRELEASED: if (isEnabled()) { if (!m_url.empty()) Launcher::openUrl(m_url); Click(); } break; } return CustomLabel::onProcessMessage(msg); }
void UUIActionCommand::PopulateClock( Clock* inClock, int index ) { clock = inClock; // Recall cooldown's time from the action object (model object) // Set the cooldown's time at Populate time. Too early to do in ctor // (UClass data may not have loaded) cooldown.TotalTime = GetCooldownTotalTime(); // attach Action's Click() function to clicking on the clock. UUICmdActionIndex = index; // index inside the array that hosts the Counters. clock->SetTexture( GetIcon() ); // Set the cooldown amount to being the cooldown of the particular action clock->SetFillFraction( cooldown.Fraction() ); //info( FS( "Populating clock `%s` with cooldown=%f/%f", // *clock->Name, cooldown.Time, cooldown.TotalTime ) ); clock->Show(); // Invoke I'th action of the object clock->OnMouseDownLeft = [this]( FVector2D mouse ) -> EventCode { Click(); info( FS( "Clicked Action %s", *GetName() ) ); return Consumed; }; clock->OnHover = [this]( FVector2D mouse ) -> EventCode { Hover(); return NotConsumed; }; }
virtual void ProcessClick(class FSceneView& View, class HHitProxy* HitProxy, FKey Key, EInputEvent Event, uint32 HitX, uint32 HitY) override { if (Widget.IsValid() && Widget->OnClick.IsBound()) { FJavascriptHitProxy Proxy; Proxy.HitProxy = HitProxy; FViewportClick Click(&View, this, Key, Event, HitX, HitY); Widget->OnClick.Execute(FJavascriptViewportClick(&Click), Proxy, Widget.Get()); } }
afx_msg void CLayerView::OnRButtonUp(UINT flags, CPoint point) { CRect client_rect; GetClientRect(&client_rect); HMENU _menu = LoadMenu(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDR_LAYERVIEW)); HMENU menu = GetSubMenu(_menu, 0); // simulate a left click to set the selected layer Click(point.x, point.y, false); if (AreLayersLockedInPlace()) { CheckMenuItem(menu, ID_LAYERVIEW_TOGGLE_LOCK_LAYERS_IN_PLACE, MF_BYCOMMAND | MF_CHECKED); } // make sure the right things are greyed and stuff if (point.x >= 0 && point.x < client_rect.right && point.y >= 0 && point.y < LAYER_BUTTON_HEIGHT * m_Map->GetNumLayers()) { // enable delete command if it's available if (m_Map->GetNumLayers() > 1) EnableMenuItem(menu, ID_LAYERVIEW_DELETELAYER, MF_BYCOMMAND | MF_ENABLED); else EnableMenuItem(menu, ID_LAYERVIEW_DELETELAYER, MF_BYCOMMAND | MF_GRAYED); int num_visible = 0; for (int i = 0; i < m_Map->GetNumLayers(); i++) { if (m_Map->GetLayer(i).IsVisible()) { num_visible += 1; } } if (num_visible > 0) { EnableMenuItem(menu, ID_LAYERVIEW_EXPORT_ALL_VISIBLE_LAYERS_AS_IMAGE, MF_BYCOMMAND | MF_ENABLED); } else { EnableMenuItem(menu, ID_LAYERVIEW_EXPORT_ALL_VISIBLE_LAYERS_AS_IMAGE, MF_BYCOMMAND | MF_GRAYED); } if (num_visible > 1) { EnableMenuItem(menu, ID_LAYERVIEW_FLATTEN_VISIBLE_LAYERS, MF_BYCOMMAND | MF_ENABLED); } else { EnableMenuItem(menu, ID_LAYERVIEW_FLATTEN_VISIBLE_LAYERS, MF_BYCOMMAND | MF_GRAYED); } if (m_SelectedLayer == m_Map->GetNumLayers() - 1 || !(m_Map->GetNumLayers() > 1)) { EnableMenuItem(menu, ID_LAYERVIEW_MOVE_UP, MF_BYCOMMAND | MF_GRAYED); } if (m_SelectedLayer == 0 || !(m_Map->GetNumLayers() > 1)) { EnableMenuItem(menu, ID_LAYERVIEW_MOVE_DOWN, MF_BYCOMMAND | MF_GRAYED); } EnableMenuItem(menu, ID_LAYERVIEW_PROPERTIES, MF_BYCOMMAND | MF_ENABLED); ClientToScreen(&point); TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON, point.x, point.y, 0, m_hWnd, NULL); } }
XamlView HyperlinkViewManager::CreateViewCore(int64_t tag) { auto button = winrt::HyperlinkButton(); button.Click([=](auto &&, auto &&) { auto instance = m_wkReactInstance.lock(); folly::dynamic eventData = folly::dynamic::object("target", tag); if (instance != nullptr) instance->DispatchEvent(tag, "topClick", std::move(eventData)); }); return button; }
void StickyChoice::Key(const KeyInput &key) { if (!HasFocus()) { return; } // TODO: Replace most of Update with this. if (key.flags & KEY_DOWN) { if (IsAcceptKeyCode(key.keyCode)) { down_ = true; Click(); } } }
void wxButton::Toggle() { if ( m_isPressed ) Release(); else Press(); if ( !m_isPressed ) { // releasing button after it had been pressed generates a click event Click(); } }
void Model::DblClick(int i, int j) { int flags = NumberOfNeighborFlags(i, j); if (table[i][j] == flags) { Click(i - 1, j - 1); Click(i - 1, j); Click(i - 1, j + 1); Click(i, j - 1); Click(i, j + 1); Click(i + 1, j - 1); Click(i + 1, j); Click(i + 1, j + 1); } }
bool Button::OnMouseUp(PixelScalar x, PixelScalar y) { if (!dragging) return true; dragging = false; ReleaseCapture(); if (!down) return true; Click(); return true; }
bool StickyChoice::Key(const KeyInput &key) { if (!HasFocus()) { return false; } // TODO: Replace most of Update with this. if (key.flags & KEY_DOWN) { if (IsAcceptKey(key)) { down_ = true; Click(); return true; } } return false; }
bool ButtonWindow::OnKeyDown(unsigned key_code) { switch (key_code) { #ifdef GNAV case VK_F4: #endif case VK_RETURN: Click(); return true; default: return BaseButtonWindow::OnKeyDown(key_code); } }
void wxToggleButton::Toggle() { if ( m_isPressed ) Release(); else Press(); if ( !m_isPressed ) { // releasing button after it had been pressed generates a click event // and toggles value m_value = !m_value; Click(); } }
void StickyChoice::Touch(const TouchInput &input) { dragging_ = false; if (!IsEnabled()) { down_ = false; return; } if (input.flags & TOUCH_DOWN) { if (bounds_.Contains(input.x, input.y)) { if (IsFocusMovementEnabled()) SetFocusedView(this); down_ = true; Click(); } } }
bool ButtonWindow::OnKeyDown(unsigned key_code) { switch (key_code) { #ifdef GNAV case VK_F4: // using F16 also as Enter-Key. This allows to use the RemoteStick of Altair to do a "click" on the focused button case VK_F16: #endif case VK_RETURN: Click(); return true; default: return BaseButtonWindow::OnKeyDown(key_code); } }
void SeView::mouseReleaseEvent(QMouseEvent* e) { e->accept(); Mpressed = false; /* if (e->button() == RightButton) { QPopupMenu *pmen = new QPopupMenu(); qApp->setOverrideCursor(QCursor(Qt::ArrowCursor), true); int px = pmen->insertItem( tr("Show Master Page Names"), this, SLOT(ToggleNam())); if (Namen) pmen->setItemChecked(px, true); pmen->exec(QCursor::pos()); delete pmen; } */ emit Click(rowAt(e->pos().y()), columnAt(e->pos().x()), e->button()); QTableWidget::mouseReleaseEvent(e); }
bool wxButton::PerformAction(const wxControlAction& action, long numArg, const wxString& strArg) { if ( action == wxACTION_BUTTON_TOGGLE ) Toggle(); else if ( action == wxACTION_BUTTON_CLICK ) Click(); else if ( action == wxACTION_BUTTON_PRESS ) Press(); else if ( action == wxACTION_BUTTON_RELEASE ) Release(); else return wxControl::PerformAction(action, numArg, strArg); return true; }
void Clickable::Update(const InputState &input_state) { if (!HasFocus()) return; if (!enabled_) { down_ = false; return; } if (input_state.pad_buttons_down & PAD_BUTTON_A) { down_ = true; } else if (input_state.pad_buttons_up & PAD_BUTTON_A) { if (down_) { Click(); } } }
bool GboxInstance::HandleMouse(const pp::MouseInputEvent& event) { PP_InputEvent_MouseButton button = event.GetButton(); int32_t clicks = event.GetClickCount(); pp::Point pt = event.GetPosition(); int32_t type = event.GetType(); if (sca() == 0x3) theLog.info("+Mouse: ty:%d at:%d,%d but:%d clicks:%d", type, pt.x(), pt.y(), button, clicks); if (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEDOWN && button == 0) { m_mouse_down0 = pt; m_time_at_mouse_down0 = m_core->GetTimeTicks(); } if (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEDOWN && button == 2) { m_mouse_down2 = pt; m_time_at_mouse_down2 = m_core->GetTimeTicks(); } if (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEMOVE) { if (m_time_at_mouse_down0) { // drag dynamics logic PP_TimeTicks now = m_core->GetTimeTicks(); bool is_drag = false; double dx = pt.x() - m_mouse_down0.x(); double dy = pt.y() - m_mouse_down0.y(); if (sqrt(dx * dx + dy * dy) > 30) is_drag = true; if (now - m_time_at_mouse_down0 > 0.2) is_drag = true; if (is_drag) { Drag(m_mouse_down0.x(), m_mouse_down0.y(), m_mouse_down0.x() - pt.x(), m_mouse_down0.y() - pt.y(), sca()); m_mouse_down0 = pt; } } } if (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEUP) { PP_TimeTicks now = m_core->GetTimeTicks(); double diff = now - (button == 0 ? m_time_at_mouse_down0 : m_time_at_mouse_down2); Click(pt.x(), pt.y(), button, sca(), diff); if (button == 0) m_time_at_mouse_down0 = 0; else m_time_at_mouse_down2 = 0; } return true; }
void GameEngine::setMainTank(Tank *tank) { MainWindow *mainwindow = reinterpret_cast<MainWindow *>(parent()); camera->setCentralizeObject(tank); connect(mainwindow, SIGNAL(MoveTankAction(int)), tank, SLOT(MoveVehicle(int))); connect(mainwindow, SIGNAL(TankFire()), tank, SLOT(Fire())); connect(tank, SIGNAL(sigFireValue(int)), mainwindow, SLOT(setFireProgress(int))); connect(tank, SIGNAL(sigLifeValue(int)), mainwindow, SLOT(setLifeProgress(int))); connect(camera, SIGNAL(Click()), tank, SLOT(Fire())); camera->setCentralizeObject(tank); tank->setFireValue(100); tank->setLifeValue(100); connect(tank, SIGNAL(ChangeStatus()), protocol, SLOT(SendMovement())); connect(tank, SIGNAL(ChangeStatus(bool)), protocol, SLOT(SendMovement(bool))); my_tank = tank; tank->setLifeValue(100); }
void CommandButton::Judge(){ if( !(GetMouseInput() & MOUSE_INPUT_LEFT) ){ return; } int x; int y; GetMousePoint( &x , &y ); if ( x > Left && y > Top && x < Left+Width && y < Top + Height ){ if( Func != NULL ){ Func(); } else { Click(); } } }
void kwxBitmapButton::OnMouse(wxMouseEvent& event) { if (m_stato == 0 && event.Entering()) m_stato = 1; // mouse sul bottone else if (m_stato == 1 && event.LeftDown()) m_stato = 2; // uscita click sul bottone else if (m_stato >= 1 && event.Leaving()) m_stato = 0; // uscita mouse dal bottone else if (m_stato == 2 && event.LeftUp()) { Click(); // rilascio sul bottone genera evento m_stato = 1; } if(m_oldstato != m_stato) Refresh(); m_oldstato=m_stato; event.Skip(); }
void Clickable::Key(const KeyInput &key) { if (!HasFocus() && key.deviceId != DEVICE_ID_MOUSE) { down_ = false; return; } // TODO: Replace most of Update with this. if (key.flags & KEY_DOWN) { if (IsAcceptKeyCode(key.keyCode)) { down_ = true; } } if (key.flags & KEY_UP) { if (IsAcceptKeyCode(key.keyCode)) { if (down_) { Click(); down_ = false; } } else if (IsEscapeKeyCode(key.keyCode)) { down_ = false; } } }
bool C_Mouse::RightClick() { return Click(SDL_BUTTON_RIGHT); }
bool C_Mouse::MiddleClick() { return Click(SDL_BUTTON_MIDDLE); }
bool C_Mouse::LeftClick() { return Click(SDL_BUTTON_LEFT); }
void AButton::OnMouseEvent(wxMouseEvent & event) { wxSize clientSize = GetClientSize(); AButtonState prevState = GetState(); if (event.Entering()) mCursorIsInWindow = true; else if (event.Leaving()) mCursorIsInWindow = false; else mCursorIsInWindow = (event.m_x >= 0 && event.m_y >= 0 && event.m_x < clientSize.x && event.m_y < clientSize.y); if (HasAlternateImages() && !mButtonIsDown) mAlternate = event.ShiftDown(); if (mEnabled && event.IsButton()) { if (event.ButtonIsDown(wxMOUSE_BTN_ANY)) { mIsClicking = true; CaptureMouse(); } else if (mIsClicking) { mIsClicking = false; if (HasCapture()) ReleaseMouse(); if (mCursorIsInWindow && (mToggle || !mButtonIsDown)) { if (mToggle) mButtonIsDown = !mButtonIsDown; else mButtonIsDown = true; mWasShiftDown = event.ShiftDown(); mWasControlDown = event.ControlDown(); Click(); } } } // Only redraw and change tooltips if the state has changed. AButtonState newState = GetState(); if (newState != prevState) { Refresh(false); if (mCursorIsInWindow) { #if wxUSE_TOOLTIPS // Not available in wxX11 // Display the tooltip in the status bar wxToolTip * pTip = this->GetToolTip(); if( pTip ) { wxString tipText = pTip->GetTip(); if (!mEnabled) tipText += _(" (disabled)"); GetActiveProject()->TP_DisplayStatusMessage(tipText); } #endif } else { GetActiveProject()->TP_DisplayStatusMessage(wxT("")); } } }
void ButtonBase::OnClick() { RoutedEventArgs* rea = new RoutedEventArgs(); //rea->_originalSource = this; Click(this, rea); }
void AButton::OnMouseEvent(wxMouseEvent & event) { wxSize clientSize = GetClientSize(); AButtonState prevState = GetState(); if (event.Entering()) { // Bug 1201: On Mac, unsetting and re-setting the tooltip may be needed // to make it pop up when we want it. auto text = GetToolTipText(); UnsetToolTip(); SetToolTip(text); mCursorIsInWindow = true; } else if (event.Leaving()) mCursorIsInWindow = false; else mCursorIsInWindow = (event.m_x >= 0 && event.m_y >= 0 && event.m_x < clientSize.x && event.m_y < clientSize.y); if (mEnabled && event.IsButton()) { if (event.ButtonIsDown(wxMOUSE_BTN_ANY)) { mIsClicking = true; if (event.ButtonDClick()) mIsDoubleClicked = true; if( !HasCapture() ) CaptureMouse(); } else if (mIsClicking) { mIsClicking = false; if (HasCapture()) ReleaseMouse(); if (mCursorIsInWindow && (mToggle || !mButtonIsDown)) { if (mToggle) mButtonIsDown = !mButtonIsDown; else mButtonIsDown = true; mWasShiftDown = event.ShiftDown(); mWasControlDown = event.ControlDown(); Click(); } } } // Only redraw and change tooltips if the state has changed. AButtonState newState = GetState(); if (newState != prevState) { Refresh(false); if (mCursorIsInWindow) UpdateStatus(); else { GetActiveProject()->TP_DisplayStatusMessage(wxT("")); } } else event.Skip(); }
void wxExConfigDialog::OnCommand(wxCommandEvent& command) { if (command.GetId() < wxID_LOWEST) { #ifdef wxExUSE_CPP0X auto it = FindConfigItem(command.GetId()); #else std::vector<wxExConfigItem>::const_iterator it = FindConfigItem(command.GetId()); #endif if (it != m_ConfigItems.end()) { if (it->GetType() == CONFIG_COMBOBOXDIR) { wxComboBox* browse = (wxComboBox*)it->GetWindow(); wxDirDialog dir_dlg( this, _(wxDirSelectorPromptStr), browse->GetValue(), wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST); if (dir_dlg.ShowModal() == wxID_OK) { const wxString value = dir_dlg.GetPath(); const int item = browse->FindString(value); if (item == wxNOT_FOUND) { browse->SetSelection(browse->Append(value)); } else { browse->SetSelection(item); } } } else if (it->GetType() == CONFIG_BUTTON) { Click(command.GetId()); } else { wxFAIL; } } } else if (command.GetId() == wxID_CANCEL) { Reload(); } else { for_each (m_ConfigItems.begin(), m_ConfigItems.end(), std::bind2nd(std::mem_fun_ref(&wxExConfigItem::ToConfig), true)); } if ( command.GetId() == wxID_APPLY || ((command.GetId() == wxID_OK || command.GetId() == wxID_CANCEL) && !IsModal())) { Click(command.GetId()); } command.Skip(); }
void ButtonBase::onClick(Event& ev) { // Fire Click() signal Click(ev); }