当前位置: 首页>>代码示例>>C++>>正文


C++ wxMouseEvent::ButtonDClick方法代码示例

本文整理汇总了C++中wxMouseEvent::ButtonDClick方法的典型用法代码示例。如果您正苦于以下问题:C++ wxMouseEvent::ButtonDClick方法的具体用法?C++ wxMouseEvent::ButtonDClick怎么用?C++ wxMouseEvent::ButtonDClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxMouseEvent的用法示例。


在下文中一共展示了wxMouseEvent::ButtonDClick方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnMouseEvent

void TrackPanel::OnMouseEvent(wxMouseEvent& event)
{
  if (event.m_x < view->labelWidth) {
	//	Group panel stuff

	if (event.ButtonDClick())
	  view->DClickLabel(event);  
	else if (event.ButtonDown())
	  view->ClickLabel(event);
	else if (event.ButtonUp())
	  SetCursor(*mainCursor);
  }
  else {
	if (event.ButtonDown()) {
	  CaptureMouse();
	  if (event.ControlDown())
		SetCursor(*dragCursor);
	  view->ClickTrack(event);
	}
	else if (event.Dragging())
	  view->DragTrack(event);
	else if (event.ButtonUp()) {
	  ReleaseMouse();
	  SetCursor(*mainCursor);
	  view->ButtonUpTrack();
	}
	else if (event.Moving()) {
	  view->TrackSetCursor(event);
	}
  }
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:31,代码来源:AudioView.cpp

示例2: OnMouse

void kwxLinearReg::OnMouse(wxMouseEvent& event)
{
	if (m_iStato == 0 && event.Entering())						//dentro nel controllo
		m_iStato = ENTERED ;
	else if (m_iStato >= ENTERED && event.Leaving())			//fuori dal controllo
		m_iStato = LEFT ;
	else if (m_iStato == ENTERED && event.GetWheelRotation())	// process wheel event
	{
		//SetValue(m_iRealVal + (event.GetWheelRotation() * (m_iMax-m_iMin)/kwxLinearReg::MOUSE_STEP / event.GetWheelDelta()) );    	
		SetValue(m_iRealVal + ( m_iBigStep * event.GetWheelRotation()  / event.GetWheelDelta()) );    	
    	vSendEvent();												// send event
		return;
	}
	else if (m_iStato == ENTERED && event.ButtonDClick())		// process double click
	{
//		wxLogTrace("Mouse Premuto") ;
		m_mousePosition = event.GetPosition();
		
		if( (m_iSnapRange<1) && 
			(m_iStyle & STYLE_SNAP_DOUBLE_CLK)	){				// if no snapping was set..
				vSetSnap2Tags(true);							// ..snap to next tag.
				DrawPosition() ;
				vSetSnap2Tags(false);
				return;
		}
		DrawPosition() ;
	}	
	else if (m_iStato == ENTERED && event.LeftDown())			//click o inizio trascinamento
	{
//		wxLogTrace("Mouse Premuto") ;
		m_iStato = DRAGED ;
		if( (m_bEditing) ){										// if control is currently in edit mode 
			if(m_cCurrentRect.Contains(m_mousePosition)){		// mouse click was within text sourrounding rectangle
				m_bEditing 		 = false;						// exit edit mode
				m_iCaretPosition = 0;							// reset edit caret position
				SetValue(iConvert(m_strCurrent));
				Refresh() ;
				vSendEvent() ;
				return;
			}
		}
		m_mousePosition = event.GetPosition();
		DrawPosition() ;
		
		
	}	
	else if (m_iStato == DRAGED && event.LeftIsDown())			//trascinamento
	{
//		wxLogTrace("Mouse trascinato") ;
		m_mousePosition = event.GetPosition();
		DrawPosition() ;
	}
	else if (m_iStato == DRAGED && event.LeftUp())				//fine trascinamento o rilascio click
	{
//		wxLogTrace("Mouse rilasciato") ;
		m_iStato = ENTERED ;
	}
	event.Skip(false);// 
}
开发者ID:jhoggart,项目名称:rt-tuner,代码行数:59,代码来源:slider.cpp

示例3: OnMouseEvents

void wxWebView::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;
    }
    
    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);
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:56,代码来源:WebView.cpp

示例4: OnMouseEvent

void ToolBarMiniFrame::OnMouseEvent(wxMouseEvent& evt)
{

   //The following is prototype code for allowing a double-click
   //close the toolbar.  Commented out in lieu of a close button
   //that is being tested.

#if 0
     if(evt.ButtonDClick(1))
      {
         AudacityProject * p  = GetActiveProject();
         ToolBar* tb = ToolBarFrame::GetToolBar();
         ToolBarStub *tbs= tb->GetToolBarStub();
         p->FloatToolBar(tbs);
      }
#endif
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:17,代码来源:ToolBar.cpp

示例5: if

PlatformMouseEvent::PlatformMouseEvent(const wxMouseEvent& event, const wxPoint& globalPoint)
    : m_position(event.GetPosition())
    , m_globalPosition(globalPoint)
    , m_shiftKey(event.ShiftDown())
    , m_ctrlKey(event.CmdDown())
    , m_altKey(event.AltDown())
    , m_metaKey(event.MetaDown()) // FIXME: We'll have to test other browsers
{
    wxEventType type = event.GetEventType();
    m_eventType = MouseEventMoved;
    
    if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN)
        m_eventType = MouseEventPressed;
    
    else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP || 
                type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK)
        m_eventType = MouseEventReleased;

    else if (type == wxEVT_MOTION)
        m_eventType = MouseEventMoved;

    if (event.Button(wxMOUSE_BTN_LEFT))
        m_button = LeftButton;
    else if (event.Button(wxMOUSE_BTN_RIGHT))
        m_button = RightButton;
    else if (event.Button(wxMOUSE_BTN_MIDDLE))
        m_button = MiddleButton;
    else if (!m_eventType == MouseEventMoved)
        ASSERT_NOT_REACHED();


    if (m_eventType == MouseEventMoved)
        m_clickCount = 0;
    else
        m_clickCount = event.ButtonDClick() ? 2 : 1;

    m_timestamp = WebCore::currentTime();
}
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:38,代码来源:MouseEventWx.cpp

示例6: on_mouse_event

void view::on_mouse_event(wxMouseEvent& evt) {
    wxPoint pos = evt.GetPosition();
    rtransform(pos.x, pos.y);
    ptr<visual> processor = get_mouse_processor(m_mouse_processor, this, 
            m_doc->get_objects(), pos);
    long flag = 0;
    if (evt.LeftIsDown())
        flag |= flag_left_button;
    if (evt.RightIsDown())
        flag |= flag_right_button;
    if (evt.MiddleIsDown())
        flag |= flag_middle_button;

    if (m_mouse_last_processor != processor) {
        processor->on_mouse_move_in(pos.x, pos.y, flag);
        if (m_mouse_last_processor != nullptr)
            m_mouse_last_processor->on_mouse_move_out(pos.x, pos.y, flag);
    }

    if (evt.GetWheelDelta() != 0) {
        int ds = evt.GetWheelDelta() / evt.GetWheelRotation();
        processor->on_mouse_wheel(pos.x, pos.y, ds, flag);
    } else if (evt.Moving() || evt.Dragging()) {
        processor->on_mouse_move(pos.x, pos.y, flag);
    } else if (evt.ButtonDown()) {
        processor->on_mouse_down(pos.x, pos.y, flag);
    } else if (evt.ButtonUp()) {
        processor->on_mouse_up(pos.x, pos.y, flag);
        change_select(processor);
    } else if (evt.ButtonDClick()) {
        processor->on_mouse_dclick(pos.x, pos.y, flag);
    }

    m_mouse_last_processor = processor;
    refresh();
}
开发者ID:xiangyun-kongxy,项目名称:genetis,代码行数:36,代码来源:view.cpp

示例7: 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]);
//.........这里部分代码省略.........
开发者ID:Blue-Shadow,项目名称:SLADE,代码行数:101,代码来源:TextureEditorPanel.cpp

示例8: 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();
}
开发者ID:RaphaelMarinier,项目名称:audacity,代码行数:63,代码来源:AButton.cpp

示例9: OnMouseEvent

void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{
    int          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.
        SetAutoPanRequest( 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.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;

    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 ) )
    {
        if( m_ClickTimer )
        {
            m_ClickTimer->Stop();
            wxDELETE( m_ClickTimer );
        }
        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 )
        {
            EDA_ITEM* item = screen->GetCurItem();
            m_CursorClickPos = GetParent()->RefPos( true );

            // If we have an item already selected, or we are using a tool,
            // we won't use the disambiguation menu so process the click immediately
            if( ( item && item->GetFlags() ) || GetParent()->GetToolId() != ID_NO_TOOL_SELECTED )
                GetParent()->OnLeftClick( &DC, m_CursorClickPos );
            else
            {
                wxDELETE( m_ClickTimer );
                m_ClickTimer = new wxTimer(this, ID_MOUSE_DOUBLECLICK);
                m_ClickTimer->StartOnce( m_doubleClickInterval );
//.........这里部分代码省略.........
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:101,代码来源:eda_draw_panel.cpp

示例10: HandleMouse

bool wxStdScrollBarInputHandler::HandleMouse(wxInputConsumer *consumer,
                                             const wxMouseEvent& event)
{
    // is this a click event from an acceptable button?
    int btn = event.GetButton();
    if ( btn == wxMOUSE_BTN_LEFT )
    {
        // determine which part of the window mouse is in
        wxScrollBar *scrollbar = wxStaticCast(consumer->GetInputWindow(), wxScrollBar);
        wxHitTest ht = scrollbar->HitTestBar(event.GetPosition());

        // when the mouse is pressed on any scrollbar element, we capture it
        // and hold capture until the same mouse button is released
        if ( event.ButtonDown() || event.ButtonDClick() )
        {
            if ( !m_winCapture )
            {
                m_btnCapture = btn;
                m_winCapture = consumer->GetInputWindow();
                m_winCapture->CaptureMouse();

                // generate the command
                bool hasAction = true;
                wxControlAction action;
                switch ( ht )
                {
                    case wxHT_SCROLLBAR_ARROW_LINE_1:
                        action = wxACTION_SCROLL_LINE_UP;
                        break;

                    case wxHT_SCROLLBAR_ARROW_LINE_2:
                        action = wxACTION_SCROLL_LINE_DOWN;
                        break;

                    case wxHT_SCROLLBAR_BAR_1:
                        action = wxACTION_SCROLL_PAGE_UP;
                        m_ptStartScrolling = event.GetPosition();
                        break;

                    case wxHT_SCROLLBAR_BAR_2:
                        action = wxACTION_SCROLL_PAGE_DOWN;
                        m_ptStartScrolling = event.GetPosition();
                        break;

                    case wxHT_SCROLLBAR_THUMB:
                        consumer->PerformAction(wxACTION_SCROLL_THUMB_DRAG);
                        m_ofsMouse = GetMouseCoord(scrollbar, event) -
                                     scrollbar->ScrollbarToPixel();

                        // fall through: there is no immediate action

                    default:
                        hasAction = false;
                }

                // remove highlighting
                Highlight(scrollbar, false);
                m_htLast = ht;

                // and press the arrow or highlight thumb now instead
                if ( m_htLast == wxHT_SCROLLBAR_THUMB )
                    Highlight(scrollbar, true);
                else
                    Press(scrollbar, true);

                // start dragging
                if ( hasAction )
                {
                    m_timerScroll = new wxScrollBarTimer(this, action,
                                                         scrollbar);
                    m_timerScroll->StartAutoScroll();
                }
                //else: no (immediate) action

            }
            //else: mouse already captured, nothing to do
        }
        // release mouse if the *same* button went up
        else if ( btn == m_btnCapture )
        {
            if ( m_winCapture )
            {
                StopScrolling(scrollbar);

                // if we were dragging the thumb, send the last event
                if ( m_htLast == wxHT_SCROLLBAR_THUMB )
                {
                    scrollbar->PerformAction(wxACTION_SCROLL_THUMB_RELEASE);
                }

                m_htLast = ht;
                Highlight(scrollbar, true);
            }
            else
            {
                // this is not supposed to happen as the button can't go up
                // without going down previously and then we'd have
                // m_winCapture by now
                wxFAIL_MSG( wxT("logic error in mouse capturing code") );
            }
//.........这里部分代码省略.........
开发者ID:esrrhs,项目名称:fuck-music-player,代码行数:101,代码来源:scrolbar.cpp

示例11: OnMouseEvent

void WinEDA_DrawPanel::OnMouseEvent(wxMouseEvent& event)
/*******************************************************/
// Called when the canvas receives a mouse event. //
{
int localrealbutt = 0, localbutt = 0, localkey = 0;
BASE_SCREEN * screen = GetScreen();
static WinEDA_DrawPanel * LastPanel;
	
	if ( event.Leaving() || event.Entering() )
	{
		m_CanStartBlock = -1;
	}

	if (GetScreen()->ManageCurseur == NULL ) // Pas de commande en cours
		m_AutoPAN_Request = FALSE;

	if ( m_Parent->m_FrameIsActive ) SetFocus();
	else return;

	// Mouse Wheel is a zoom command:
	if ( event.m_wheelRotation )
	{
		// This is a zoom in ou out command
		if ( event.GetWheelRotation() > 0 ) localkey = WXK_F1;
		else  localkey = WXK_F2;
	}

	if( !event.IsButton() && !event.Moving() &&
		!event.Dragging() && ! localkey )
	{
		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;
	if( event.ButtonDClick(2)) {};	// Unused


	localrealbutt |= localbutt;		/* compensation defaut wxGTK */

	screen->m_MousePosition = CalcAbsolutePosition(wxPoint(event.GetX(), event.GetY()));

wxClientDC DC(this);
int kbstat = 0;

	DC.SetBackground(*wxBLACK_BRUSH );
	PrepareGraphicContext(&DC);

	g_KeyPressed = localkey;

	if( event.ShiftDown() ) kbstat |= GR_KB_SHIFT;
	if( event.ControlDown() ) kbstat |= GR_KB_CTRL;
	if( event.AltDown() ) kbstat |= GR_KB_ALT;

	g_MouseOldButtons = localrealbutt;

	// Appel des fonctions liées au Double Click ou au Click
	if( localbutt == (int)(GR_M_LEFT_DOWN|GR_M_DCLICK) )
		m_Parent->OnLeftDClick(&DC, screen->m_MousePosition);

	else if ( event.LeftDown() )
		m_Parent->OnLeftClick(&DC, screen->m_MousePosition);

	if( event.ButtonUp(2) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
	{	// The middle button has been relached, with no block command:
		// We use it for a zoom center command
		g_KeyPressed = localkey = WXK_F4;
	}
		

	/* Appel de la fonction generale de gestion des mouvements souris
	et commandes clavier */
	m_Parent->GeneralControle(&DC, screen->m_MousePosition);


	/*******************************/
	/* Control of block commands : */
	/*******************************/
	
	// Command block can't start if mouse is dragging a new panel
	if (LastPanel != this ) m_CanStartBlock = -1;

	// A new command block can start after a release buttons
	// Avoid a false start block when a dialog bos is demiss,
	// or when changing panels in hierachy navigation
	if ( !event.LeftIsDown() && !event.MiddleIsDown())
	{
		m_CanStartBlock = 0;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:101,代码来源:drawpanel.cpp

示例12: OnMouse

void wxHeaderCtrl::OnMouse(wxMouseEvent& mevent)
{
    // do this in advance to allow simply returning if we're not interested,
    // we'll undo it if we do handle the event below
    mevent.Skip();


    // account for the control displacement
    const int xPhysical = mevent.GetX();
    const int xLogical = xPhysical - m_scrollOffset;

    // first deal with the [continuation of any] dragging operations in
    // progress
    if ( IsResizing() )
    {
        if ( mevent.LeftUp() )
            EndResizing(xPhysical);
        else // update the live separator position
            StartOrContinueResizing(m_colBeingResized, xPhysical);

        return;
    }

    if ( IsReordering() )
    {
        if ( !mevent.LeftUp() )
        {
            // update the column position
            UpdateReorderingMarker(xPhysical);

            return;
        }

        // finish reordering and continue to generate a click event below if we
        // didn't really reorder anything
        if ( EndReordering(xPhysical) )
            return;
    }


    // find if the event is over a column at all
    bool onSeparator;
    const unsigned col = mevent.Leaving()
                         ? (onSeparator = false, COL_NONE)
                         : FindColumnAtPoint(xLogical, &onSeparator);


    // update the highlighted column if it changed
    if ( col != m_hover )
    {
        const unsigned hoverOld = m_hover;
        m_hover = col;

        RefreshColIfNotNone(hoverOld);
        RefreshColIfNotNone(m_hover);
    }

    // update mouse cursor as it moves around
    if ( mevent.Moving() )
    {
        SetCursor(onSeparator ? wxCursor(wxCURSOR_SIZEWE) : wxNullCursor);
        return;
    }

    // all the other events only make sense when they happen over a column
    if ( col == COL_NONE )
        return;


    // enter various dragging modes on left mouse press
    if ( mevent.LeftDown() )
    {
        if ( onSeparator )
        {
            // start resizing the column
            wxASSERT_MSG( !IsResizing(), "reentering column resize mode?" );
            StartOrContinueResizing(col, xPhysical);
        }
        else // on column itself
        {
            // start dragging the column
            wxASSERT_MSG( !IsReordering(), "reentering column move mode?" );

            StartReordering(col, xPhysical);
        }

        return;
    }

    // determine the type of header event corresponding to click events
    wxEventType evtType = wxEVT_NULL;
    const bool click = mevent.ButtonUp(),
               dblclk = mevent.ButtonDClick();
    if ( click || dblclk )
    {
        switch ( mevent.GetButton() )
        {
        case wxMOUSE_BTN_LEFT:
            // treat left double clicks on separator specially
            if ( onSeparator && dblclk )
//.........这里部分代码省略.........
开发者ID:Toonerz,项目名称:project64,代码行数:101,代码来源:headerctrlg.cpp

示例13: 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.
         */
//.........这里部分代码省略.........
开发者ID:JOE-JOE-NGIGI,项目名称:kicad,代码行数:101,代码来源:draw_panel.cpp

示例14: if


//.........这里部分代码省略.........
                newval = _value + (_upper_bound - _lower_bound) * fscale;
            }
            else {
                newval = _value - (_upper_bound - _lower_bound) * fscale;
            }
        }


        if (_snap_mode == IntegerSnap) {
            newval = nearbyintf (newval);
        }

        newval = max (min (newval, _upper_bound), _lower_bound);


        _value = newval;

        value_changed (get_value()); // emit

        update_value_str();
        do_redraw();
    }
    else if (ev.RightDown()) {
        this->PopupMenu ( _popup_menu, ev.GetX(), ev.GetY());
    }
    else if (ev.RightUp()) {
        //this->PopupMenu ( _popup_menu, ev.GetX(), ev.GetY());
    }
    else if (ev.ButtonDown())
    {
        CaptureMouse();
        _dragging = true;
        _last_x = ev.GetX();
        pressed(); // emit

        if (ev.MiddleDown() && !ev.ControlDown()) {
            // set immediately
            float newval = (ev.GetX() * _val_scale) + _lower_bound;

            if (_snap_mode == IntegerSnap) {
                newval = nearbyintf (newval);
            }

            _value = newval;

            value_changed (get_value()); // emit

            update_value_str();
            do_redraw();
        }
        else if (ev.LeftDown() && ev.ShiftDown()) {
            // set to default
            _value = max (min (_default_val, _upper_bound), _lower_bound);

            value_changed(get_value());
            update_value_str();
            do_redraw();
        }
    }
    else if (ev.ButtonUp())
    {
        _dragging = false;
        ReleaseMouse();

        if (_use_pending) {
            // This didn't really work
            //if (_pending_val != _value) {
            //	_value = _pending_val;
            //	update_value_str();
            //}
            _use_pending = false;
        }


        if (ev.GetX() >= _width || ev.GetX() < 0
                || ev.GetY() < 0 || ev.GetY() > _height) {
            _barbrush.SetColour(_barcolor);
            do_redraw();
        }
        else {
            _barbrush.SetColour(_overbarcolor);
            do_redraw();
        }

        if (ev.MiddleUp() && ev.ControlDown())
        {
            // binding click
            bind_request(); // emit
        }

        released(); // emit
    }
    else if (ev.ButtonDClick()) {
        // this got annoying
        //show_text_ctrl ();
    }
    else {
        ev.Skip();
    }
}
开发者ID:alcoheca,项目名称:sooperlooper,代码行数:101,代码来源:slider_bar.cpp

示例15: OnMouseEvent

void LWSlider::OnMouseEvent(wxMouseEvent & event)
{
   if (event.Entering()) {
      #if wxUSE_TOOLTIPS // Not available in wxX11
      // Display the tooltip in the status bar
      if (mParent->GetToolTip()) 
      {
         wxString tip = mParent->GetToolTip()->GetTip();
         GetActiveProject()->TP_DisplayStatusMessage(tip);
         Refresh();
      }
      #endif
   }
   else if (event.Leaving())
   {
      GetActiveProject()->TP_DisplayStatusMessage(wxT(""));
      Refresh();
   }

   // Events other than mouse-overs are ignored when we are disabled
   if (!mEnabled)
      return;

   float prevValue = mCurrentValue;

   // Figure out the thumb position
   wxRect r;
   if (mOrientation == wxHORIZONTAL)
   {
      r.x = mLeft + ValueToPosition(mCurrentValue);
      r.y = mTop + (mCenterY - (mThumbHeight / 2));
   }
   else 
   {
      r.x = mLeft + (mCenterX - (mThumbWidth / 2));
      r.y = mTop + ValueToPosition(mCurrentValue);
   }
   r.width = mThumbWidth;
   r.height = mThumbHeight;

   wxRect tolerantThumbRect = r;
   tolerantThumbRect.Inflate(3, 3);

   // Should probably use a right click instead/also
   if( event.ButtonDClick() && mPopup )
   {
      //On a double-click, we should pop up a dialog.
      DoShowDialog(mParent->ClientToScreen(wxPoint(event.m_x,event.m_y)));
   }
   else if( event.ButtonDown() )
   {
      if( mDefaultShortcut && event.CmdDown() )
      {
         mCurrentValue = mDefaultValue;
      }

      if( event.RightDown() ) {
         mParent->SetFocus();
      }

      // Thumb clicked?
      //
      // Do not change position until first drag.  This helps
      // with unintended value changes.
      if( tolerantThumbRect.Contains( event.GetPosition() ) )
      {
         // Remember mouse position and current value
         mClickPos = (mOrientation == wxHORIZONTAL) ? event.m_x : event.m_y;
         mClickValue = mCurrentValue;

         mIsDragging = true;
      }
      // Clicked to set location?
      else
      {
         mCurrentValue = 
            ClickPositionToValue(
               (mOrientation == wxHORIZONTAL) ? event.m_x : event.m_y, 
               event.ShiftDown());
      }

      mParent->CaptureMouse();
      // wxSetCursor(wxCURSOR_BLANK);
      ((TipPanel*)LWSlider::sharedTipPanel)->SetTargetParent(mParent);
      FormatPopWin();
      SetPopWinPosition();
      LWSlider::sharedTipPanel->Show();
      //hide mouseover tooltip
      wxToolTip::Enable(false);
   }
   else if( event.ButtonUp() )
   {
      mIsDragging = false;
      if (mParent->HasCapture())
         mParent->ReleaseMouse();
      LWSlider::sharedTipPanel->Hide();
      //restore normal tooltip behavor for mouseovers
      wxToolTip::Enable(true);
      // wxSetCursor(wxNullCursor);
   }
//.........这里部分代码省略.........
开发者ID:Cactuslegs,项目名称:audacity-of-nope,代码行数:101,代码来源:ASlider.cpp


注:本文中的wxMouseEvent::ButtonDClick方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。