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


C++ wxButton::Bind方法代码示例

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


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

示例1: wxPanel

	DbgEmuPanel(wxWindow* parent) : wxPanel(parent)
	{
		m_btn_run = new wxButton(this, wxID_ANY, "Run");
		m_btn_run->Bind(wxEVT_BUTTON, &DbgEmuPanel::OnRun, this);

		m_btn_stop = new wxButton(this, wxID_ANY, "Stop");
		m_btn_stop->Bind(wxEVT_BUTTON, &DbgEmuPanel::OnStop, this);

		m_btn_restart = new wxButton(this, wxID_ANY, "Restart");
		m_btn_restart->Bind(wxEVT_BUTTON, &DbgEmuPanel::OnRestart, this);

		m_btn_capture_frame = new wxButton(this, wxID_ANY, "Capture frame");
		m_btn_capture_frame->Bind(wxEVT_BUTTON, &DbgEmuPanel::OnCaptureFrame, this);

		wxBoxSizer* s_b_main = new wxBoxSizer(wxHORIZONTAL);
		s_b_main->Add(m_btn_run,     wxSizerFlags().Border(wxALL, 5));
		s_b_main->Add(m_btn_stop,    wxSizerFlags().Border(wxALL, 5));
		s_b_main->Add(new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL), 0, wxEXPAND);
		s_b_main->Add(m_btn_restart, wxSizerFlags().Border(wxALL, 5));
		s_b_main->Add(m_btn_capture_frame, wxSizerFlags().Border(wxALL, 5));

		SetSizerAndFit(s_b_main);
		Layout();

		UpdateUI();
		wxGetApp().Bind(wxEVT_DBG_COMMAND, &DbgEmuPanel::HandleCommand, this);
	}
开发者ID:976717326,项目名称:rpcs3,代码行数:27,代码来源:Debugger.cpp

示例2: MainFrame

    MainFrame(const wxString& title) {
        wxXmlResource::Get()->LoadFrame(this, NULL, "Frame1");

        m_buttonFindAll = XRCCTRL(*this, "m_buttonFindAll", wxButton);
        m_textCtrlRegex = XRCCTRL(*this, "m_textCtrlRegex", wxTextCtrl);
        m_textCtrlString = XRCCTRL(*this, "m_textCtrlString", wxTextCtrl);
        m_textCtrlFindAll = XRCCTRL(*this, "m_textCtrlFindAll", wxTextCtrl);
        m_textCtrlRegex->Bind(wxEVT_TEXT, [=](wxCommandEvent &event){
            std::wstring a = m_textCtrlRegex->GetValue();
            auto R = re::compile(a);
            if (R){
                m_textCtrlRegex->SetBackgroundColour(wxColor(0,255,0));
                m_textCtrlRegex->Refresh();
                m_textCtrlFindAll->Clear();
                m_textCtrlFindAll->Refresh();
            }
            else{
                m_textCtrlRegex->SetBackgroundColour(wxColor(255, 0, 0));
                m_textCtrlRegex->Refresh();
                m_textCtrlFindAll->Clear();
                m_textCtrlFindAll->AppendText(std::to_string(re::getlasterror()));
                m_textCtrlFindAll->AppendText("\n");
                m_textCtrlFindAll->AppendText(re::getlasterrorstr());
                m_textCtrlFindAll->Refresh();
            }
        }
        );
        //------------------------------------------------------------------------------
        m_buttonFindAll->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [=](wxCommandEvent &event){
            m_textCtrlFindAll->Clear();
            std::wstring a = m_textCtrlRegex->GetValue();
            auto R = re::compile(a);
            if (R){
                std::wstring s = m_textCtrlString->GetValue();
                auto v = R->findall(s);
                for (auto i = v.begin(); i < v.end(); i++){
                    m_textCtrlFindAll->AppendText(*i);
                    m_textCtrlFindAll->AppendText("\n");
                }
            }
            m_textCtrlFindAll->Refresh();

        });
        //------------------------------------------------------------------------------

    }
开发者ID:FoxTeamZone,项目名称:PCRE2Plus,代码行数:46,代码来源:PCRE2PlusTest.cpp

示例3: OnBind

void MyFrame::OnBind(wxCommandEvent& event)
{
    if ( event.IsChecked() )
    {
        // as we bind directly to the button, there is no need to use an id
        // here: the button will only ever get its own events
        m_btnDynamic->Bind(wxEVT_BUTTON, &MyFrame::OnDynamic,
                           this);

        // but we do need the id for the menu command as the frame gets all of
        // them
        Bind(wxEVT_MENU, &MyFrame::OnDynamic, this,
             Event_Dynamic);
    }
    else // disconnect
    {
        m_btnDynamic->Unbind(wxEVT_BUTTON,
                             &MyFrame::OnDynamic, this);
        Unbind(wxEVT_MENU, &MyFrame::OnDynamic, this,
               Event_Dynamic);
    }

    UpdateDynamicStatus(event.IsChecked());
}
开发者ID:ruifig,项目名称:nutcracker,代码行数:24,代码来源:event.cpp

示例4: NewMapDialog

    NewMapDialog(wxWindow* parent, int game, int port, vector<Archive::mapdesc_t>& maps, Archive* archive)
        : wxDialog(parent, -1, "New Map")
    {
        // Setup dialog
        wxBoxSizer* msizer = new wxBoxSizer(wxVERTICAL);
        SetSizer(msizer);
        wxGridBagSizer* sizer = new wxGridBagSizer(4, 4);
        msizer->Add(sizer, 1, wxEXPAND|wxALL, 10);

        // Open selected game configuration if no map names are currently loaded
        if (theGameConfiguration->nMapNames() == 0)
        {
            string gname = theGameConfiguration->gameConfig(game).name;
            string pname = theGameConfiguration->portConfig(port).name;
            theGameConfiguration->openConfig(gname, pname);
        }

        // Check if the game configuration allows any map name
        int flags = 0;
        if (!theGameConfiguration->anyMapName())
            flags = wxCB_READONLY;

        // Create map name combo box
        cbo_mapname = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, flags);
        sizer->Add(new wxStaticText(this, -1, "Map Name:"), wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
        sizer->Add(cbo_mapname, wxGBPosition(0, 1), wxDefaultSpan, wxEXPAND);

        // Limit map name length if necessary
        if (theGameConfiguration->anyMapName() &&
                (!theGameConfiguration->allowLongNames() ||
                 (archive && archive->getType() != ARCHIVE_ZIP &&
                  archive->getType() != ARCHIVE_7Z &&
                  archive->getType() != ARCHIVE_FOLDER)))
            cbo_mapname->SetMaxLength(8);

        // Add possible map names to the combo box
        for (unsigned a = 0; a < theGameConfiguration->nMapNames(); a++)
        {
            // Check if map already exists
            string mapname = theGameConfiguration->mapName(a);
            bool exists = false;
            for (unsigned m = 0; m < maps.size(); m++)
            {
                if (S_CMPNOCASE(maps[m].name, mapname))
                {
                    exists = true;
                    break;
                }
            }

            if (!exists)
                cbo_mapname->Append(mapname);
        }

        // Set inital map name selection
        if (theGameConfiguration->nMapNames() > 0)
            cbo_mapname->SetSelection(0);

        // Create map format combo box
        choice_mapformat = new wxChoice(this, -1);
        sizer->Add(new wxStaticText(this, -1, "Map Format:"), wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
        sizer->Add(choice_mapformat, wxGBPosition(1, 1), wxDefaultSpan, wxEXPAND);

        // Add possible map formats to the combo box
        uint8_t default_format = MAP_UNKNOWN;
        if (! maps.empty())
            default_format = maps[0].format;
        for (uint8_t map_type = 0; map_type < MAP_UNKNOWN; map_type++)
        {
            if (theGameConfiguration->mapFormatSupported(map_type, game, port))
            {
                choice_mapformat->Append(MAP_TYPE_NAMES[map_type]);
                if (map_type == default_format)
                    choice_mapformat->SetSelection(choice_mapformat->GetCount() - 1);
            }
        }
        // Default to the "best" supported format, the last one in the list
        if (choice_mapformat->GetSelection() == wxNOT_FOUND)
            choice_mapformat->SetSelection(choice_mapformat->GetCount() - 1);

        // Add dialog buttons
        wxBoxSizer* hbox = new wxBoxSizer(wxHORIZONTAL);
        msizer->Add(hbox, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 10);
        hbox->AddStretchSpacer();
        btn_ok = new wxButton(this, -1, "OK");
        hbox->Add(btn_ok, 0, wxEXPAND | wxRIGHT, 4);
        btn_cancel = new wxButton(this, -1, "Cancel");
        hbox->Add(btn_cancel, 0, wxEXPAND);
        sizer->AddGrowableCol(1);

        // Bind events
        btn_ok->Bind(wxEVT_BUTTON, &NewMapDialog::onBtnOk, this);
        btn_cancel->Bind(wxEVT_BUTTON, &NewMapDialog::onBtnCancel, this);

        Layout();
        msizer->Fit(this);
        CenterOnParent();
    }
开发者ID:sirjuddington,项目名称:SLADE,代码行数:98,代码来源:MapEditorConfigDialog.cpp


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