Ejemplo n.º 1
0
void HtMainFrame::OnFileOpenDropDown (wxAuiToolBarEvent &event)
{
   if (event.IsDropDownClicked())
   {
      wxAuiToolBar *tb = static_cast<wxAuiToolBar *>(event.GetEventObject());
      tb->SetToolSticky(event.GetId(), true);

      wxMenu menuPopup;
      history.AddFilesToMenu(&menuPopup);

      // event handler to deal with the menu items
      const int start = history.GetBaseId();
      const int end = history.GetBaseId() + history.GetMaxFiles();

      Connect(start, end, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HtMainFrame::OnRecentFilesSelected));

      // line up our menu with the button
      wxRect rect = tb->GetToolRect(event.GetId());
      wxPoint pt = tb->ClientToScreen(rect.GetBottomLeft());
      pt = ScreenToClient(pt);

      PopupMenu(&menuPopup, pt);

      // make sure the button is "un-stuck"
      tb->SetToolSticky(event.GetId(), false);
   }
   else
   {
      wxCommandEvent dummy;
      OnFileOpen(dummy);
   }
}
Ejemplo n.º 2
0
void PHPWorkspaceView::OnSetupRemoteUpload(wxAuiToolBarEvent& event)
{

    if ( !event.IsDropDownClicked() ) {
        CallAfter( &PHPWorkspaceView::DoOpenSSHAccountManager );


    } else {
        SSHWorkspaceSettings settings;
        settings.Load();

        wxMenu menu;
        if ( !settings.IsRemoteUploadSet() ) {
            // We never setup remote upload for this workspace
            menu.AppendCheckItem(ID_TOGGLE_AUTOMATIC_UPLOAD, _("Enable automatic upload"));
            menu.Enable(ID_TOGGLE_AUTOMATIC_UPLOAD, false);
            menu.Check(ID_TOGGLE_AUTOMATIC_UPLOAD, false);

        } else {
            menu.AppendCheckItem(ID_TOGGLE_AUTOMATIC_UPLOAD, _("Enable automatic upload"));
            menu.Check(ID_TOGGLE_AUTOMATIC_UPLOAD, settings.IsRemoteUploadEnabled());
            menu.Connect(ID_TOGGLE_AUTOMATIC_UPLOAD, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PHPWorkspaceView::OnToggleAutoUpload), NULL, this);
        }

        wxAuiToolBar* auibar = dynamic_cast<wxAuiToolBar*>(event.GetEventObject());
        if ( auibar ) {
            clAuiToolStickness ts(auibar, event.GetToolId());
            wxRect rect = auibar->GetToolRect(event.GetId());
            wxPoint pt = auibar->ClientToScreen(rect.GetBottomLeft());
            pt = ScreenToClient(pt);
            PopupMenu(&menu, pt);
        }
    }
}
Ejemplo n.º 3
0
void SQLCommandPanel::OnHistoryToolClicked(wxAuiToolBarEvent& event)
{
    wxAuiToolBar* auibar = dynamic_cast<wxAuiToolBar*>(event.GetEventObject());
    if ( auibar ) {
        clAuiToolStickness ts(auibar, event.GetToolId());
        wxRect rect = auibar->GetToolRect(event.GetId());
        wxPoint pt = auibar->ClientToScreen(rect.GetBottomLeft());
        pt = ScreenToClient(pt);
        
        DbExplorerSettings settings;
        clConfig conf(DBE_CONFIG_FILE);
        conf.ReadItem(&settings);
        settings.GetRecentFiles();
        
        wxArrayString sqls = settings.GetSqlHistory();
        wxMenu menu;
        for(size_t i=0; i<sqls.GetCount(); ++i) {
            menu.Append(wxID_HIGHEST+i, sqls.Item(i));
        }
        
        int pos = GetPopupMenuSelectionFromUser(menu, pt);
        if ( pos == wxID_NONE )
            return;
        
        size_t index = pos - wxID_HIGHEST;
        if ( index > sqls.GetCount() )
            return;
        
        m_scintillaSQL->SetText( sqls.Item(index) );
        CallAfter( &SQLCommandPanel::ExecuteSql );
    }
}
Ejemplo n.º 4
0
void CommandProcessorBase::OnTBUnRedo(wxAuiToolBarEvent& event)
{
    wxPoint pt = event.GetItemRect().GetBottomLeft();
    pt.y++;
    wxWindow* win = wxDynamicCast(event.GetEventObject(), wxWindow); // We must use the toolbar as 'win', in case it's not in its default location
    wxCHECK_RET(win, "No toolbar?");
    PopulateUnRedoMenu(win, pt, event.GetId() == wxID_UNDO);
}
Ejemplo n.º 5
0
void WizardsPlugin::OnGizmosAUI(wxAuiToolBarEvent& e)
{
    if (e.IsDropDownClicked()) {
        wxAuiToolBar* tb = static_cast<wxAuiToolBar*>(e.GetEventObject());
        tb->SetToolSticky(e.GetId(), true);

        // line up our menu with the button
        wxRect rect = tb->GetToolRect(e.GetId());
        wxPoint pt = tb->ClientToScreen(rect.GetBottomLeft());
        pt = m_mgr->GetTheApp()->GetTopWindow()->ScreenToClient(pt);

        DoPopupButtonMenu(pt);
        tb->SetToolSticky(e.GetId(), false);
    }
}
Ejemplo n.º 6
0
void MainFrame::OnDropDownToolbarYUV(wxAuiToolBarEvent& event)
{
    wxAuiToolBar* tb = static_cast<wxAuiToolBar*>(event.GetEventObject());
    tb->SetToolSticky(event.GetId(), true);
    wxMenu menuPopup;
    menuPopup.AppendRadioItem(ID_Switch_YUV, _T("YUV"), _T("Show YUV"));
    menuPopup.AppendRadioItem(ID_Switch_Y, _T("Y"), _T("Show Y component"));
    menuPopup.AppendRadioItem(ID_Switch_U, _T("U"), _T("Show U component"));
    menuPopup.AppendRadioItem(ID_Switch_V, _T("V"), _T("Show V component"));
    menuPopup.Check(ID_Switch_YUV + (int)m_eYUVComponentChoose, true);
    wxRect rect = tb->GetToolRect(event.GetId());
    wxPoint pt = tb->ClientToScreen(rect.GetBottomLeft());
    pt = ScreenToClient(pt);
    PopupMenu(&menuPopup, pt);
    tb->SetToolSticky(event.GetId(), false);
}
Ejemplo n.º 7
0
void GitConsole::DoOnDropdown(wxAuiToolBarEvent& e, const wxString& commandName, int id)
{

    if(!e.IsDropDownClicked()) {
        e.Skip();
        return;
    }

    GitEntry data;
    {
        clConfig conf("git.conf");
        conf.ReadItem(&data);
    } // Force conf out of scope, else its dtor clobbers the GitConsole::OnDropDownMenuEvent Save()
    GitCommandsEntries& ce = data.GetGitCommandsEntries(commandName);
    vGitLabelCommands_t entries = ce.GetCommands();
    int lastUsed = ce.GetLastUsedCommandIndex();

    wxArrayString arr;
    wxMenu menu;
    for(size_t n = 0; n < entries.size(); ++n) {
        wxMenuItem* item = menu.AppendRadioItem(n, entries.at(n).label);
        item->Check(n == (size_t)lastUsed);
        arr.Add(entries.at(n).command);
    }
    menu.Bind(wxEVT_COMMAND_MENU_SELECTED,
              wxCommandEventHandler(GitConsole::OnDropDownMenuEvent),
              this,
              0,
              arr.GetCount(),
              new GitCommandData(arr, commandName, id));

    wxAuiToolBar* auibar = dynamic_cast<wxAuiToolBar*>(e.GetEventObject());
    if(auibar) {
        clAuiToolStickness ts(auibar, e.GetToolId());
        wxRect rect = auibar->GetToolRect(e.GetId());
        wxPoint pt = auibar->ClientToScreen(rect.GetBottomLeft());
        pt = ScreenToClient(pt);
        PopupMenu(&menu, pt);
    }
    menu.Unbind(wxEVT_COMMAND_MENU_SELECTED,
                wxCommandEventHandler(GitConsole::OnDropDownMenuEvent),
                this,
                0,
                arr.GetCount(),
                new GitCommandData(arr, commandName, id));
}
Ejemplo n.º 8
0
void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event)
{
	event.Skip();
	ClearStatusBar();

	if (event.IsDropDownClicked())
	{
		wxAuiToolBar* tb = static_cast<wxAuiToolBar*>(event.GetEventObject());
		tb->SetToolSticky(event.GetId(), true);

		// create the popup menu
		wxMenu* menuPopup = new wxMenu;
		wxMenuItem* Item = new wxMenuItem(menuPopup, IDM_ADD_PERSPECTIVE,
				_("Create new perspective"));
		menuPopup->Append(Item);

		if (Perspectives.size() > 0)
		{
			menuPopup->Append(new wxMenuItem(menuPopup));
			for (u32 i = 0; i < Perspectives.size(); i++)
			{
				wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i,
						StrToWxStr(Perspectives[i].Name),
						wxT(""), wxITEM_CHECK);

				menuPopup->Append(mItem);

				if (i == ActivePerspective)
				{
					mItem->Check(true);
				}
			}
		}

		// line up our menu with the button
		wxRect rect = tb->GetToolRect(event.GetId());
		wxPoint pt = tb->ClientToScreen(rect.GetBottomLeft());
		pt = ScreenToClient(pt);

		// show
		PopupMenu(menuPopup, pt);

		// make sure the button is "un-stuck"
		tb->SetToolSticky(event.GetId(), false);
	}
}
Ejemplo n.º 9
0
void SQLCommandPanel::OnTemplatesBtnClick(wxAuiToolBarEvent& event)
{
    wxMenu menu;
    menu.Append(XRCID("IDR_SQLCOMMAND_SELECT"),_("Insert SELECT SQL template"),_("Insert SELECT SQL statement template into editor."));
    menu.Append(XRCID("IDR_SQLCOMMAND_INSERT"),_("Insert INSERT SQL template"),_("Insert INSERT SQL statement template into editor."));
    menu.Append(XRCID("IDR_SQLCOMMAND_UPDATE"),_("Insert UPDATE SQL template"),_("Insert UPDATE SQL statement template into editor."));
    menu.Append(XRCID("IDR_SQLCOMMAND_DELETE"),_("Insert DELETE SQL template"),_("Insert DELETE SQL statement template into editor."));
    menu.Connect(wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction)&SQLCommandPanel::OnPopupClick, NULL, this);

    wxAuiToolBar* auibar = dynamic_cast<wxAuiToolBar*>(event.GetEventObject());
    if ( auibar ) {
        clAuiToolStickness ts(auibar, event.GetToolId());
        wxRect rect = auibar->GetToolRect(event.GetId());
        wxPoint pt = auibar->ClientToScreen(rect.GetBottomLeft());
        pt = ScreenToClient(pt);
        PopupMenu(&menu, pt);
    }
}
Ejemplo n.º 10
0
void DiffSideBySidePanelBase::ShowAuiToolMenu(wxAuiToolBarEvent& event)
{
    event.Skip();
    if (event.IsDropDownClicked()) {
        wxAuiToolBar* toolbar = wxDynamicCast(event.GetEventObject(), wxAuiToolBar);
        if (toolbar) {
            wxAuiToolBarItem* item = toolbar->FindTool(event.GetId());
            if (item) {
                std::map<int, wxMenu*>::iterator iter = m_dropdownMenus.find(item->GetId());
                if (iter != m_dropdownMenus.end()) {
                    event.Skip(false);
                    wxPoint pt = event.GetItemRect().GetBottomLeft();
                    pt.y++;
                    toolbar->PopupMenu(iter->second, pt);
                }
            }
        }
    }
}
Ejemplo n.º 11
0
// Toolbar
void CFrame::OnDropDownSettingsToolbar(wxAuiToolBarEvent& event)
{
	event.Skip();
	ClearStatusBar();

	if (event.IsDropDownClicked())
	{
		wxAuiToolBar* Tb = static_cast<wxAuiToolBar*>(event.GetEventObject());
		Tb->SetToolSticky(event.GetId(), true);

		// Create the popup menu
		wxMenu* menuPopup = new wxMenu;

		wxMenuItem* Item =  new wxMenuItem(menuPopup, IDM_PERSPECTIVES_ADD_PANE,
				_("Add new pane"));
		menuPopup->Append(Item);
		menuPopup->Append(new wxMenuItem(menuPopup));
		Item = new wxMenuItem(menuPopup, IDM_TAB_SPLIT, _("Tab split"),
				wxT(""), wxITEM_CHECK);
		menuPopup->Append(Item);
		Item->Check(m_bTabSplit);
		Item = new wxMenuItem(menuPopup, IDM_NO_DOCKING, _("No docking"),
				wxT(""), wxITEM_CHECK);
		menuPopup->Append(Item);
		Item->Check(m_bNoDocking);

		// Line up our menu with the button
		wxRect rect = Tb->GetToolRect(event.GetId());
		wxPoint Pt = Tb->ClientToScreen(rect.GetBottomLeft());
		Pt = ScreenToClient(Pt);

		// Show
		PopupMenu(menuPopup, Pt);

		// Make the button un-stuck again
		if (!m_bEdit)
		{
			Tb->SetToolSticky(event.GetId(), false);
		}
	}
}
Ejemplo n.º 12
0
void HtMainFrame::OnEditUndoDropDown (wxAuiToolBarEvent &event)
{
   if (event.IsDropDownClicked())
   {
      wxAuiToolBar *tb = static_cast<wxAuiToolBar *>(event.GetEventObject());
      tb->SetToolSticky(event.GetId(), true);

      wxMenu menuPopup;
      menuPopup.Append(wxID_ANY, wxT("Not implemented"));

      // line up our menu with the button
      wxRect rect = tb->GetToolRect(event.GetId());
      wxPoint pt = tb->ClientToScreen(rect.GetBottomLeft());
      pt = ScreenToClient(pt);

      PopupMenu(&menuPopup, pt);

      // make sure the button is "un-stuck"
      tb->SetToolSticky(event.GetId(), false);
   }
}
Ejemplo n.º 13
0
void wxAuiToolBarXmlHandler::MenuHandler::OnDropDown(wxAuiToolBarEvent& event)
{
    if (event.IsDropDownClicked())
    {
        wxAuiToolBar *toobar = wxDynamicCast(event.GetEventObject(), wxAuiToolBar);
        if (toobar != NULL)
        {
            wxAuiToolBarItem *item = toobar->FindTool(event.GetId());
            if (item != NULL)
            {
                wxMenu * const menu = m_menus[item->GetUserData()];
                if (menu != NULL)
                {
                    wxRect rect = item->GetSizerItem()->GetRect();
                    toobar->PopupMenu(menu, rect.GetRight() - toobar->FromDIP(10), rect.GetBottom());
                }
            }
        }
    }
    else
    {
        event.Skip();
    }
}