本文整理汇总了C++中wxMouseEvent类的典型用法代码示例。如果您正苦于以下问题:C++ wxMouseEvent类的具体用法?C++ wxMouseEvent怎么用?C++ wxMouseEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxMouseEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: OnMouseMove
void CBtnDownEvt::OnMouseMove( wxMouseEvent& event )
{
if ( event.LeftIsDown() )
pParent->SetBitmapLabel( *pBtnUp );
event.Skip();
}
开发者ID:BackupTheBerlios,项目名称:musik-svn,代码行数:6,代码来源:BtnDown.cpp
示例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);
}
开发者ID:Blackbird88,项目名称:dolphin,代码行数:70,代码来源:TASInputDlg.cpp
示例3: OnMotion
void wxRibbonPanel::OnMotion(wxMouseEvent& evt)
{
TestPositionForHover(evt.GetPosition());
}
开发者ID:mael15,项目名称:wxWidgets,代码行数:4,代码来源:panel.cpp
示例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);
}
}
}
}
开发者ID:ruifig,项目名称:nutcracker,代码行数:81,代码来源:bar.cpp
示例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++;
//.........这里部分代码省略.........
开发者ID:bigbensk,项目名称:gpac,代码行数:101,代码来源:menubtn.cpp
示例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;
}
//.........这里部分代码省略.........
开发者ID:andreipaga,项目名称:audacity,代码行数:101,代码来源:Envelope.cpp
示例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();
}
开发者ID:RocFan,项目名称:kicad-source-mirror,代码行数:84,代码来源:wx_view_controls.cpp
示例8: OnLeftDown
void wxHyperlinkCtrl::OnLeftDown(wxMouseEvent& event)
{
// the left click must start from the hyperlink rect
m_clicking = GetLabelRect().Contains(event.GetPosition());
}
开发者ID:madnessw,项目名称:thesnow,代码行数:5,代码来源:hyperlink.cpp
示例9: OnRightUp
void wxHyperlinkCtrl::OnRightUp(wxMouseEvent& event)
{
if( GetWindowStyle() & wxHL_CONTEXTMENU )
if ( GetLabelRect().Contains(event.GetPosition()) )
DoContextMenu(wxPoint(event.m_x, event.m_y));
}
开发者ID:madnessw,项目名称:thesnow,代码行数:6,代码来源:hyperlink.cpp
示例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;
}
}
}
开发者ID:Gpower2,项目名称:Aegisub,代码行数:78,代码来源:audio_display.cpp
示例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);
}
}
}
开发者ID:stahta01,项目名称:EmBlocks_old,代码行数:62,代码来源:PipedProcessCtrl.cpp
示例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 );
}
开发者ID:natsfr,项目名称:kicad,代码行数:64,代码来源:3d_canvas.cpp
示例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()));
}
开发者ID:Nadot,项目名称:wxEssai,代码行数:6,代码来源:ImageFrameDyn.cpp
示例14: OnMouseEvent
void CFilterDialog::OnMouseEvent(wxMouseEvent& event)
{
m_shiftClick = event.ShiftDown();
event.Skip();
}
开发者ID:bugiii,项目名称:filezilla3ex,代码行数:5,代码来源:filter.cpp
示例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);
}
开发者ID:curtisbright,项目名称:simplego,代码行数:7,代码来源:simplego-panel.cpp
示例16: ProcessMouseEvent
void CUIViewAgent::ProcessMouseEvent( wxMouseEvent& event )
{
__super::ProcessMouseEvent(event);
wxPoint MousePos = event.GetPosition();
CRenderTarget* pRenderWnd = CRenderManager::GetInstance()->GetCurrentRenderTarget();
wxGLRenderWindow* pSceneRenderWnd = down_cast<wxGLRenderWindow*>(pRenderWnd);
BEATS_ASSERT(pSceneRenderWnd != NULL);
float fScale = pSceneRenderWnd->IsFBOInUse() ? (float)pSceneRenderWnd->GetFBOViewPortWidth() / pSceneRenderWnd->GetWidth() : pSceneRenderWnd->GetScaleFactor();
MousePos.x /= fScale;
MousePos.y /= fScale;
if(event.ButtonDown(wxMOUSE_BTN_LEFT))
{
if (m_pMainFrame->m_nCursorIconID == wxCURSOR_ARROW)
{
CComponentBase* pSelectedComponent = CWindowManager::GetInstance()->GetControl(MousePos.x, MousePos.y);
CComponentProxy* pProxy = NULL;
if (pSelectedComponent)
{
pProxy = (CComponentProxy*)CComponentProxyManager::GetInstance()->GetComponentInstance(pSelectedComponent->GetId(), pSelectedComponent->GetGuid());
}
if (m_pMainFrame->m_pSelectedComponentProxy != pProxy)
{
m_pMainFrame->SelectComponent(pProxy);
}
}
if (m_pMainFrame->m_pSelectedComponentProxy != NULL)
{
kmVec2 kmVec2Pos;
kmVec2Fill(&kmVec2Pos, 0, 0);
((CControl*)m_pMainFrame->m_pSelectedComponentProxy->GetHostComponent())->LocalToWorld(kmVec2Pos.x, kmVec2Pos.y);
m_pMainFrame->m_activeGUIPosOffset = wxPoint(kmVec2Pos.x - MousePos.x, kmVec2Pos.y - MousePos.y);
}
UpdateCursorIcon(MousePos);
((wxWindow*)m_pMainFrame->m_pViewScreen)->SetCursor(m_pMainFrame->m_nCursorIconID);
}
else if(event.ButtonDown(wxMOUSE_BTN_RIGHT))
{
m_pMainFrame->SelectComponent(NULL);
UpdateCursorIcon(MousePos);
((wxWindow*)m_pMainFrame->m_pViewScreen)->SetCursor(m_pMainFrame->m_nCursorIconID);
}
else if(event.Dragging())
{
if (m_pMainFrame->m_pSelectedComponentProxy)
{
wxString propertyName;
int nHitTestRet = m_pMainFrame->m_nHitTestRet;
if (nHitTestRet == CControl::eHTR_HIT_CONTENT || nHitTestRet == CControl::eHTR_HIT_EDGE)
{
propertyName = _T("m_pos");
}
else if (nHitTestRet > CControl::eHTR_HIT_CONTENT && nHitTestRet < CControl::eHTR_HIT_ANCHOR)
{
propertyName = _T("m_vecSize");
}
else
{
propertyName = _T("");
}
if (!propertyName.IsEmpty())
{
CWxwidgetsPropertyBase* pPropertyDescription = static_cast<CWxwidgetsPropertyBase*>(m_pMainFrame->m_pSelectedComponentProxy->GetPropertyDescription(propertyName));
BEATS_ASSERT(pPropertyDescription != NULL);
CControl* pWindow = dynamic_cast<CControl*>(m_pMainFrame->m_pSelectedComponentProxy->GetHostComponent());
BEATS_ASSERT(pWindow != NULL);
if (nHitTestRet == CControl::eHTR_HIT_CONTENT || nHitTestRet == CControl::eHTR_HIT_EDGE)
{
kmScalar posX = MousePos.x + m_pMainFrame->m_activeGUIPosOffset.x;
kmScalar posY = MousePos.y + m_pMainFrame->m_activeGUIPosOffset.y;
kmVec2 pos = pWindow->CalcPosFromMouse(posX, posY);
SetkmVec2PropertyValue(pPropertyDescription, pos);
}
else if (nHitTestRet > CControl::eHTR_HIT_CONTENT && nHitTestRet < CControl::eHTR_HIT_ANCHOR)
{
kmVec2 size = pWindow->CalcSizeFromMouse(MousePos.x, MousePos.y, (CControl::EHitTestResult)nHitTestRet);
SetkmVec2PropertyValue(pPropertyDescription, size);
}
}
}
}
else if(event.Moving())
{
UpdateCursorIcon(MousePos);
}
}
开发者ID:BeyondEngine,项目名称:BeyondEngine,代码行数:90,代码来源:UIViewAgent.cpp
示例17: StcLeftDown
void wxCodeCompletionBox::StcLeftDown(wxMouseEvent& event)
{
event.Skip();
DoDestroy();
}
开发者ID:Slasher006,项目名称:codelite,代码行数:5,代码来源:wxCodeCompletionBox.cpp
示例18: LayCTMR
void tui::LayoutCanvas::OnMouseMotion(wxMouseEvent& event)
{
ScrMARKold = ScrMARK;
// get a current position
ScrMARK = TP(event.GetX(),event.GetY()) * _LayCTM ;
int4b stepDB = DATC->stepDB();
ScrMARK.roundTO(stepDB);
if (DATC->autopan() && mouse_input && !invalid_window)
{
CTM LayCTMR(_LayCTM.Reversed());
TP sp_BL = lp_BL * LayCTMR;
TP sp_TR = lp_TR * LayCTMR;
TP s_ScrMARK = n_ScrMARK * LayCTMR;
TP nsp;
if (abs(s_ScrMARK.x() - sp_BL.x()) < ap_trigger)
{
wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM);
eventZOOM.SetInt(ZOOM_LEFT);
OnZoom(eventZOOM);
nsp = ScrMARK * _LayCTM.Reversed();
WarpPointer(nsp.x(),nsp.y());return;
}
else if(abs(sp_TR.x() - s_ScrMARK.x()) < ap_trigger)
{
wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM);
eventZOOM.SetInt(ZOOM_RIGHT);
OnZoom(eventZOOM);
nsp = ScrMARK * _LayCTM.Reversed();
WarpPointer(nsp.x(),nsp.y());return;
}
else if(abs(sp_BL.y() - s_ScrMARK.y()) < ap_trigger)
{
wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM);
eventZOOM.SetInt(ZOOM_UP);
OnZoom(eventZOOM);
nsp = ScrMARK * _LayCTM.Reversed();
WarpPointer(nsp.x(),nsp.y());return;
}
else if(abs(s_ScrMARK.y() - sp_TR.y()) < ap_trigger)
{
wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM);
eventZOOM.SetInt(ZOOM_DOWN);
OnZoom(eventZOOM);
nsp = ScrMARK * _LayCTM.Reversed();
WarpPointer(nsp.x(),nsp.y());return;
}
}
// update movement indicators
static int deltaX = abs(ScrMARKold.x() - ScrMARK.x());
static int deltaY = abs(ScrMARKold.y() - ScrMARK.y());
if (!(deltaX || deltaY)) return;
//
CursorControl(event.ShiftDown(), event.ControlDown());
if (deltaX > 0)
UpdateCoordWin(ScrMARK.x(), CNVS_POS_X, (n_ScrMARK.x() - releasepoint.x()), CNVS_DEL_X);
if (deltaY > 0)
UpdateCoordWin(ScrMARK.y(), CNVS_POS_Y, (n_ScrMARK.y() - releasepoint.y()), CNVS_DEL_Y);
// drawInterim(ScrMARK);
if (tmp_wnd || mouse_input || reperX || reperY) Refresh();//updateGL();
}
开发者ID:BackupTheBerlios,项目名称:toped-svn,代码行数:61,代码来源:layoutcanvas.cpp
示例19: OnMouseWheel
void wxListCtrlEx::OnMouseWheel(wxMouseEvent& event)
{
event.Skip();
OnPreEmitPostScrollEvent();
}
开发者ID:juaristi,项目名称:filezilla,代码行数:5,代码来源:listctrlex.cpp
示例20: evt
void GribGrabberWin::OnMouseEvent( wxMouseEvent& event )
{
if( event.RightDown() ) {
wxMouseEvent evt(event);
((wxEvtHandler*)GetParent())->ProcessEvent( evt );
return;
}
static wxPoint s_gspt;
int x, y;
event.GetPosition( &x, &y );
wxPoint spt = ClientToScreen( wxPoint( x, y ) );
#ifdef __WXOSX__
if (!m_bLeftDown && event.LeftIsDown())
{
m_bLeftDown = true;
s_gspt = spt;
if (!HasCapture()) CaptureMouse();
}
else if (m_bLeftDown && !event.LeftIsDown())
{
// GetParent()->Move( GetParent()->GetPosition() );
m_bLeftDown = false;
if (HasCapture()) ReleaseMouse();
}
#else
if( event.LeftDown() ) {
s_gspt = spt;
CaptureMouse();
}
if( event.LeftUp() ) {
//GetParent()->Move( GetParent()->GetPosition() );
if( HasCapture() ) ReleaseMouse();
}
#endif
if( event.Dragging() ) {
wxPoint par_pos_old = GetParent()->GetPosition();
wxPoint par_pos = par_pos_old;
par_pos.x += spt.x - s_gspt.x;
par_pos.y += spt.y - s_gspt.y;
wxPoint pos_in_parent = GetOCPNCanvasWindow()->ScreenToClient( par_pos );
wxPoint pos_in_parent_old = GetOCPNCanvasWindow()->ScreenToClient( par_pos_old );
// X
if( pos_in_parent.x < pos_in_parent_old.x ) { // moving left
if( pos_in_parent.x < 10 ) {
pos_in_parent.x = 0;
}
} else
if( pos_in_parent.x > pos_in_parent_old.x ) { // moving right
int max_right = GetOCPNCanvasWindow()->GetClientSize().x - GetParent()->GetSize().x;
if( pos_in_parent.x > ( max_right - 10 ) ) {
pos_in_parent.x = max_right;
}
}
// Y
if( pos_in_parent.y < pos_in_parent_old.y ) { // moving up
if( pos_in_parent.y < 10 ) {
pos_in_parent.y = 0;
}
} else
if( pos_in_parent.y > pos_in_parent_old.y ) { // moving dow
int max_down = GetOCPNCanvasWindow()->GetClientSize().y - GetParent()->GetSize().y;
if( pos_in_parent.y > ( max_down - 10 ) ) {
pos_in_parent.y = max_down;
}
}
wxPoint final_pos = GetOCPNCanvasWindow()->ClientToScreen( pos_in_parent );
GetParent()->Move( final_pos );
s_gspt = spt;
}
}
开发者ID:lburais,项目名称:OpenCPN,代码行数:85,代码来源:GrabberWin.cpp
注:本文中的wxMouseEvent类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论