Beispiel #1
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);
}
Beispiel #2
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);
}
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();
    }
}
Beispiel #4
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;
}
Beispiel #5
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);
}
Beispiel #6
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);
	}
}
Beispiel #7
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()));
}
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;
}
Beispiel #9
0
void LitesqlView::OnContextMenu(wxContextMenuEvent& event)
{
  if (frame)
  {
    frame->PopupMenu(GetContextMenu(),frame->ScreenToClient(event.GetPosition()));
  }
}
Beispiel #10
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);
}
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);
    }
         


}
Beispiel #12
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();
    }
}
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 MainWindow::EventHandleContextMenu(wxContextMenuEvent &event)
{
	wxMenu menu(wxT(""));
	
	menu.Append(ID_CONTEXTSETTINGS, wxT("Einstellungen"));
	menu.Append(ID_CONTEXTCLOSE, wxT("Beenden"));
	
	PopupMenu(&menu, ScreenToClient(event.GetPosition()));
}
//------------------------------------------------------------------------
// 
//------------------------------------------------------------------------
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);
}
Beispiel #16
0
void LstOdaServerList::OnOpenContextMenu(wxContextMenuEvent& event)
{
    wxPoint MousePosition = event.GetPosition();

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

    PopupMenu(m_mnuPopup, ScreenToClient(MousePosition));
}
Beispiel #17
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);
}
Beispiel #18
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);
}
Beispiel #19
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);
	}
}
Beispiel #20
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);
	}
}
Beispiel #21
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));
}
void ResultCheckListCtrl::OnContextMenu(wxContextMenuEvent& event)
{
    wxPoint point = event.GetPosition();
    //std::cout << "Right click detected\n";
    // 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);
}
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);
}
Beispiel #24
0
void TextControl::OnContextMenu(wxContextMenuEvent& event)
{
    SetFocus();

    CommandManager cm;
    wxMenu m;
    m.Append(wxID_UNDO, cm.getPopupMenuItemText(_("&Undo"), wxID_UNDO));
    m.Append(wxID_REDO, cm.getPopupMenuItemText(_("&Redo"), wxID_REDO));
    m.AppendSeparator();
    m.Append(wxID_CUT, cm.getPopupMenuItemText(_("Cu&t"), wxID_CUT));
    m.Append(wxID_COPY, cm.getPopupMenuItemText(_("&Copy"), wxID_COPY));
    m.Append(wxID_PASTE, cm.getPopupMenuItemText(_("&Paste"), wxID_PASTE));
    m.Append(wxID_DELETE, cm.getPopupMenuItemText(_("&Delete"), wxID_DELETE));
    m.AppendSeparator();
    m.Append(wxID_SELECTALL,
        cm.getPopupMenuItemText(_("Select &all"), wxID_SELECTALL));

    PopupMenu(&m, calcContextMenuPosition(event.GetPosition(), this));
}
Beispiel #25
0
void SubsTextEditCtrl::OnContextMenu(wxContextMenuEvent &event) {
	wxPoint pos = event.GetPosition();
	int activePos;
	if (pos == wxDefaultPosition)
		activePos = GetCurrentPos();
	else
		activePos = PositionFromPoint(ScreenToClient(pos));

	currentWordPos = GetBoundsOfWordAtPosition(activePos);
	currentWord = line_text.substr(currentWordPos.first, currentWordPos.second);

	wxMenu menu;
	if (spellchecker)
		AddSpellCheckerEntries(menu);

	// Append language list
	menu.Append(-1,_("Spell checker language"), GetLanguagesMenu(
		EDIT_MENU_DIC_LANGS,
		to_wx(OPT_GET("Tool/Spell Checker/Language")->GetString()),
		to_wx(spellchecker->GetLanguageList())));
	menu.AppendSeparator();

	AddThesaurusEntries(menu);

	// Standard actions
	menu.Append(EDIT_MENU_CUT,_("Cu&t"))->Enable(GetSelectionStart()-GetSelectionEnd() != 0);
	menu.Append(EDIT_MENU_COPY,_("&Copy"))->Enable(GetSelectionStart()-GetSelectionEnd() != 0);
	menu.Append(EDIT_MENU_PASTE,_("&Paste"))->Enable(CanPaste());
	menu.AppendSeparator();
	menu.Append(EDIT_MENU_SELECT_ALL,_("Select &All"));

	// Split
	if (context) {
		menu.AppendSeparator();
		menu.Append(EDIT_MENU_SPLIT_PRESERVE, _("Split at cursor (preserve times)"));
		menu.Append(EDIT_MENU_SPLIT_ESTIMATE, _("Split at cursor (estimate times)"));
		cmd::Command *split_video = cmd::get("edit/line/split/video");
		menu.Append(EDIT_MENU_SPLIT_VIDEO, split_video->StrMenu(context))->Enable(split_video->Validate(context));
	}

	PopupMenu(&menu);
}
Beispiel #26
0
void SvnBlameEditor::OnContextMenu(wxContextMenuEvent& event)
{
    wxPoint pt       = event.GetPosition();
    wxPoint clientPt = ScreenToClient(pt);

    int margin = GetMarginWidth(0); // get the margin width
    if ( clientPt.x < margin ) {

        GotoPos( PositionFromPoint(clientPt) );
        // Margin context menu
        wxMenu menu;
        menu.Append( XRCID("svn_highlight_revision"), _("Highlight this revision"), _("Highlight this revision"), false);
        menu.Connect(XRCID("svn_highlight_revision"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SvnBlameEditor::OnHighlightRevision), NULL, this);

        PopupMenu(&menu);

    } else {
        wxStyledTextCtrl::OnContextMenu(event);

    }
}
void CtrlChessTxt::OnContext( wxContextMenuEvent &event )
{
    ChessRules cr;
    string move_txt;
    GAME_MOVE *gm = gd->GetSummaryMove( cr, move_txt );
    popup_mt = gd->GetSummary();
    if( gm && popup_mt && move_txt.length() )
    {
        if( context_menu )
        {
            delete context_menu;
            context_menu = 0;
        }
        context_menu = new wxMenu;
        context_menu->SetTitle( move_txt.c_str() );
        context_menu->Append(ID_ANNOT1, "!"  );    // $1 
        context_menu->Append(ID_ANNOT2, "?"  );    // $2 
        context_menu->Append(ID_ANNOT3, "!!" );    // $3 
        context_menu->Append(ID_ANNOT4, "??" );    // $4 
        context_menu->Append(ID_ANNOT5, "!?" );    // $5 
        context_menu->Append(ID_ANNOT6, "?!" );    // $6 
        context_menu->Append(ID_ANNOT7,"None of the above");
        context_menu->AppendSeparator();
        context_menu->Append(ID_ANNOT10, "="  );   // $10 
        context_menu->Append(ID_ANNOT14, "+=" );   // $14 
        context_menu->Append(ID_ANNOT15, "=+" );   // $15 
        context_menu->Append(ID_ANNOT16, "+/-");   // $16 
        context_menu->Append(ID_ANNOT17, "-/+");   // $17 
        context_menu->Append(ID_ANNOT18, "+-" );   // $18 
        context_menu->Append(ID_ANNOT19, "-+" );   // $19 
        context_menu->Append(ID_ANNOT20,"None of the above");
        wxPoint pos = event.GetPosition();
//        wxPoint pos2 = GetParent()->GetPosition();
//        pos.x -= pos2.x;
//        pos.y -= pos2.y;
        pos = ScreenToClient( pos );
        pos.x += 4;
        PopupMenu(context_menu, pos );
    }
}
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);
}
void ThreadSearchLoggerList::OnLoggerListContextualMenu(wxContextMenuEvent& event)
{
    wxPoint point = event.GetPosition();

    // If from keyboard
    if ( (point.x == -1) && (point.y == -1) )
    {
        wxSize size = m_pListLog->GetSize();
        point.x = size.x / 2;
        point.y = size.y / 2;
    }
    else
    {
        point = m_pListLog->ScreenToClient(point);
        long tmp;
        int flags;
        if ( m_pListLog->HitTest(point, flags, &tmp) == wxNOT_FOUND )
        {
            return;
        }
    }
    ShowMenu(point);
}
Beispiel #30
0
void wxSTEditorTreeCtrl::OnContextMenu( wxContextMenuEvent& event )
{
    // In MSW the wxContextMenuEvent::GetPosition() is screen position
    // and is not translated to the pos on the window.
    wxPoint pt = event.GetPosition();
    wxPoint mousePosition = wxGetMousePosition();

    if (pt == mousePosition)
        pt = ScreenToClient(pt);

    int flags = 0;
    wxTreeItemId id = HitTest(pt, flags);

    wxSTETreeItemData* data = NULL;
    if (id)
        data = dynamic_cast<wxSTETreeItemData*>(GetItemData(id));

    bool on_file = (data != NULL);

    m_popupMenu->Enable(ID_STT_FILE_OPEN,  on_file);
    m_popupMenu->Enable(ID_STT_FILE_CLOSE, on_file);

    // Are we selecting an editor or some other wxWindow
    wxSTEditor* editor = NULL;

    if (data != NULL)
    {
        editor = wxDynamicCast(data->m_notePage, wxSTEditor);

        if (!editor && wxDynamicCast(data->m_notePage, wxSTEditorSplitter))
            editor = wxDynamicCast(data->m_notePage, wxSTEditorSplitter)->GetEditor();
    }
    m_popupMenu->Enable(ID_STT_FILE_PROPERTIES, (editor != NULL));

    PopupMenu(m_popupMenu);
}