Esempio n. 1
0
void wxWebView::OnContextMenuEvents(wxContextMenuEvent& event)
{
    m_impl->page->contextMenuController()->clearContextMenu();
    wxPoint localEventPoint = ScreenToClient(event.GetPosition());

    if (!m_mainFrame)
        return;
        
    WebCore::Frame* focusedFrame = m_mainFrame->GetFrame();
    if (!focusedFrame->view())
        return;

    //Create WebCore mouse event from the wxContextMenuEvent
    wxMouseEvent mouseEvent(wxEVT_RIGHT_DOWN);
    mouseEvent.m_x = localEventPoint.x;
    mouseEvent.m_y = localEventPoint.y;
    WebCore::PlatformMouseEvent wkEvent(mouseEvent, event.GetPosition());

    bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(wkEvent);
    if (!handledEvent)
        return;

    WebCore::ContextMenu* coreMenu = m_impl->page->contextMenuController()->contextMenu();
    if (!coreMenu)
        return;

    WebCore::PlatformMenuDescription menuWx = coreMenu->platformDescription();
    if (!menuWx)
        return;

    PopupMenu(menuWx, localEventPoint);
}
Esempio n. 2
0
void MyListCtrl::OnContextMenu(wxContextMenuEvent& event)
{
    if (GetEditControl() == NULL)
    {
        wxPoint point = event.GetPosition();
        // If from keyboard
        if ( (point.x == -1) && (point.y == -1) )
        {
            wxSize size = GetSize();
            point.x = size.x / 2;
            point.y = size.y / 2;
        }
        else
        {
            point = ScreenToClient(point);
        }
        ShowContextMenu(point);
    }
    else
    {
        // the user is editing:
        // allow the text control to display its context menu
        // if it has one (it has on Windows) rather than display our one
        event.Skip();
    }
}
Esempio n. 3
0
void wxWebView::OnContextMenuEvents(wxContextMenuEvent& event)
{
    Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(wxWebView::OnMenuSelectEvents), NULL, this);
    m_impl->page->contextMenuController()->clearContextMenu();
    wxPoint localEventPoint = ScreenToClient(event.GetPosition());

    if (!m_impl->page)
        return;
        
    WebCore::Frame* focusedFrame = m_impl->page->focusController()->focusedOrMainFrame();
    if (!focusedFrame->view())
        return;

    //Create WebCore mouse event from the wxContextMenuEvent
    wxMouseEvent mouseEvent(wxEVT_RIGHT_DOWN);
    mouseEvent.m_x = localEventPoint.x;
    mouseEvent.m_y = localEventPoint.y;
    WebCore::PlatformMouseEvent wkEvent(mouseEvent, event.GetPosition(), 1);

    bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(wkEvent);
    if (!handledEvent)
        return;

    WebCore::ContextMenu* coreMenu = m_impl->page->contextMenuController()->contextMenu();
    if (!coreMenu)
        return;

    WebCore::PlatformMenuDescription menuWx = coreMenu->platformDescription();
    if (!menuWx)
        return;

    PopupMenu(menuWx, localEventPoint);
    
    Disconnect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(wxWebView::OnMenuSelectEvents), NULL, this);
}
void unFilterListCtrl::OnContextMenu( wxContextMenuEvent& event )
{
	wxPoint pt = event.GetPosition();
	//wxLogMessage(wxT("OnContextMenu at screen coords (%i, %i)"), pt.x, pt.y);

	if( pt.x == -1 && pt.y == -1 ) 
	{
		pt = wxWindow::FindFocus()->GetPosition();
	}
	else 
	{
        pt = ScreenToClient(pt);
        if( pt.y > List->GetPosition().y )
        {
            event.Skip();
            return;
        }
	}


	wxMenu menu(wxT("RegExp Options"));
	menu.AppendRadioItem(Menu_SyntaxExtended, wxT("&Extended Syntax"));
	menu.AppendRadioItem(Menu_SyntaxAdvanced, wxT("&Advanced Syntax"));
	menu.AppendRadioItem(Menu_SyntaxBasic, wxT("&Basic Syntax"));
	menu.AppendSeparator();
	menu.AppendCheckItem(Menu_CaseSensitive, wxT("Ignore &Case"));
	menu.AppendCheckItem(Menu_BackReferences, wxT("Don't set Back &References"));

	menu.Check( Menu_SyntaxExtended + unFilterListCtrl::reSyntax, true );
	menu.Check( Menu_CaseSensitive, !unFilterListCtrl::reCaseSensitive );
	menu.Check( Menu_BackReferences, !unFilterListCtrl::reBackReferences );

	PopupMenu(&menu, pt);

}
void cbStyledTextCtrl::OnContextMenu(wxContextMenuEvent& event)
{
    if (m_pParent)
    {
        if ( EditorBase* pParent = dynamic_cast<EditorBase*>(m_pParent) )
        {
            const bool is_right_click = event.GetPosition() != wxDefaultPosition;
            const wxPoint mp(is_right_click ? event.GetPosition() : wxDefaultPosition);
            pParent->DisplayContextMenu(mp, mtEditorManager);
        }
        else
            event.Skip();
    }
}
void pvExports::OnContextMenu( wxContextMenuEvent& event )
{
    wxPoint pt = event.GetPosition();
    if( pt.x == -1 && pt.y == -1 ) 
    {
        pt = wxWindow::FindFocus()->GetPosition();
    }
    else 
    {
        pt = ScreenToClient(pt);
    }

    long item = GetList()->GetFocusedItem();
    if( item != -1 )
    {
        wxString caption;
        caption = Serializer->GetObjectName( GetTable()->GetSerialIdx(item)+1 );

        wxMenu menu(caption);
        menu.Append(Menu_InspectObject, wxT("&Inspect Object"));
        menu.Append(Menu_InspectAll, wxT("Inspect &All (Debug)"));
        //menu.AppendSeparator();

        PopupMenu(&menu, pt);
    }
         


}
Esempio n. 7
0
void LitesqlView::OnContextMenu(wxContextMenuEvent& event)
{
  if (frame)
  {
    frame->PopupMenu(GetContextMenu(),frame->ScreenToClient(event.GetPosition()));
  }
}
Esempio n. 8
0
void MyTreeCtrl::OnContextMenu(wxContextMenuEvent& event)
{
    wxPoint pt = event.GetPosition();
    wxTreeItemId item;
    if ( !HasFlag(wxTR_MULTIPLE) )
        item = GetSelection();
    wxLogMessage(wxT("OnContextMenu at screen coords (%i, %i)"), pt.x, pt.y);

    // check if event was generated by keyboard (MSW-specific?)
    if ( pt.x == -1 && pt.y == -1 ) //(this is how MSW indicates it)
    {
        // attempt to guess where to show the menu
        if ( item.IsOk() )
        {
            // if an item was clicked, show menu to the right of it
            wxRect rect;
            GetBoundingRect(item, rect, true /* only the label */);
            pt = wxPoint(rect.GetRight(), rect.GetTop());
        }
        else
        {
            pt = wxPoint(0, 0);
        }
    }
    else // event was generated by mouse, use supplied coords
    {
        pt = ScreenToClient(pt);
    }

    ShowMenu(item, pt);
}
Esempio n. 9
0
/**< context menu */
void ImagePanel::OnContextMenu(wxContextMenuEvent& event)
{
	if (m_stMP.iState != 0)
		return;

	wxMenu* pMenu = new wxMenu();
	wxASSERT_MSG(pMenu != nullptr, _T("Create Popup Menu failed."));
	wxMenuItem* pMenuItem = nullptr;
	// group 1
	if (m_img.IsOk())
	{
		pMenuItem = new wxMenuItem(pMenu, ID_CMENU_SAVE, _("&Save Image"), _("Save the Image"));
		pMenu->Append(pMenuItem);
	}
	// popup
	if (pMenuItem != nullptr)
	{
		wxPoint pt = event.GetPosition();
		if (pt == wxDefaultPosition)
		{
			// position invalide, get the mouse position
			pt = wxGetMousePosition();
			wxRect rc = GetScreenRect();
			if (!rc.Contains(pt))
			{
				// mouse is't in the panel, get the panel center
				pt.x = rc.x + rc.width/2;
				pt.y = rc.y + rc.height/2;
			}
		}
		pt = ScreenToClient(pt);
		PopupMenu(pMenu, pt);
	}
	delete pMenu;
}
void pvExports::OnContextMenu( wxContextMenuEvent& event )
{
    guard;
    wxPoint pt = event.GetPosition();
    if( pt.x == -1 && pt.y == -1 ) 
    {
        pt = wxWindow::FindFocus()->GetPosition();
    }
    else 
    {
        pt = ScreenToClient(pt);
    }

    long item = GetList()->GetFocusedItem();
    if( item != -1 )
    {
        wxString caption;
        caption = Serializer->GetObjectName( GetTable()->GetSerialIdx(item)+1 );

        wxMenu* menu = unMenuExports::Create();
        menu->SetTitle(caption);
        PopupMenu(menu, pt);
    }
         


    unguard;
}
Esempio n. 11
0
void Frame::OnUserContext(wxContextMenuEvent& event)
{
	wxMenu* menu = new wxMenu;
	menu->Append(ID_DROP_USER, wxT("Drop User"));
	userListCtrl->PopupMenu(menu, userListCtrl->ScreenToClient(
		event.GetPosition()));
}
Esempio n. 12
0
void wxTextCtrl::OnContextMenu(wxContextMenuEvent& event)
{
    if ( GetTextPeer()->HasOwnContextMenu() )
    {
        event.Skip() ;
        return ;
    }

#if wxUSE_MENUS
    if (m_privateContextMenu == NULL)
    {
        m_privateContextMenu = new wxMenu;
        m_privateContextMenu->Append(wxID_UNDO, _("&Undo"));
        m_privateContextMenu->Append(wxID_REDO, _("&Redo"));
        m_privateContextMenu->AppendSeparator();
        m_privateContextMenu->Append(wxID_CUT, _("Cu&t"));
        m_privateContextMenu->Append(wxID_COPY, _("&Copy"));
        m_privateContextMenu->Append(wxID_PASTE, _("&Paste"));
        m_privateContextMenu->Append(wxID_CLEAR, _("&Delete"));
        m_privateContextMenu->AppendSeparator();
        m_privateContextMenu->Append(wxID_SELECTALL, _("Select &All"));
    }

    PopupMenu(m_privateContextMenu);
#endif
}
Esempio n. 13
0
void MerryMainPanel::onContextMenu(wxContextMenuEvent& e)
{
	e.StopPropagation();

	PopupMenu(menu);
    return;
}
Esempio n. 14
0
void MainWindow::file_ctrlOnContextMenu( wxContextMenuEvent& event )
{
	wxPoint point = event.GetPosition();

	if ( (point.x == -1) && (point.y == -1) )
    {
        wxSize size = GetSize();
        point.x = size.x / 2;
        point.y = size.y / 2;
    }
    else
    {
        point = ScreenToClient(point);
    }

	wxMenu menu(wxEmptyString);

	long item = file_ctrl->GetNextItem(-1,wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED);
	if (item!=-1) menu.Append(FDBex_ExtractFocusFile, wxString::Format(_("Extract '%s' to..."), file_ctrl->GetItemText(item)));
	if (file_ctrl->GetSelectedItemCount()>1)  menu.Append(FDBex_ExtractFiles, _("Extract files to..."));
    menu.Append(FDBex_ExtractFolder, _("Extract folder to..."));

	menu.AppendSeparator();
	menu.Append(FDBex_CopyPath, _("Copy pathname"));

    PopupMenu(&menu, point);
}
Esempio n. 15
0
void BaseGrid::OnContextMenu(wxContextMenuEvent &evt) {
	wxPoint pos = evt.GetPosition();
	if (pos == wxDefaultPosition || ScreenToClient(pos).y > lineHeight) {
		if (!context_menu) context_menu = menu::GetMenu("grid_context", context);
		menu::OpenPopupMenu(context_menu, this);
	}
	else {
		const wxString strings[] = {
			_("Line Number"),
			_("Layer"),
			_("Start"),
			_("End"),
			_("Style"),
			_("Actor"),
			_("Effect"),
			_("Left"),
			_("Right"),
			_("Vert"),
		};

		wxMenu menu;
		for (int i = 0; i < columns; ++i)
			menu.Append(MENU_SHOW_COL + i, strings[i], "", wxITEM_CHECK)->Check(showCol[i]);
		PopupMenu(&menu);
	}
}
Esempio n. 16
0
void MusikFXDialog::OnRightClick( wxContextMenuEvent& event )
{
	if ( event.GetId() == SLD_PITCH )
	{
		slPitch->SetValue( 50 );
		g_FX.SetFrequency( 44100 );
	}
}
Esempio n. 17
0
void MainWindow::EventHandleContextMenu(wxContextMenuEvent &event)
{
	wxMenu menu(wxT(""));
	
	menu.Append(ID_CONTEXTSETTINGS, wxT("Einstellungen"));
	menu.Append(ID_CONTEXTCLOSE, wxT("Beenden"));
	
	PopupMenu(&menu, ScreenToClient(event.GetPosition()));
}
Esempio n. 18
0
//------------------------------------------------------------------------
// 
//------------------------------------------------------------------------
void CPropertyWindow::OnContextMenu(wxContextMenuEvent& event)
{
	wxPoint point = event.GetPosition();
	point = ScreenToClient(point);
	wxMenu menu;
	menu.Append(MENU_OPEN_PROPERTY, wxT("&Open Property"));
	menu.Append(MENU_OPEN_GRAPH, wxT("&Open Graph"));
	PopupMenu(&menu, point);
}
Esempio n. 19
0
void LstOdaServerList::OnOpenContextMenu(wxContextMenuEvent& event)
{
    wxPoint MousePosition = event.GetPosition();

    if (MousePosition == wxDefaultPosition)
        MousePosition = wxGetMousePosition();

    PopupMenu(m_mnuPopup, ScreenToClient(MousePosition));
}
Esempio n. 20
0
void ModelListTree::OnContextMenu(wxContextMenuEvent& event)
{
	wxPoint pt = event.GetPosition();
	wxPoint clientPt = ScreenToClient(pt);

	wxMenu menu;  
	menu.Append(ID_MODEL_PANEL_CONTEXT_MENU_IMPORT, wxT("&import"));

	PopupMenu(&menu, clientPt);
}
Esempio n. 21
0
void Notebook::OnMenu(wxContextMenuEvent& e)
{
    int where = HitTest( ScreenToClient(::wxGetMousePosition()) );
    if(where != wxNOT_FOUND && m_contextMenu) {
        SetSelection(where, false);
        // dont notify the user about changes
        PopupMenu(m_contextMenu);
    }
    e.Skip();
}
Esempio n. 22
0
void ProjectPanel::OnContextMenu( wxContextMenuEvent& event )
{
    if ( !m_Project )
    {
        event.Skip();
        return;
    }

    wxPoint point = wxGetMousePosition();
    PopupMenu( &m_ContextMenu );
}
Esempio n. 23
0
void TimeEdit::OnContextMenu(wxContextMenuEvent &evt) {
	if (byFrame || insert) {
		evt.Skip();
		return;
	}

	wxMenu menu;
	menu.Append(Time_Edit_Copy, _("&Copy"));
	menu.Append(Time_Edit_Paste, _("&Paste"));
	PopupMenu(&menu);
}
Esempio n. 24
0
void CSearchDialog::OnContextMenu(wxContextMenuEvent& event)
{
	if (event.GetEventObject() != m_results)
	{
		event.Skip();
		return;
	}

	wxMenu* pMenu = wxXmlResource::Get()->LoadMenu(_T("ID_MENU_SEARCH"));
	if (!pMenu)
		return;

	if (!m_pState->IsRemoteIdle())
	{
		pMenu->Enable(XRCID("ID_MENU_SEARCH_DOWNLOAD"), false);
		pMenu->Enable(XRCID("ID_MENU_SEARCH_DELETE"), false);
	}

	PopupMenu(pMenu);
	delete pMenu;
}
Esempio n. 25
0
void wxGISFeatureDetailsPanel::OnContextMenu(wxContextMenuEvent& event)
{
	wxRect rc = m_listCtrl->GetRect();
	wxPoint point = event.GetPosition();
    // If from keyboard
    if (point.x == -1 && point.y == -1)
	{
        wxSize size = GetSize();
		point.x = rc.GetLeft() + rc.GetWidth() / 2;
		point.y = rc.GetTop() + rc.GetHeight() / 2;
    }
	else
	{
        point = m_listCtrl->ScreenToClient(point);
    }
	if(!rc.Contains(point))
	{
		event.Skip();
		return;
	}
    PopupMenu(m_pMenu, point.x, point.y);
}
Esempio n. 26
0
void FenetreZoom::OnMenuContext(wxContextMenuEvent& event)
{
    wxPoint point = event.GetPosition();
    // If from keyboard
    if (point.x == -1 && point.y == -1) {
        wxSize size = GetSize();
        point.x = size.x / 2;
        point.y = size.y / 2;
    } else {
        point = ScreenToClient(point);
    }
    ShowContextMenu(point);
}
Esempio n. 27
0
void MainFrame::OnMenu(wxContextMenuEvent &event)
{
	if (IsFullScreen() && ctx_menu)
	{
		wxPoint p(event.GetPosition());
#if 0 // wx actually recommends ignoring the position

		if (p != wxDefaultPosition)
			p = ScreenToClient(p);

#endif
		PopupMenu(ctx_menu, p);
	}
}
Esempio n. 28
0
void SjVisImpl::OnMouseRightUp(wxWindow* from, wxContextMenuEvent& event)
{
	wxPoint mousePt = m_thisWindow->ScreenToClient(event.GetPosition());

	if( g_mainFrame->IsAllAvailable() )
	{
		SjMenu m(0);

		g_visModule->UpdateVisMenu(&m);

		// do popup!
		m_thisWindow->PopupMenu(&m, mousePt.x, mousePt.y);
	}
}
Esempio n. 29
0
void LogTextControl::OnContextMenu(wxContextMenuEvent& event)
{
    SetFocus();

    CommandManager cm;
    wxMenu m;
    m.Append(wxID_COPY, cm.getPopupMenuItemText(_("&Copy"), wxID_COPY));
    m.AppendSeparator();
    m.Append(wxID_DELETE,
        cm.getPopupMenuItemText(_("Clear al&l"), wxID_DELETE));
    m.AppendSeparator();
    m.Append(wxID_SELECTALL,
        cm.getPopupMenuItemText(_("Select &all"), wxID_SELECTALL));

    PopupMenu(&m, calcContextMenuPosition(event.GetPosition(), this));
}
Esempio n. 30
0
void wxGxContentView::OnContextMenu(wxContextMenuEvent& event)
{
    //event.Skip();
    wxPoint point = event.GetPosition();
    // If from keyboard
    if (point.x == -1 && point.y == -1)
	{
        wxSize size = GetSize();
        point.x = size.x / 2;
        point.y = size.y / 2;
    }
	else
	{
        point = ScreenToClient(point);
    }
    ShowContextMenu(point);
}