/* SectorPropsPanel::onTextureClicked * Called when a texture canvas is clicked *******************************************************************/ void SectorPropsPanel::onTextureClicked(wxMouseEvent& e) { // Get canvas FlatTexCanvas* tc = NULL; FlatComboBox* cb = NULL; if (e.GetEventObject() == gfx_floor) { tc = gfx_floor; cb = fcb_floor; } else if (e.GetEventObject() == gfx_ceiling) { tc = gfx_ceiling; cb = fcb_ceiling; } if (!tc) { e.Skip(); return; } // Browse MapTextureBrowser browser(this, 1, tc->getTexName(), &(theMapEditor->mapEditor().getMap())); if (browser.ShowModal() == wxID_OK) cb->SetValue(browser.getSelectedItem()->getName()); }
void HexEditorCtrl::ShowContextMenu( const wxMouseEvent& event ){ wxMenu menu; unsigned TagPosition=0; if( event.GetEventObject() == hex_ctrl ) TagPosition = page_offset + (hex_ctrl->PixelCoordToInternalPosition( event.GetPosition() ) / 2); if( event.GetEventObject() == text_ctrl ) TagPosition = page_offset + text_ctrl->PixelCoordToInternalPosition( event.GetPosition() ); TagElement *TAG; for( unsigned i = 0 ; i < MainTagArray.Count() ; i++ ){ TAG = MainTagArray.Item(i); if( TAG->isCover( TagPosition ) ){ //end not included! menu.Append(idTagEdit, _T("Tag Edit")); break; } } if( select->GetState() ){ menu.Append(idTagAddSelection, _T("Tag Selection")); menu.Append(idTagQuick, _T("Tag Selection")); } // menu.AppendSeparator(); wxPoint pos = event.GetPosition(); wxWindow *scr = static_cast<wxWindow*>( event.GetEventObject() ); pos += scr->GetPosition(); PopupMenu(&menu, pos); }
void HexEditorCtrl::OnMouseMove( wxMouseEvent& event ){ if(event.m_leftDown){ //if left button is pressed int new_hex_location=0; // initialize new_hex_location variable if( event.GetEventObject() == hex_ctrl ) // if this event from hex_ctrl area new_hex_location = hex_ctrl->PixelCoordToInternalPosition( event.GetPosition() ); //than take it's location on hex chars else if ( event.GetEventObject() == text_ctrl ) //if we got this event from text area new_hex_location = 2*(text_ctrl->PixelCoordToInternalPosition( event.GetPosition() )); //Than we needed to multiply with 2 for take it's hex location. int old_hex_location = GetLocalHexInsertionPoint(); //requesting old hex location if( new_hex_location != old_hex_location ){ //if hex selection addresses are different, start selection routine if( not select->GetState() ) //if this is new selection start if( Selector() == false ) //and select without focus return; //don't make anything. SetLocalHexInsertionPoint( new_hex_location ); //Moving cursor to new location. Selector(); //Making actual selection. PaintSelection(); } } else{ if( event.GetEventObject() == hex_ctrl or event.GetEventObject() == text_ctrl or event.GetEventObject() == offset_ctrl ){ TagElement* tg = static_cast<wxHexCtrl*>(event.GetEventObject())->GetTagByPix( event.GetPosition() ); if( (tg == NULL and TAGMutex==true) or //If there is no Tag at under and tag mutex available (tg != NULL and not tg->visible) ) // or Changed to new tag TagHideAll(); } event.Skip(); //enable tags but problems with paint? } }
void cbAuiNotebook::OnMotion(wxMouseEvent& event) { event.Skip(); wxAuiTabCtrl* tabCtrl = (wxAuiTabCtrl*)event.GetEventObject(); if (!tabCtrl) return; cbAuiNotebook* nb = (cbAuiNotebook*)tabCtrl->GetParent(); if (!nb || !nb->m_HasToolTip) return; wxWindow* win = nullptr; if (event.Moving() && tabCtrl->TabHitTest(event.m_x, event.m_y, &win)) { if (!win) { tabCtrl->UnsetToolTip(); return; } wxString text(win->GetName()); // If the text changes, set it else, keep old, to avoid // 'moving tooltip' effect wxToolTip* tooltip = tabCtrl->GetToolTip(); if (!tooltip || tooltip->GetTip() != text) tabCtrl->SetToolTip(text); } else tabCtrl->UnsetToolTip(); }
void PANEL_PREV_3D::onMouseWheelOffset( wxMouseEvent& event ) { wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject(); double step = OFFSET_INCREMENT_MM; if( event.ShiftDown( ) ) step = OFFSET_INCREMENT_MM_FINE; if( m_userUnits == INCHES ) { step = OFFSET_INCREMENT_MIL/1000.0; if( event.ShiftDown( ) ) step = OFFSET_INCREMENT_MIL_FINE/1000.0; } if( event.GetWheelRotation() >= 0 ) step = -step; double curr_value = DoubleValueFromString( m_userUnits, textCtrl->GetValue() ) / IU_PER_MM; curr_value += step; curr_value = std::max( -MAX_OFFSET, curr_value ); curr_value = std::min( curr_value, MAX_OFFSET ); textCtrl->SetValue( formatOffsetValue( curr_value ) ); }
// ---------------------------------------------------------------------------- void ThreadSearchLoggerTree::OnMouseWheelEvent(wxMouseEvent& event) // ---------------------------------------------------------------------------- { // Ctrl-MouseWheel rotation changes treeCtrl font //-wxWindow* pParent = m_pListLog->GetParent(); wxWindow* pParent = (wxWindow*)event.GetEventObject(); //-wxWindow* pParent = m_pListLog; if ( not pParent ) return; bool mouseCtrlKeyDown = event.ControlDown(); #ifdef LOGGING //LOGIT(wxT("treeCtrl:OnMouseWheel[%s]"), m_MouseCtrlKeyDown?wxT("Down"):wxT("UP") ); #endif if (not mouseCtrlKeyDown) {event.Skip(); return;} int nRotation = event.GetWheelRotation(); wxFont ctrlFont = pParent->GetFont(); if ( nRotation > 0) ctrlFont.SetPointSize( ctrlFont.GetPointSize()-1); else ctrlFont.SetPointSize( ctrlFont.GetPointSize()+1); pParent->SetFont(ctrlFont); pParent->Refresh(); pParent->Update(); return; }
void CChatWnd::OnNMRclickChatTab(wxMouseEvent& evt) { // Only handle events from the chat-notebook if (evt.GetEventObject() != (wxObject*)chatselector) return; if (chatselector->GetSelection() == -1) { return; } // Avoid opening another menu when it's already open if (m_menu == NULL) { m_menu = new wxMenu(_("Chat")); m_menu->Append(MP_CLOSE_TAB, wxString(_("Close tab"))); m_menu->Append(MP_CLOSE_ALL_TABS, wxString(_("Close all tabs"))); m_menu->Append(MP_CLOSE_OTHER_TABS, wxString(_("Close other tabs"))); m_menu->AppendSeparator(); wxMenuItem * addFriend = m_menu->Append(MP_ADDFRIEND, _("Add to Friends")); // Disable this client if it is already a friend CClientRef client; if (chatselector->GetCurrentClient(client) && client.IsFriend()) { addFriend->Enable(false); } PopupMenu(m_menu, evt.GetPosition()); delete m_menu; m_menu = NULL; } }
void UserEvaluationFrame::handleMouseClick(wxMouseEvent& event) { for (int a=0;a<8;a++) { if (event.GetEventObject()==evaluationPanels[a]) { cout_ << "CLICKED ON PANEL " << a << endl; networkPanel->setTarget(evaluationPanels[a]->getIndividual()); new thread( boost::bind( &EvaluationPanel::setTarget, highResPanel, experimentRun->getExperiment(), evaluationPanels[a]->getIndividual() ) ); //new thread( boost::bind(&UserEvaluationFrame::processHighResImage,this,evaluationPanels[a]->getIndividual()) ); //processHighResImage(evaluationPanels[a]->getIndividual()); } } cout_ << "Clicked!\n"; event.Skip(); }
//------EVENTS---------// void HexEditorCtrl::OnMouseLeft(wxMouseEvent& event){ select->SetState( false ); ClearPaint(); if( event.GetEventObject() == hex_ctrl ){ hex_ctrl->SetFocus(); focus=HEX_CTRL; SetLocalHexInsertionPoint( hex_ctrl->PixelCoordToInternalPosition( event.GetPosition() ) ); } else if( event.GetEventObject() == text_ctrl ){ text_ctrl->SetFocus(); focus=TEXT_CTRL; SetLocalHexInsertionPoint( 2 * text_ctrl->PixelCoordToInternalPosition( event.GetPosition() ) + 1); } else if( event.GetEventObject() == offset_ctrl ){ event.Skip(); //to lower level for copy offset to clipboard } }
void TrackPropDlg::m_hyperlinkContextMenu( wxMouseEvent &event ) { m_pEditedLink = (wxHyperlinkCtrl*) event.GetEventObject(); m_scrolledWindowLinks->PopupMenu( m_menuLink, m_pEditedLink->GetPosition().x + event.GetPosition().x, m_pEditedLink->GetPosition().y + event.GetPosition().y ); }
void ImageButton::OnMouseDown(wxMouseEvent& evt) { wxWindow* w = static_cast<wxWindow*>(evt.GetEventObject()); w->CaptureMouse(); pressed_ = true; SetState(_T("Down")); Update(); }
void wxCodeCompletionBoxManager::OnStcLeftDown(wxMouseEvent& event) { if(m_box && m_stc && m_box->IsShown() && event.GetEventObject() == m_stc) { m_box->StcLeftDown(event); } else { event.Skip(); } }
void CRenderWnd::OnLeave( wxMouseEvent &event ) { TRACEUSER( "Luke", _T("OnLeave %p\n"), event.GetEventObject() ); // if( event.GetEventObject() != m_pFrame ) // return; ::wxSetCursor( *wxSTANDARD_CURSOR ); }
void ImageButton::OnMouseOver(wxMouseEvent& evt) { wxWindow* w = static_cast<wxWindow*>(evt.GetEventObject()); if (pressed_) { SetState(_T("Down")); } else { SetState(_T("Over")); } }
void ModifyFunctionsWindow::OnSelectFunction(wxMouseEvent& event) { this->mainPanel->Hide(); this->secondaryPanel->Show(); auto* selectedButton = dynamic_cast<wxButton*>(event.GetEventObject()); auto* nameText = new wxStaticText(secondaryPanel, wxID_ANY, "Name"); this->functionName->SetLabel(selectedButton->GetLabel().ToStdString()); auto* parametersText = new wxStaticText(secondaryPanel, wxID_ANY, "Parameters"); this->parametersEntry->SetValue(this->mathData->functions.at(selectedButton->GetLabel().ToStdString()).first); auto* bodyText = new wxStaticText(secondaryPanel, wxID_ANY, "Body"); this->bodyEntry->SetValue(this->mathData->functions.at(selectedButton->GetLabel().ToStdString()).second); auto* modifyButton = new wxButton(secondaryPanel, wxID_ANY, "Modify"); auto* deleteButton = new wxButton(secondaryPanel, wxID_DELETE); auto* buttonSizer = new wxBoxSizer(wxHORIZONTAL); buttonSizer->Add(modifyButton, 0u, wxALIGN_CENTER | wxALL, 5u); buttonSizer->Add(deleteButton, 0u, wxALIGN_CENTER | wxALL, 5u); auto* bottomSizer = new wxBoxSizer(wxVERTICAL); bottomSizer->Add(nameText, 0u, wxALL, 3u); bottomSizer->Add(functionName, 0u, wxEXPAND | wxALL, 5u); bottomSizer->Add(parametersText, 0u, wxALL, 5u); bottomSizer->Add(parametersEntry, 0u, wxEXPAND | wxALL, 5u); bottomSizer->Add(bodyText, 0u, wxALL, 5u); bottomSizer->Add(bodyEntry, 0u, wxALL, 5u); bottomSizer->Add(buttonSizer, 0u, wxALIGN_CENTER | wxALL, 5u); this->secondaryPanel->SetSizer(bottomSizer); auto& font = wxFont(8u, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD); nameText->SetFont(font); parametersText->SetFont(font); bodyText->SetFont(font); this->mainSizer->Add(secondaryPanel); this->secondaryPanel->FitInside(); this->mainSizer->Fit(this); this->mainSizer->SetSizeHints(this); modifyButton->Bind(wxEVT_LEFT_DOWN, &ModifyFunctionsWindow::OnModifyFunction, this); deleteButton->Bind(wxEVT_LEFT_DOWN, &ModifyFunctionsWindow::OnDeleteFunction, this); }
void HexEditorCtrl::OnMouseRight( wxMouseEvent& event ){ if(event.GetEventObject() == hex_ctrl) LastRightClickAt = hex_ctrl->PixelCoordToInternalPosition( event.GetPosition() )/2; else if(event.GetEventObject() == text_ctrl) LastRightClickAt = text_ctrl->PixelCoordToInternalPosition( event.GetPosition() ); else if( event.GetEventObject() == offset_ctrl) { //m_static_offset->SetLabel( offset_ctrl->hex_offset==true ? _("Offset: DEC") : _("Offset: HEX")); //event.Skip(true); offset_ctrl->OnMouseRight( event ); int x,y; DoGetSize(&x,&y); wxSizeEvent mevent(wxSize(x,y)); OnResize(mevent); return;//to avoid ShowContextMenu } else std::cout << "Right click captured without ctrl!\n"; ShowContextMenu( event ); }
void wxRibbonPanel::OnMouseLeaveChild(wxMouseEvent& evt) { wxPoint pos = evt.GetPosition(); wxWindow *child = wxDynamicCast(evt.GetEventObject(), wxWindow); if(child) { pos += child->GetPosition(); TestPositionForHover(pos); } evt.Skip(); }
/***************************************************** ** ** BasicView --- OnContextMenuEvent ** ******************************************************/ void BasicView::OnContextMenuEvent( wxMouseEvent& event) { int x, y; x = event.m_x; y = event.m_y; wxWindow *window = (wxWindow*)event.GetEventObject(); window->ClientToScreen( &x, &y ); this->ScreenToClient( &x, &y ); wxMenu *menu = getContextMenu(); PopupMenu( menu, x, y ); delete menu; }
void VideoConfigDiag::Evt_LeaveControl(wxMouseEvent& ev) { // look up description text control and reset its label wxWindow* ctrl = (wxWindow*)ev.GetEventObject(); if (!ctrl) return; wxStaticText* descr_text = desc_texts[ctrl->GetParent()]; if (!descr_text) return; descr_text->SetLabel(DEFAULT_DESC_TEXT); descr_text->Wrap(descr_text->GetContainingSizer()->GetSize().x - 20); ev.Skip(); }
void OnMouseMove(wxMouseEvent& e) { auto rectWin = GetClientRect(); rectWin.Deflate(1); // work around off-by-one issue on OS X auto evtWin = static_cast<wxWindow*>(e.GetEventObject()); auto mpos = e.GetPosition(); if (evtWin != this) mpos += evtWin->GetPosition(); bool highlighted = rectWin.Contains(mpos); SetBackgroundColour(highlighted ? m_bgHighlight : m_bg); Refresh(); }
vgd::event::Location2Event::Location Mouse::getLocation( wxMouseEvent& event ) const { // Location wxWindow *pWindow = dynamic_cast<wxWindow*>(event.GetEventObject()); assert( pWindow != 0 ); vgd::event::Location2Event::Location location; location[0] = static_cast<float>(event.GetX()); location[1] = static_cast<float>(pWindow->GetClientSize().GetHeight()) - static_cast<float>(event.GetY()); return ( location ); }
/***************************************************** ** ** SplitterWidget --- onMouseRight ** ******************************************************/ void SplitterWidget::onMouseRight( wxMouseEvent& event) { int x = event.m_x; int y = event.m_y; wxWindow *window = (wxWindow*)event.GetEventObject(); window->ClientToScreen( &x, &y ); GetParent()->ScreenToClient( &x, &y ); event.m_x = x; event.m_y = y; event.SetEventObject( wxSplitterWindow::GetParent()); wxPostEvent( GetParent(), event ); }
vgd::event::Location2Event::Size Mouse::getSize( wxMouseEvent& event ) const { // Size wxWindow *pWindow = dynamic_cast<wxWindow*>(event.GetEventObject()); assert( pWindow != 0 ); vgd::event::Location2Event::Size size; size[0] = static_cast<float>(pWindow->GetClientSize().GetWidth()); size[1] = static_cast<float>(pWindow->GetClientSize().GetHeight()); return ( size ); }
/* * Determine device touch screen (x,y) based on window position. * * Returns "true" if the click corresponds to a location on the display. * * TODO: should return display index as well -- currently this only * supports touch on the main display. */ bool PhoneWindow::GetTouchPosition(const wxMouseEvent& event, int* pScreenX, int* pScreenY) { /* * If the click came from our device window, treat it as a touch. */ if (event.GetEventObject() != mpDeviceWindow[0]) return false; *pScreenX = event.m_x; *pScreenY = event.m_y; return true; }
void cbAuiNotebook::OnLeaveTabCtrl(wxMouseEvent& event) { if (!wxTheApp->IsActive()) return; wxAuiTabCtrl* tabCtrl = (wxAuiTabCtrl*)event.GetEventObject(); if (tabCtrl) { cbAuiNotebook* nb = (cbAuiNotebook*)tabCtrl->GetParent(); if (nb) nb->RestoreFocus(); } }
void ParameterPanel::OnMouseWheel(wxMouseEvent &event) { double change = 1e-5 * event.GetWheelRotation(); if (event.ShiftDown()) change *= 10; if (event.CmdDown()) change *= 100; if (event.AltDown()) change /= 20; int n = find_in_rows(event.GetEventObject()); double new_value = values_[n] + fabs(values_[n]) * change; set_value(n, new_value); observer_->on_parameter_changed(n); }
void CRenderWnd::OnEnter( wxMouseEvent &event ) { TRACEUSER( "Luke", _T("OnEnter %p\n"), event.GetEventObject() ); // if( event.GetEventObject() != m_pFrame ) // return; wxPoint pt( event.GetPosition() ); wxSetCursorEvent CursorEvent( pt.x, pt.y ); m_pView->OnSetCursor( CursorEvent ); if( CursorEvent.HasCursor() ) { wxSetCursor( CursorEvent.GetCursor() ); } }
void cbAuiNotebook::OnTabCtrlDblClick(wxMouseEvent& event) { wxWindow* win = nullptr; wxAuiTabCtrl* tabCtrl = (wxAuiTabCtrl*)event.GetEventObject(); if (tabCtrl && tabCtrl->TabHitTest(event.GetX(), event.GetY(), &win)) { if (win != nullptr) { // send double-click-event CodeBlocksEvent theEvent(cbEVT_CBAUIBOOK_LEFT_DCLICK, GetParent()->GetId()); theEvent.SetEventObject(win); GetParent()->GetEventHandler()->ProcessEvent(theEvent); } } }
bool wxStdListboxInputHandler::HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) { wxWindow *winCapture = wxWindow::GetCapture(); if ( winCapture && (event.GetEventObject() == winCapture) ) { wxListBox *lbox = wxStaticCast(consumer->GetInputWindow(), wxListBox); if ( !m_btnCapture || !m_trackMouseOutside ) { // someone captured the mouse for us (we always set m_btnCapture // when we do it ourselves): in this case we only react to // the mouse messages when they happen inside the listbox if ( lbox->HitTest(event.GetPosition()) != wxHT_WINDOW_INSIDE ) return false; } int item = HitTest(lbox, event); if ( !m_btnCapture ) { // now that we have the mouse inside the listbox, do capture it // normally - but ensure that we will still ignore the outside // events SetupCapture(lbox, event, item); m_trackMouseOutside = false; } if ( IsValidIndex(lbox, item) ) { // pass something into strArg to tell the listbox that it shouldn't // send the notification message: see PerformAction() above lbox->PerformAction(m_actionMouse, item, _T("no")); } // else: don't pass invalid index to the listbox } else // we don't have capture any more { if ( m_btnCapture ) { // if we lost capture unexpectedly (someone else took the capture // from us), return to a consistent state m_btnCapture = 0; } } return wxStdInputHandler::HandleMouseMove(consumer, event); }
void ImageButton::OnMouseUp(wxMouseEvent& evt) { wxWindow* w = static_cast<wxWindow*>(evt.GetEventObject()); if (w->HasCapture()) w->ReleaseMouse(); wxRect zeroRect(0, 0, GetSize().GetWidth(), GetSize().GetHeight()); pressed_ = false; SetState(_T("Up")); Update(); if (zeroRect.Contains(evt.GetPosition())) { wxCommandEvent newEvent(wxeEVT_CLICK); newEvent.SetEventObject(this); GetEventHandler()->ProcessEvent(newEvent); } }