本文整理汇总了C++中wxMouseEvent类的典型用法代码示例。如果您正苦于以下问题:C++ wxMouseEvent类的具体用法?C++ wxMouseEvent怎么用?C++ wxMouseEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxMouseEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMouseMove
void CBtnDownEvt::OnMouseMove( wxMouseEvent& event )
{
if ( event.LeftIsDown() )
pParent->SetBitmapLabel( *pBtnUp );
event.Skip();
}
示例2: SetTurbo
void TASInputDlg::SetTurbo(wxMouseEvent& event)
{
wxCheckBox* placeholder;
switch (event.GetId())
{
case ID_A:
placeholder = wx_a_button;
A_turbo = !A_turbo;
break;
case ID_B:
placeholder = wx_b_button;
B_turbo = !B_turbo;
break;
case ID_X:
placeholder = wx_x_button;
X_turbo = !X_turbo;
break;
case ID_Y:
placeholder = wx_y_button;
Y_turbo = !Y_turbo;
break;
case ID_Z:
placeholder = wx_z_button;
Z_turbo = !Z_turbo;
break;
case ID_L:
placeholder = wx_l_button;
L_turbo = !L_turbo;
break;
case ID_R:
placeholder = wx_r_button;
R_turbo = !R_turbo;
break;
case ID_START:
placeholder = wx_start_button;
START_turbo = !START_turbo;
break;
case ID_UP:
placeholder = wx_up_button;
DU_turbo = !DU_turbo;
break;
case ID_DOWN:
placeholder = wx_down_button;
DD_turbo = !DD_turbo;
break;
case ID_LEFT:
placeholder = wx_left_button;
DL_turbo = !DL_turbo;
break;
case ID_RIGHT:
placeholder = wx_right_button;
DR_turbo = !DR_turbo;
break;
default:
return;
}
placeholder->SetValue(true);
}
示例3: OnMotion
void wxRibbonPanel::OnMotion(wxMouseEvent& evt)
{
TestPositionForHover(evt.GetPosition());
}
示例4: OnMouseLeftDown
void wxRibbonBar::OnMouseLeftDown(wxMouseEvent& evt)
{
wxRibbonPageTabInfo *tab = HitTestTabs(evt.GetPosition());
SetFocus();
if ( tab )
{
if ( m_ribbon_state == wxRIBBON_BAR_MINIMIZED )
{
ShowPanels();
m_ribbon_state = wxRIBBON_BAR_EXPANDED;
}
else if ( (tab == &m_pages.Item(m_current_page)) && (m_ribbon_state == wxRIBBON_BAR_EXPANDED) )
{
HidePanels();
m_ribbon_state = wxRIBBON_BAR_MINIMIZED;
}
}
else
{
if ( m_ribbon_state == wxRIBBON_BAR_EXPANDED )
{
HidePanels();
m_ribbon_state = wxRIBBON_BAR_MINIMIZED;
}
}
if(tab && tab != &m_pages.Item(m_current_page))
{
wxRibbonBarEvent query(wxEVT_RIBBONBAR_PAGE_CHANGING, GetId(), tab->page);
query.SetEventObject(this);
ProcessWindowEvent(query);
if(query.IsAllowed())
{
SetActivePage(query.GetPage());
wxRibbonBarEvent notification(wxEVT_RIBBONBAR_PAGE_CHANGED, GetId(), m_pages.Item(m_current_page).page);
notification.SetEventObject(this);
ProcessWindowEvent(notification);
}
}
else if(tab == NULL)
{
if(m_tab_scroll_left_button_rect.Contains(evt.GetPosition()))
{
m_tab_scroll_left_button_state |= wxRIBBON_SCROLL_BTN_ACTIVE | wxRIBBON_SCROLL_BTN_HOVERED;
RefreshTabBar();
}
else if(m_tab_scroll_right_button_rect.Contains(evt.GetPosition()))
{
m_tab_scroll_right_button_state |= wxRIBBON_SCROLL_BTN_ACTIVE | wxRIBBON_SCROLL_BTN_HOVERED;
RefreshTabBar();
}
}
wxPoint position = evt.GetPosition();
if(position.x >= 0 && position.y >= 0)
{
wxSize size = GetSize();
if(position.x < size.GetWidth() && position.y < size.GetHeight())
{
if(m_toggle_button_rect.Contains(position))
{
bool pshown = ArePanelsShown();
ShowPanels(!pshown);
if ( pshown )
m_ribbon_state = wxRIBBON_BAR_MINIMIZED;
else
m_ribbon_state = wxRIBBON_BAR_PINNED;
wxRibbonBarEvent event(wxEVT_RIBBONBAR_TOGGLED, GetId());
event.SetEventObject(this);
ProcessWindowEvent(event);
}
if ( m_help_button_rect.Contains(position) )
{
wxRibbonBarEvent event(wxEVT_RIBBONBAR_HELP_CLICK, GetId());
event.SetEventObject(this);
ProcessWindowEvent(event);
}
}
}
}
示例5: OnMouseEvents
void wxCustomButton::OnMouseEvents(wxMouseEvent& event)
{
if (m_button_style & wxCUSTBUT_NOTOGGLE) return;
if (event.LeftDown() || event.RightDown())
{
if (!HasCapture())
CaptureMouse(); // keep depressed until up
m_down++;
Redraw();
}
else if (event.LeftDClick() || event.RightDClick())
{
m_down++; // GTK eats second down event
Redraw();
}
else if (event.LeftUp())
{
if (HasCapture())
ReleaseMouse();
m_eventType = wxEVT_LEFT_UP;
#if (wxMINOR_VERSION<8)
if (wxRect(wxPoint(0,0), GetSize()).Inside(event.GetPosition()))
#else
if (wxRect(wxPoint(0,0), GetSize()).Contains(event.GetPosition()))
#endif
{
if ((m_button_style & wxCUSTBUT_BUTTON) && (m_down > 0))
{
m_down = 0;
Redraw();
SendEvent();
return;
}
else
{
if (!m_timer)
{
m_timer = new wxTimer(this, m_down+1);
m_timer->Start(200, TRUE);
}
else
{
m_eventType = wxEVT_LEFT_DCLICK;
}
if ((m_button_style & wxCUSTBUT_TOGGLE) &&
(m_button_style & wxCUSTBUT_TOG_DCLICK_BUT)) m_down++;
}
}
Redraw();
}
else if (event.RightUp())
{
if (HasCapture())
ReleaseMouse();
m_eventType = wxEVT_RIGHT_UP;
#if (wxMINOR_VERSION<8)
if (wxRect(wxPoint(0,0), GetSize()).Inside(event.GetPosition()))
#else
if (wxRect(wxPoint(0,0), GetSize()).Contains(event.GetPosition()))
#endif
{
if ((m_button_style & wxCUSTBUT_BUTTON) && (m_down > 0))
{
m_down = 0;
Redraw();
SendEvent();
return;
}
else
{
m_down++;
if (!m_timer)
{
m_timer = new wxTimer(this, m_down);
m_timer->Start(250, TRUE);
}
else
{
m_eventType = wxEVT_RIGHT_DCLICK;
}
}
}
Redraw();
}
else if (event.Entering())
{
m_focused = TRUE;
if ((event.LeftIsDown() || event.RightIsDown()) && HasCapture())
m_down++;
//.........这里部分代码省略.........
示例6: HandleMouseButtonDown
bool Envelope::HandleMouseButtonDown(wxMouseEvent & event, wxRect & r,
double h, double pps, bool dB,
float zoomMin, float zoomMax, float eMin, float eMax)
{
bool upper;
int ctr = (int)(r.height * zoomMax / (zoomMax - zoomMin));
upper = (event.m_y - r.y < ctr);
if(zoomMin == eMin)
upper = true;
mButton = event.GetButton();
int clip_y = event.m_y - r.y;
if(clip_y < 0) clip_y = 0; //keeps point in rect r, even if mouse isn't
if(clip_y > r.height) clip_y = r.height;
mIsDeleting = false;
double tleft = h - mOffset;
double tright = tleft + (r.width / pps);
int bestNum = -1;
int bestDist = 10; // Must be within 10 pixel radius.
double dBr = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
mContourOffset = false;
// wxLogDebug(wxT("Y:%i Height:%i Offset:%i"), y, height, mContourOffset );
int len = mEnv.Count();
for (int i = 0; i < len; i++) { //search for control point nearest click
if (mEnv[i]->t >= tleft && mEnv[i]->t <= tright) {
int x = int ((mEnv[i]->t + mOffset - h) * pps) + r.x;
int y[4];
int numControlPoints;
// Outer control points
y[0] = GetWaveYPosNew( mEnv[i]->val, zoomMin, zoomMax, r.height,
dB, true, dBr, false);
y[1] = GetWaveYPosNew( -mEnv[i]->val, zoomMin, zoomMax, r.height,
dB, true, dBr, false);
// Inner control points(contour)
y[2] = GetWaveYPosNew( mEnv[i]->val, zoomMin, zoomMax, r.height,
dB, false, dBr, false);
y[3] = GetWaveYPosNew( -mEnv[i]->val-.00000001, zoomMin, zoomMax,
r.height, dB, false, dBr, false);
numControlPoints = 4;
if (y[2] > y[3])
numControlPoints = 2;
if (!mMirror)
numControlPoints = 1;
for(int j=0; j<numControlPoints; j++){
int d = (int)(sqrt((double)(SQR(x-event.m_x) + SQR(y[j]-(event.m_y-r.y)))) + 0.5);
if (d < bestDist) {
bestNum = i;
bestDist = d;
mContourOffset = (bool)(j > 1);
}
}
}
}
if (bestNum >= 0) {
mDragPoint = bestNum;
}
else {
// Create new point
double when = h + (event.m_x - r.x) / pps - mOffset;
// if (when <= 0 || when >= mTrackLen)
// return false;
double v = GetValueAtX( event.m_x, r, h, pps );
int ct = GetWaveYPosNew( v, zoomMin, zoomMax, r.height, dB,
false, dBr, false) ;
int cb = GetWaveYPosNew( -v-.000000001, zoomMin, zoomMax, r.height, dB,
false, dBr, false) ;
if( ct <= cb || !mMirror ){
int t = GetWaveYPosNew( v, zoomMin, zoomMax, r.height, dB,
true, dBr, false) ;
int b = GetWaveYPosNew( -v, zoomMin, zoomMax, r.height, dB,
true, dBr, false) ;
ct = (t + ct) / 2;
cb = (b + cb) / 2;
if(mMirror &&
(event.m_y - r.y) > ct &&
((event.m_y - r.y) < cb))
mContourOffset = true;
else
mContourOffset = false;
}
//.........这里部分代码省略.........
示例7: onWheel
void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
{
const double wheelPanSpeed = 0.001;
if( aEvent.ControlDown() || aEvent.ShiftDown() || m_enableMousewheelPan )
{
// Scrolling
VECTOR2D scrollVec = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) *
( (double) aEvent.GetWheelRotation() * wheelPanSpeed );
int axis = aEvent.GetWheelAxis();
double scrollX = 0.0;
double scrollY = 0.0;
if ( m_enableMousewheelPan )
{
if ( axis == wxMOUSE_WHEEL_HORIZONTAL )
scrollX = scrollVec.x;
else
scrollY = -scrollVec.y;
}
else
{
if ( aEvent.ControlDown() )
scrollX = -scrollVec.x;
else
scrollY = -scrollVec.y;
}
VECTOR2D delta( scrollX, scrollY );
m_view->SetCenter( m_view->GetCenter() + delta );
}
else
{
// Zooming
wxLongLong timeStamp = wxGetLocalTimeMillis();
double timeDiff = timeStamp.ToDouble() - m_timeStamp.ToDouble();
int rotation = aEvent.GetWheelRotation();
double zoomScale;
#ifdef __WXMAC__
// The following is to support Apple pointer devices (MagicMouse &
// Macbook touchpad), which send events more frequently, but with smaller
// wheel rotation.
//
// It should not break other platforms, but I prefer to be safe than
// sorry. If you find a device that behaves in the same way on another
// platform, feel free to remove #ifdef directives.
if( timeDiff > 0 && timeDiff < 100 && std::abs( rotation ) < 20 )
{
aEvent.Skip();
return;
}
#endif
m_timeStamp = timeStamp;
// Set scaling speed depending on scroll wheel event interval
if( timeDiff < 500 && timeDiff > 0 )
{
zoomScale = 2.05 - timeDiff / 500;
if( rotation < 0 )
zoomScale = 1.0 / zoomScale;
}
else
{
zoomScale = ( rotation > 0 ) ? 1.05 : 0.95;
}
if( IsCursorWarpingEnabled() )
{
CenterOnCursor();
m_view->SetScale( m_view->GetScale() * zoomScale );
}
else
{
VECTOR2D anchor = m_view->ToWorld( VECTOR2D( aEvent.GetX(), aEvent.GetY() ) );
m_view->SetScale( m_view->GetScale() * zoomScale, anchor );
}
}
aEvent.Skip();
}
示例8: OnLeftDown
void wxHyperlinkCtrl::OnLeftDown(wxMouseEvent& event)
{
// the left click must start from the hyperlink rect
m_clicking = GetLabelRect().Contains(event.GetPosition());
}
示例9: OnRightUp
void wxHyperlinkCtrl::OnRightUp(wxMouseEvent& event)
{
if( GetWindowStyle() & wxHL_CONTEXTMENU )
if ( GetLabelRect().Contains(event.GetPosition()) )
DoContextMenu(wxPoint(event.m_x, event.m_y));
}
示例10: OnMouseEvent
void AudioDisplay::OnMouseEvent(wxMouseEvent& event)
{
// If we have focus, we get mouse move events on Mac even when the mouse is
// outside our client rectangle, we don't want those.
if (event.Moving() && !GetClientRect().Contains(event.GetPosition()))
{
event.Skip();
return;
}
if (event.IsButton())
SetFocus();
const int mouse_x = event.GetPosition().x;
// Scroll the display after a mouse-up near one of the edges
if ((event.LeftUp() || event.RightUp()) && OPT_GET("Audio/Auto/Scroll")->GetBool())
{
const int width = GetClientSize().GetWidth();
if (mouse_x < width / 20) {
ScrollBy(-width / 3);
}
else if (width - mouse_x < width / 20) {
ScrollBy(width / 3);
}
}
if (ForwardMouseEvent(event))
return;
if (event.MiddleIsDown())
{
context->videoController->JumpToTime(TimeFromRelativeX(mouse_x), agi::vfr::EXACT);
return;
}
if (event.Moving() && !controller->IsPlaying())
{
SetTrackCursor(scroll_left + mouse_x, OPT_GET("Audio/Display/Draw/Cursor Time")->GetBool());
}
AudioTimingController *timing = controller->GetTimingController();
if (!timing) return;
const int drag_sensitivity = int(OPT_GET("Audio/Start Drag Sensitivity")->GetInt() * ms_per_pixel);
const int snap_sensitivity = OPT_GET("Audio/Snap/Enable")->GetBool() != event.ShiftDown() ? int(OPT_GET("Audio/Snap/Distance")->GetInt() * ms_per_pixel) : 0;
// Not scrollbar, not timeline, no button action
if (event.Moving())
{
const int timepos = TimeFromRelativeX(mouse_x);
if (timing->IsNearbyMarker(timepos, drag_sensitivity))
SetCursor(wxCursor(wxCURSOR_SIZEWE));
else
SetCursor(wxNullCursor);
return;
}
const int old_scroll_pos = scroll_left;
if (event.LeftDown() || event.RightDown())
{
const int timepos = TimeFromRelativeX(mouse_x);
std::vector<AudioMarker*> markers = event.LeftDown() ?
timing->OnLeftClick(timepos, event.CmdDown(), drag_sensitivity, snap_sensitivity) :
timing->OnRightClick(timepos, event.CmdDown(), drag_sensitivity, snap_sensitivity);
// Clicking should never result in the audio display scrolling
ScrollPixelToLeft(old_scroll_pos);
if (markers.size())
{
RemoveTrackCursor();
audio_marker.reset(new AudioMarkerInteractionObject(markers, timing, this, controller, (wxMouseButton)event.GetButton()));
SetDraggedObject(audio_marker.get());
return;
}
}
}
示例11: OnDClick
void PipedProcessCtrl::OnDClick(wxMouseEvent &e)
{
//First retrieve the link text
if(!m_linkclicks)
return;
long pos=m_textctrl->PositionFromPoint(e.GetPosition());
int style=m_textctrl->GetStyleAt(pos);
if((style&PP_LINK_STYLE)!=PP_LINK_STYLE)
return; //didn't click a link
long start=pos;
while(start>0)
{
style=m_textctrl->GetStyleAt(start-1);
if((style&PP_LINK_STYLE)!=PP_LINK_STYLE)
break;
start--;
}
long end=pos;
while(end<m_textctrl->PositionFromLine(m_textctrl->GetLineCount()-1))
{
style=m_textctrl->GetStyleAt(end+1);
if((style&PP_LINK_STYLE)!=PP_LINK_STYLE)
break;
end++;
}
wxString text=m_textctrl->GetTextRange(start,end+1);
//retrieve the file and line number parts of the link
wxRegEx re(m_linkregex,wxRE_ADVANCED|wxRE_NEWLINE);
wxString file;
long line;
if(!re.Matches(text))
return;
size_t ind,len;
re.GetMatch(&ind,&len,0);
if(re.GetMatch(&ind,&len,1))
file=text.Mid(ind,len);
else
file=wxEmptyString;
if(re.GetMatch(&ind,&len,3))
text.Mid(ind,len).ToLong(&line);
else
line=0;
//open the file in the editor
wxFileName f(file);
if(f.FileExists())
{
cbEditor* ed = Manager::Get()->GetEditorManager()->Open(f.GetFullPath());
if (ed)
{
ed->Show(true);
// if (!ed->GetProjectFile())
// ed->SetProjectFile(f.GetFullPath());
ed->GotoLine(line - 1, false);
if(line>0)
if(!ed->HasBookmark(line - 1))
ed->ToggleBookmark(line -1);
}
}
}
示例12: wxMenuItem
/* Construct and display a popup menu when the right button is clicked.
*/
void EDA_3D_CANVAS::OnRightClick( wxMouseEvent& event )
{
wxPoint pos;
wxMenu PopUpMenu;
pos.x = event.GetX();
pos.y = event.GetY();
wxMenuItem* item = new wxMenuItem( &PopUpMenu, ID_POPUP_ZOOMIN, _( "Zoom +" ) );
item->SetBitmap( KiBitmap( zoom_in_xpm ));
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_ZOOMOUT, _( "Zoom -" ) );
item->SetBitmap( KiBitmap( zoom_out_xpm ));
PopUpMenu.Append( item );
PopUpMenu.AppendSeparator();
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZPOS, _( "Top View" ) );
item->SetBitmap( KiBitmap( axis3d_top_xpm ));
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZNEG, _( "Bottom View" ) );
item->SetBitmap( KiBitmap( axis3d_bottom_xpm ));
PopUpMenu.Append( item );
PopUpMenu.AppendSeparator();
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_XPOS, _( "Right View" ) );
item->SetBitmap( KiBitmap( axis3d_right_xpm ));
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_XNEG, _( "Left View" ) );
item->SetBitmap( KiBitmap( axis3d_left_xpm ));
PopUpMenu.Append( item );
PopUpMenu.AppendSeparator();
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_YPOS, _( "Front View" ) );
item->SetBitmap( KiBitmap( axis3d_front_xpm ));
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_YNEG, _( "Back View" ) );
item->SetBitmap( KiBitmap( axis3d_back_xpm ));
PopUpMenu.Append( item );
PopUpMenu.AppendSeparator();
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_LEFT, _( "Move left <-" ) );
item->SetBitmap( KiBitmap( left_xpm ));
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_RIGHT, _( "Move right ->" ) );
item->SetBitmap( KiBitmap( right_xpm ));
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_UP, _( "Move Up ^" ) );
item->SetBitmap( KiBitmap( up_xpm ));
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_DOWN, _( "Move Down" ) );
item->SetBitmap( KiBitmap( down_xpm ));
PopUpMenu.Append( item );
PopupMenu( &PopUpMenu, pos );
}
示例13: OnMouseRightUP
void ImageFrameDyn::OnMouseRightUP(wxMouseEvent& event) {
wxMenu menu(wxT("Au choix :"));
menu.Append(ID_PopupMenuPhoto, wxT("&Zoom"));
menu.Append(ID_PopupMenuPhotoAttrs, wxT("&Attributs"));
PopupMenu(&menu, wxPoint(event.GetX(), event.GetY()));
}
示例14: OnMouseEvent
void CFilterDialog::OnMouseEvent(wxMouseEvent& event)
{
m_shiftClick = event.ShiftDown();
event.Skip();
}
示例15: LMouseUp
// Process a left mouse click by making a move attempt at the appropriate cell
void SimpleGoPanel::LMouseUp(wxMouseEvent& event)
{ int x, y;
x = (event.GetPosition().x+8)/16;
y = (event.GetPosition().y+8)/16;
MakeMove(x, y);
}