本文整理汇总了C++中wxMouseEvent::ControlDown方法的典型用法代码示例。如果您正苦于以下问题:C++ wxMouseEvent::ControlDown方法的具体用法?C++ wxMouseEvent::ControlDown怎么用?C++ wxMouseEvent::ControlDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxMouseEvent
的用法示例。
在下文中一共展示了wxMouseEvent::ControlDown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDragging
void CSelectMode::OnDragging( wxMouseEvent& event )
{
if(event.MiddleIsDown())
{
wxPoint dm;
dm.x = event.GetX() - CurrentPoint.x;
dm.y = event.GetY() - CurrentPoint.y;
if(wxGetApp().ctrl_does_rotate == event.ControlDown())
{
if(wxGetApp().m_rotate_mode)
{
wxGetApp().m_current_viewport->m_view_point.Turn(dm);
}
else
{
wxGetApp().m_current_viewport->m_view_point.TurnVertical(dm);
}
}
else
{
wxGetApp().m_current_viewport->m_view_point.Shift(dm, wxPoint(event.GetX(), event.GetY()));
}
wxGetApp().m_current_viewport->m_need_update = true;
wxGetApp().m_current_viewport->m_need_refresh = true;
}
else if(event.LeftIsDown())
{
if(wxGetApp().drag_gripper)
{
double to[3], from[3];
wxGetApp().m_digitizing->digitize(wxPoint(event.GetX(), event.GetY()));
extract(wxGetApp().m_digitizing->digitized_point.m_point, to);
wxGetApp().grip_to = wxGetApp().m_digitizing->digitized_point.m_point;
extract(wxGetApp().grip_from, from);
wxGetApp().drag_gripper->OnGripperMoved(from, to);
wxGetApp().grip_from = gp_Pnt(from[0], from[1], from[2]);
wxGetApp().grip_from = make_point(from);
}
else if(abs(button_down_point.x - event.GetX())>2 || abs(button_down_point.y - event.GetY())>2)
{
if(wxGetApp().m_dragging_moves_objects && !window_box_exists)
{
std::list<HeeksObj*> selected_objects_dragged;
wxGetApp().m_show_grippers_on_drag = true;
if( wxGetApp().m_marked_list->list().size() > 0)
{
for(std::list<HeeksObj*>::iterator It = wxGetApp().m_marked_list->list().begin(); It != wxGetApp().m_marked_list->list().end(); It++)
{
HeeksObj* object = *It;
if(object->CanBeDragged())selected_objects_dragged.push_back(object);
}
}
else
{
MarkedObjectManyOfSame marked_object;
wxGetApp().FindMarkedObject(button_down_point, &marked_object);
if(marked_object.m_map.size()>0){
HeeksObj* object = marked_object.GetFirstOfTopOnly();
double min_depth = 0.0;
HeeksObj* closest_object = NULL;
while(object)
{
if(object->CanBeDragged())
{
double depth = marked_object.GetDepth();
if(closest_object == NULL || depth<min_depth)
{
min_depth = depth;
closest_object = object;
}
}
object = marked_object.Increment();
}
if(selected_objects_dragged.size() == 0 && closest_object){
selected_objects_dragged.push_back(closest_object);
wxGetApp().m_show_grippers_on_drag = false;
}
}
}
if(selected_objects_dragged.size() > 0)
{
wxGetApp().drag_gripper = &drag_object_gripper;
wxGetApp().m_digitizing->SetOnlyCoords(wxGetApp().drag_gripper, true);
wxGetApp().m_digitizing->digitize(button_down_point);
wxGetApp().grip_from = wxGetApp().m_digitizing->digitized_point.m_point;
wxGetApp().grip_to = wxGetApp().grip_from;
double from[3];
from[0] = wxGetApp().grip_from.X();
from[1] = wxGetApp().grip_from.Y();
from[2] = wxGetApp().grip_from.Z();
wxGetApp().drag_gripper->OnGripperGrabbed(selected_objects_dragged, wxGetApp().m_show_grippers_on_drag, from);
wxGetApp().grip_from = gp_Pnt(from[0], from[1], from[2]);
double to[3];
wxGetApp().m_digitizing->digitize(wxPoint(event.GetX(), event.GetY()));
extract(wxGetApp().m_digitizing->digitized_point.m_point, to);
wxGetApp().grip_to = wxGetApp().m_digitizing->digitized_point.m_point;
extract(wxGetApp().grip_from, from);
wxGetApp().drag_gripper->OnGripperMoved(from, to);
//.........这里部分代码省略.........
示例2: OnMouse
void CSelectMode::OnMouse( wxMouseEvent& event )
{
bool event_used = false;
if(LeftAndRightPressed(event, event_used))
{
if(m_doing_a_main_loop){
ExitMainLoop();
}
}
if(event_used)return;
if(event.LeftDown())
OnLeftDown(event);
if(event.MiddleDown())
OnMiddleDown(event);
bool dragging = event.Dragging() && (m_button_down || m_middle_button_down);
bool moving = event.Moving() || (event.Dragging() && (!(m_button_down || m_middle_button_down)));
bool left_up = false;
if(event.LeftUp())
{
if(m_button_down)left_up = true;
m_button_down = false;
}
if(event.MiddleUp())m_middle_button_down = false;
if(left_up)
{
OnLeftUp(event);
}
else if(event.RightUp())
{
MarkedObjectOneOfEach marked_object;
wxGetApp().FindMarkedObject(wxPoint(event.GetX(), event.GetY()), &marked_object);
wxGetApp().DoDropDownMenu(wxGetApp().m_frame->m_graphics, wxPoint(event.GetX(), event.GetY()), &marked_object, false, event.ControlDown());
}
else if(dragging)
{
OnDragging(event);
}
else if(moving)
{
OnMoving(event);
}
if(event.GetWheelRotation() != 0)
{
OnWheelRotation(event);
}
}
示例3: onTexCanvasMouseEvent
/* TextureEditorPanel::onTexCanvasMouseEvent
* Called on any mouse event within the texture canvas
*******************************************************************/
void TextureEditorPanel::onTexCanvasMouseEvent(wxMouseEvent& e)
{
// Get mouse position relative to texture
point2_t pos = tex_canvas->screenToTexPosition(e.GetX(), e.GetY());
// Get patch that the mouse is over (if any)
int patch = tex_canvas->patchAt(pos.x, pos.y);
// LEFT DOUBLE CLICK
if (e.ButtonDClick(wxMOUSE_BTN_LEFT))
{
replacePatch();
}
// LEFT MOUSE DOWN
else if (e.LeftDown())
{
// If not dragging
if (e.ShiftDown())
{
// Shift is down, add to selection
if (patch >= 0)
list_patches->selectItem(patch);
}
else if (e.ControlDown())
{
// Control is down, remove from selection
if (patch >= 0)
list_patches->deSelectItem(patch);
}
else
{
// Clear selection only if patch clicked was not already selected
if (!tex_canvas->patchSelected(patch))
list_patches->clearSelection();
// Select patch
if (patch >= 0)
list_patches->selectItem(patch);
}
}
// LEFT MOUSE UP
else if (e.LeftUp())
{
// Hide texture grid
tex_canvas->showGrid(false);
// If mouse up over an already-selected patch, and shift/ctrl aren't down,
// select only that patch (this mimics 'normal' drag-and-drop/selection behaviour)
if (!e.ShiftDown() && !e.ControlDown() && tex_canvas->patchSelected(patch) && !tex_canvas->isDragging())
{
list_patches->clearSelection();
list_patches->selectItem(patch);
}
// Redraw texture canvas
tex_canvas->redraw(false);
updateTextureControls();
}
// RIGHT MOUSE UP
else if (e.RightUp())
{
// Create context menu
wxMenu popup;
theApp->getAction("txed_patch_add")->addToMenu(&popup, true);
theApp->getAction("txed_patch_remove")->addToMenu(&popup, true);
theApp->getAction("txed_patch_replace")->addToMenu(&popup, true);
theApp->getAction("txed_patch_back")->addToMenu(&popup, true);
theApp->getAction("txed_patch_forward")->addToMenu(&popup, true);
theApp->getAction("txed_patch_duplicate")->addToMenu(&popup, true);
hack_nodrag = true;
PopupMenu(&popup);
}
// MOUSE DRAGGING
else if (e.Dragging())
{
// Drag selected patches if left button is down and any patch is selected
if (hack_nodrag)
hack_nodrag = false;
else if (e.LeftIsDown())
{
if (list_patches->GetSelectedItemCount() > 0)
{
// Get drag amount according to texture
point2_t tex_cur = tex_canvas->screenToTexPosition(e.GetX(), e.GetY());
point2_t tex_prev = tex_canvas->screenToTexPosition(tex_canvas->getMousePrevPos().x, tex_canvas->getMousePrevPos().y);
point2_t diff = tex_cur - tex_prev;
// Move any selected patches
wxArrayInt selected_patches = list_patches->selectedItems();
for (size_t a = 0; a < selected_patches.size(); a++)
{
CTPatch* patch = tex_current->getPatch(selected_patches[a]);
//.........这里部分代码省略.........
示例4: OnLeftUp
void CSelectMode::OnLeftUp( wxMouseEvent& event )
{
if(wxGetApp().drag_gripper)
{
double to[3], from[3];
wxGetApp().m_digitizing->digitize(wxPoint(event.GetX(), event.GetY()));
extract(wxGetApp().m_digitizing->digitized_point.m_point, to);
wxGetApp().grip_to = wxGetApp().m_digitizing->digitized_point.m_point;
extract(wxGetApp().grip_from, from);
wxGetApp().drag_gripper->OnGripperReleased(from, to);
wxGetApp().m_digitizing->SetOnlyCoords(wxGetApp().drag_gripper, false);
wxGetApp().drag_gripper = NULL;
}
else if(window_box_exists)
{
if(!event.ControlDown())wxGetApp().m_marked_list->Clear(true);
std::list<HeeksObj*> obj_list;
GetObjectsInWindow(event, obj_list);
wxGetApp().m_marked_list->Add(obj_list, true);
wxGetApp().m_current_viewport->DrawWindow(window_box, true); // undraw the window
window_box_exists = false;
}
else
{
// select one object
m_last_click_point = CClickPoint();
MarkedObjectOneOfEach marked_object;
wxGetApp().FindMarkedObject(wxPoint(event.GetX(), event.GetY()), &marked_object);
if(marked_object.m_map.size()>0){
HeeksObj* previously_marked = NULL;
if(wxGetApp().m_marked_list->size() == 1)
{
previously_marked = *(wxGetApp().m_marked_list->list().begin());
}
HeeksObj* o = marked_object.GetFirstOfTopOnly();
unsigned long depth = marked_object.GetDepth();
HeeksObj* object = o;
while(o)
{
if(o == previously_marked)
{
object = o;
break;
}
o = marked_object.Increment();
if(o)
{
// prefer highest order objects
if(o->GetType() < object->GetType())object = o;
}
}
if(!event.ShiftDown() && !event.ControlDown())
{
wxGetApp().m_marked_list->Clear(true);
}
if (wxGetApp().m_marked_list->ObjectMarked(object))
{
if (!event.ShiftDown())
{
wxGetApp().m_marked_list->Remove(object, true);
}
}
else
{
wxGetApp().m_marked_list->Add(object, true);
m_last_click_point = CClickPoint(wxPoint(event.GetX(), event.GetY()), depth);
gp_Lin ray = wxGetApp().m_current_viewport->m_view_point.SightLine(wxPoint(event.GetX(), event.GetY()));
double ray_start[3], ray_direction[3];
extract(ray.Location(), ray_start);
extract(ray.Direction(), ray_direction);
marked_object.GetFirstOfTopOnly();
object->SetClickMarkPoint(marked_object.GetCurrent(), ray_start, ray_direction);
}
}
else
{
if(!event.ShiftDown() && !event.ControlDown())
{
wxGetApp().m_marked_list->Clear(true);
}
}
}
if(m_just_one && m_doing_a_main_loop && (wxGetApp().m_marked_list->size() > 0))
{
ExitMainLoop();
}
else
{
wxGetApp().m_current_viewport->m_need_refresh = true;
}
}
示例5: OnMouseEvent
void wxCustomHeightListCtrl::OnMouseEvent(wxMouseEvent& event)
{
bool changed = false;
if (event.ButtonDown() && m_allow_selection)
{
wxPoint pos = event.GetPosition();
int x, y;
CalcUnscrolledPosition(pos.x, pos.y, &x, &y);
if (y > m_lineHeight * m_lineCount)
{
m_focusedLine = -1;
m_selectedLines.clear();
changed = true;
}
else
{
int line = y / m_lineHeight;
if (event.ShiftDown())
{
if (line < m_focusedLine)
{
for (int i = line; i <= m_focusedLine; i++)
{
if (m_selectedLines.find(i) == m_selectedLines.end())
{
changed = true;
m_selectedLines.insert(i);
}
}
}
else
{
for (int i = line; i >= m_focusedLine; i--)
{
if (m_selectedLines.find(i) == m_selectedLines.end())
{
changed = true;
m_selectedLines.insert(i);
}
}
}
}
else if (event.ControlDown())
{
if (m_selectedLines.find(line) == m_selectedLines.end())
m_selectedLines.insert(line);
else
m_selectedLines.erase(line);
changed = true;
}
else
{
m_selectedLines.clear();
m_selectedLines.insert(line);
changed = true;
}
m_focusedLine = line;
}
Refresh();
}
event.Skip();
if (changed)
{
wxCommandEvent evt(wxEVT_COMMAND_LISTBOX_SELECTED, GetId());
ProcessEvent(evt);
}
}
示例6: wxOnMouseEvent
void klsGLCanvas::wxOnMouseEvent(wxMouseEvent& event) {
reclaimViewport();
isShiftDown = event.ShiftDown();
isControlDown = event.ControlDown();
// Always set the mouse coords to the current event:
setMouseScreenCoords(event.GetPosition());
setMouseCoords();
// Check all of the button events:
if(event.LeftDown()) {
mouseOutOfWindow = false; // Assume that we clicked inside the window!
beginDrag(BUTTON_LEFT);
OnMouseDown(event); // Call the event handler.
} else if(event.LeftUp() || event.LeftDClick()) {
endDrag(BUTTON_LEFT);
OnMouseUp(event);
} else if(event.RightDown() || event.RightDClick()) {
beginDrag(BUTTON_RIGHT);
OnMouseDown(event); // Call the event handler.
} else if(event.RightUp()) {
endDrag(BUTTON_RIGHT);
OnMouseUp(event);
} else if(event.MiddleDown() || event.MiddleDClick()) {
beginDrag(BUTTON_MIDDLE);
OnMouseDown(event); // Call the event handler.
if(event.MiddleDClick()) {
// Debugging screen shot code.
// I left it in because it was nifty to have around, especially
// for writing documentation.
// Render the canvas to a bitmap and save it:
wxSize sz = GetClientSize();
wxImage screenShot = renderToImage(
sz.GetWidth(), sz.GetHeight(), 32);
wxBitmap myBMP(screenShot);
myBMP.SaveFile(std2wx("screen_shot.bmp"), wxBITMAP_TYPE_BMP);
}
} else if(event.MiddleUp()) {
endDrag(BUTTON_MIDDLE);
OnMouseUp(event);
} else {
// It's not a button event, so check the others:
if(event.Entering()) {
mouseOutOfWindow = false;
scrollTimer->Stop();
OnMouseEnter(event);
} else if(event.Leaving() && !isDragging( BUTTON_MIDDLE) ) { // Don't allow auto-scroll during pan-scrolling.
// Flag the scroll event by telling it that the
// mouse has left the window:
mouseOutOfWindow = true;
// Start the scroll timer:
if(isAutoScrollOn() && isDragging( BUTTON_LEFT) ) {
scrollTimer->Start(SCROLL_TIMER_RATE);
}
// Call the event handler:
OnMouseLeave(event);
} else {
// Handle the drag-pan event here if needed:
if(isDragging( BUTTON_MIDDLE) ) {
GLPoint2f mouseDelta(getMouseCoords().x - getDragStartCoords( BUTTON_MIDDLE).x,
getMouseCoords().y - getDragStartCoords(BUTTON_MIDDLE).y );
translatePan(-mouseDelta.x, -mouseDelta.y);
}
// It's nothing else, so it must be a mouse motion event:
GLPoint2f m = getMouseCoords();
OnMouseMove(m.x, m.y, event.ShiftDown(), event.ControlDown());
}
}
// Refresh the canvas to show the mouse drag highlights if needed:
#ifdef CANVAS_DEBUG_TESTS_ON
Refresh();
#endif
}
示例7: onWheel
void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
{
const double wheelPanSpeed = 0.001;
// mousewheelpan disabled:
// wheel + ctrl -> horizontal scrolling;
// wheel + shift -> vertical scrolling;
// wheel -> zooming;
// mousewheelpan enabled:
// wheel -> pan;
// wheel + ctrl -> zooming;
// wheel + shift -> horizontal scrolling.
if( ( !m_settings.m_enableMousewheelPan && ( aEvent.ControlDown() || aEvent.ShiftDown() ) ) ||
( m_settings.m_enableMousewheelPan && !aEvent.ControlDown() ) )
{
// 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_settings.m_enableMousewheelPan )
{
if ( axis == wxMOUSE_WHEEL_HORIZONTAL || aEvent.ShiftDown() )
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 = 1.0;
#ifdef __WXMAC__
// On Apple pointer devices, wheel events occur frequently and with
// smaller rotation values. For those devices, let's handle zoom
// based on the rotation amount rather than the time difference.
// Unused
( void )timeDiff;
rotation = ( rotation > 0 ) ? std::min( rotation , 100 )
: std::max( rotation , -100 );
double dscale = rotation * 0.01;
zoomScale = ( rotation > 0 ) ? (1 + dscale) : 1/(1 - dscale);
#else
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 : 1/1.05;
}
#endif
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: OnMouseEvent
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(""));
}
}
}
示例9: OnMouseWheel
void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
{
if( m_ignoreMouseEvents )
return;
wxRect rect = wxRect( wxPoint( 0, 0 ), GetClientSize() );
// Ignore scroll events if the cursor is outside the drawing area.
if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
|| !rect.Contains( event.GetPosition() ) )
{
wxLogTrace( KICAD_TRACE_COORDS,
wxT( "OnMouseWheel() position(%d, %d) rectangle(%d, %d, %d, %d)" ),
event.GetPosition().x, event.GetPosition().y,
rect.x, rect.y, rect.width, rect.height );
event.Skip();
return;
}
INSTALL_UNBUFFERED_DC( dc, this );
GetParent()->SetCrossHairPosition( event.GetLogicalPosition( dc ) );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
bool offCenterReq = event.ControlDown() && event.ShiftDown();
offCenterReq = offCenterReq || m_enableZoomNoCenter;
#if wxMAJOR_VERSION >= 2 && wxMINOR_VERSION >= 9
int axis = event.GetWheelAxis();
#else
const int axis = 0;
#endif
// This is a zoom in or out command
if( event.GetWheelRotation() > 0 )
{
if( event.ShiftDown() && !event.ControlDown() )
{
if( axis == 0 )
cmd.SetId( ID_PAN_UP );
else
cmd.SetId( ID_PAN_RIGHT );
}
else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_LEFT );
else if( offCenterReq )
cmd.SetId( ID_OFFCENTER_ZOOM_IN );
else
cmd.SetId( ID_POPUP_ZOOM_IN );
}
else if( event.GetWheelRotation() < 0 )
{
if( event.ShiftDown() && !event.ControlDown() )
{
if( axis == 0 )
cmd.SetId( ID_PAN_DOWN );
else
cmd.SetId( ID_PAN_LEFT );
}
else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_RIGHT );
else if( offCenterReq )
cmd.SetId( ID_OFFCENTER_ZOOM_OUT );
else
cmd.SetId( ID_POPUP_ZOOM_OUT );
}
GetEventHandler()->ProcessEvent( cmd );
event.Skip();
}
示例10: OnMouseEvent
void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{
int localrealbutt = 0, localbutt = 0;
BASE_SCREEN* screen = GetScreen();
if( !screen )
return;
/* Adjust value to filter mouse displacement before consider the drag
* mouse is really a drag command, not just a movement while click
*/
#define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5
if( event.Leaving() )
m_canStartBlock = -1;
if( !IsMouseCaptured() ) // No mouse capture in progress.
m_requestAutoPan = false;
if( GetParent()->IsActive() )
SetFocus();
else
return;
if( !event.IsButton() && !event.Moving() && !event.Dragging() )
return;
if( event.RightDown() )
{
OnRightClick( event );
return;
}
if( m_ignoreMouseEvents )
return;
if( event.LeftIsDown() )
localrealbutt |= GR_M_LEFT_DOWN;
if( event.MiddleIsDown() )
localrealbutt |= GR_M_MIDDLE_DOWN;
if( event.LeftDown() )
localbutt = GR_M_LEFT_DOWN;
if( event.ButtonDClick( 1 ) )
localbutt = GR_M_LEFT_DOWN | GR_M_DCLICK;
if( event.MiddleDown() )
localbutt = GR_M_MIDDLE_DOWN;
localrealbutt |= localbutt; // compensation default wxGTK
INSTALL_UNBUFFERED_DC( DC, this );
DC.SetBackground( *wxBLACK_BRUSH );
// Compute the cursor position in drawing (logical) units.
GetParent()->SetMousePosition( event.GetLogicalPosition( DC ) );
int kbstat = 0;
if( event.ShiftDown() )
kbstat |= GR_KB_SHIFT;
if( event.ControlDown() )
kbstat |= GR_KB_CTRL;
if( event.AltDown() )
kbstat |= GR_KB_ALT;
// Calling Double Click and Click functions :
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
{
GetParent()->OnLeftDClick( &DC, GetParent()->RefPos( true ) );
// inhibit a response to the mouse left button release,
// because we have a double click, and we do not want a new
// OnLeftClick command at end of this Double Click
m_ignoreNextLeftButtonRelease = true;
}
else if( event.LeftUp() )
{
// A block command is in progress: a left up is the end of block
// or this is the end of a double click, already seen
// Note also m_ignoreNextLeftButtonRelease can be set by
// the call to OnLeftClick(), so do not change it after calling OnLeftClick
bool ignoreEvt = m_ignoreNextLeftButtonRelease;
m_ignoreNextLeftButtonRelease = false;
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK && !ignoreEvt )
GetParent()->OnLeftClick( &DC, GetParent()->RefPos( true ) );
}
else if( !event.LeftIsDown() )
{
/* be sure there is a response to a left button release command
* even when a LeftUp event is not seen. This happens when a
* double click opens a dialog box, and the release mouse button
* is made when the dialog box is opened.
*/
//.........这里部分代码省略.........
示例11: OnMouseIdle
void wxsItemEditorContent::OnMouseIdle(wxMouseEvent& event)
{
BlockFetch(false);
m_DragInitPosX = event.GetX();
m_DragInitPosY = event.GetY();
int MouseX = event.GetX();
int MouseY = event.GetY();
wxsItem* OnCursor = FindItemAtPos(MouseX,MouseY,m_Data->GetRootItem());
if ( !OnCursor ) OnCursor = m_Data->GetRootItem();
wxWindow* Preview = GetPreviewWindow(OnCursor);
if ( event.LeftDClick() && !event.RightIsDown() && !event.MiddleIsDown() )
{
if ( Preview )
{
int PosX, PosY, SizeX, SizeY;
FindAbsoluteRect(OnCursor,PosX,PosY,SizeX,SizeY);
if ( OnCursor->MouseDClick(Preview,MouseX-PosX,MouseY-PosY) )
{
m_MouseState = msWaitForIdle;
m_Editor->RebuildPreview();
m_MouseState = msWaitForIdle;
return;
}
}
}
if ( event.LeftDown() && !event.LeftDClick() && !event.RightIsDown() && !event.MiddleIsDown() )
{
// Selecting / drag init event
bool NeedRefresh = false;
if ( Preview )
{
int PosX, PosY, SizeX, SizeY;
FindAbsoluteRect(OnCursor,PosX,PosY,SizeX,SizeY);
NeedRefresh = OnCursor->MouseClick(Preview,MouseX-PosX,MouseY-PosY);
}
if ( NeedRefresh )
{
m_MouseState = msWaitForIdle;
m_Editor->RebuildPreview();
m_MouseState = msWaitForIdle;
return;
}
DragPointData* DPD = FindDragPointAtPos(MouseX,MouseY);
if ( DPD )
{
// If there's drag point, starting point-dragging sequence
m_CurDragPoint = DPD;
m_CurDragItem = DPD->Item;
m_MouseState = msDraggingPointInit;
}
else
{
if ( !OnCursor->GetIsSelected() )
{
m_Data->SelectItem(OnCursor,!event.ControlDown());
}
else
{
m_Data->SelectItem(OnCursor,false);
}
m_CurDragPoint = FindDragPointFromItem(OnCursor);
m_CurDragItem = OnCursor;
m_MouseState = msDraggingItemInit;
if ( !m_CurDragPoint || !m_CurDragItem )
{
// If we're here, preview has probably not been updated yet
m_MouseState = msWaitForIdle;
}
}
}
if ( !event.LeftIsDown() && event.RightDown() && !event.MiddleIsDown() )
{
if ( Preview )
{
int PosX, PosY, SizeX, SizeY;
FindAbsoluteRect(OnCursor,PosX,PosY,SizeX,SizeY);
if ( OnCursor->MouseRightClick(Preview,MouseX-PosX,MouseY-PosY) )
{
m_MouseState = msWaitForIdle;
m_Editor->RebuildPreview();
m_MouseState = msWaitForIdle;
return;
}
}
}
if ( !event.LeftIsDown() && !event.RightIsDown() && !event.MiddleIsDown() )
{
// Updating cursor
//.........这里部分代码省略.........
示例12: bmx_wxmouseevent_controldown
int bmx_wxmouseevent_controldown(wxMouseEvent & event) {
return static_cast<int>(event.ControlDown());
}
示例13: On_Mouse_LDown
//---------------------------------------------------------
void CWKSP_Data_Button::On_Mouse_LDown(wxMouseEvent &event)
{
_Set_Active(event.ControlDown());
}
示例14: OnMouseEvent
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();
}
示例15: OnMouseEvents
void WebView::OnMouseEvents(wxMouseEvent& event)
{
event.Skip();
if (!m_impl->page)
return;
WebCore::Frame* frame = m_mainFrame->GetFrame();
if (!frame || !frame->view())
return;
wxPoint globalPoint = ClientToScreen(event.GetPosition());
wxEventType type = event.GetEventType();
if (type == wxEVT_MOUSEWHEEL) {
if (m_mouseWheelZooms && event.ControlDown() && !event.AltDown() && !event.ShiftDown()) {
if (event.GetWheelRotation() < 0)
DecreaseTextSize();
else if (event.GetWheelRotation() > 0)
IncreaseTextSize();
} else {
WebCore::PlatformWheelEvent wkEvent(event, globalPoint);
frame->eventHandler()->handleWheelEvent(wkEvent);
}
return;
}
// If an event, such as a right-click event, leads to a focus change (e.g. it
// raises a dialog), WebKit never gets the mouse up event and never relinquishes
// mouse capture. This leads to WebKit handling mouse events, such as modifying
// the selection, while other controls or top level windows have the focus.
// I'm not sure if this is the right place to handle this, but I can't seem to
// find a precedent on how to handle this in other ports.
if (wxWindow::FindFocus() != this) {
while (HasCapture())
ReleaseMouse();
frame->eventHandler()->setMousePressed(false);
return;
}
int clickCount = event.ButtonDClick() ? 2 : 1;
if (clickCount == 1 && m_impl->tripleClickTimer.IsRunning()) {
wxPoint diff(event.GetPosition() - m_impl->tripleClickPos);
if (abs(diff.x) <= wxSystemSettings::GetMetric(wxSYS_DCLICK_X) &&
abs(diff.y) <= wxSystemSettings::GetMetric(wxSYS_DCLICK_Y)) {
clickCount = 3;
}
} else if (clickCount == 2) {
m_impl->tripleClickTimer.Start(getDoubleClickTime(), false);
m_impl->tripleClickPos = event.GetPosition();
}
WebCore::PlatformMouseEvent wkEvent(event, globalPoint, clickCount);
if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN ||
type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) {
frame->eventHandler()->handleMousePressEvent(wkEvent);
if (!HasCapture())
CaptureMouse();
} else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP) {
frame->eventHandler()->handleMouseReleaseEvent(wkEvent);
while (HasCapture())
ReleaseMouse();
} else if (type == wxEVT_MOTION || type == wxEVT_ENTER_WINDOW || type == wxEVT_LEAVE_WINDOW)
frame->eventHandler()->mouseMoved(wkEvent);
}