コード例 #1
0
	BattleRoomDownloadProgres(wxWindow* parent, const wxString& str_text)
	    : wxPanel(parent, -1, wxDefaultPosition, wxSize(-1, 80), wxNO_BORDER)
	{
		m_main_sizer = new wxBoxSizer(wxHORIZONTAL);
		{
			wxBoxSizer* m_data_sizer = new wxBoxSizer(wxHORIZONTAL); //wxHORIZONTAL
			{
				m_text = new wxStaticText(this, -1, str_text);
				{
					m_data_sizer->Add(m_text, 0, wxALL, 2);
				}

				m_info = new wxStaticText(this, -1, _(" "), wxDefaultPosition, wxSize(-1, -1), wxALIGN_CENTRE);
				{
					m_data_sizer->Add(m_info, 0, wxALL, 2);
				}
				m_main_sizer->Add(m_data_sizer, 0, wxALL, 2);
			}

			m_progres = new wxGauge(this, -1, 100, wxDefaultPosition, wxDefaultSize, wxGA_SMOOTH | wxGA_HORIZONTAL);
			{
				m_main_sizer->Add((wxWindow*)m_progres, 1, wxALL | wxEXPAND, 2);
			}
			SetSizer(m_main_sizer);
		}
		Layout();
	}
コード例 #2
0
ファイル: main.cpp プロジェクト: ts14ic/UTM-CO
void MyFrame::OnDelRestrButton(wxCommandEvent& evt) {
    if(restrEntries.size() <= 1) return;
    
    restrSizer->Detach(restrEntries.back());
    delete restrEntries.back();
    restrEntries.pop_back();
    
    restrSizer->SetSizeHints(this);
    Fit();
}
コード例 #3
0
ファイル: main.cpp プロジェクト: ts14ic/UTM-CO
void MyFrame::OnNewRestrButton(wxCommandEvent& evt) {
    if(restrEntries.size() >= 6) return;
    
    auto textCtrl = new wxTextCtrl(
        this, wxID_ANY, wxT("Новое ограничение"),
        wxDefaultPosition, wxDefaultSize,
        wxTE_PROCESS_ENTER
    );
    restrEntries.emplace_back(textCtrl);
    textCtrl->Bind(wxEVT_TEXT, &MyFrame::on_text_change, this);
    restrSizer->Add(textCtrl, wxSizerFlags().Expand().Border(wxALL, 5));
    
    restrSizer->SetSizeHints(this);
    Fit();
}
コード例 #4
0
ファイル: main.cpp プロジェクト: ts14ic/UTM-CO
void MyFrame::on_text_change(wxCommandEvent& evt) {
    if(!stepsGrids.empty()) {
        ClearNotebooks();
        mainSizer->SetSizeHints(this);
        Fit();
    }
}
コード例 #5
0
ファイル: notifmsgg.cpp プロジェクト: CodeSmithyIDE/wxWidgets
bool wxNotificationMessageWindow::AddAction(wxWindowID actionid, const wxString &label)
{
    wxSizer* msgSizer = m_messagePanel->GetSizer();
    if ( m_buttonSizer == NULL )
    {
        msgSizer->Detach(m_closeBtn);
        m_closeBtn->Hide();
        m_buttonSizer = new wxBoxSizer(wxVERTICAL);
        msgSizer->Add(m_buttonSizer, wxSizerFlags(0).Center().Border());
    }

    wxButton* actionButton = new wxButton(m_messagePanel, actionid, label);
    actionButton->Bind(wxEVT_BUTTON, &wxNotificationMessageWindow::OnActionButtonClicked, this);
    PrepareNotificationControl(actionButton, false);
    int borderDir = (m_buttonSizer->GetChildren().empty()) ? 0 : wxTOP;
    m_buttonSizer->Add(actionButton, wxSizerFlags(0).Border(borderDir).Expand());

    return true;
}
コード例 #6
0
ファイル: wxmain.cpp プロジェクト: guy-middleton/EPH
void MyFrame::OnOpen(wxCommandEvent & WXUNUSED(event)) {
    wxFileDialog dialog(this, wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString,
                        wxFD_OPEN | wxFD_FILE_MUST_EXIST);
    if (dialog.ShowModal() == wxID_OK) {
        wxString filename(dialog.GetPath());

        wxTextFile text_file(filename);
        if (!text_file.Open(wxConvUTF8)) {
            return;
        }

        grid->EnableEditing(false);
        if (text_file.GetLineCount() > grid->GetNumberRows()) {
            grid->AppendRows(text_file.GetLineCount() - grid->GetNumberRows());

        } else if (text_file.GetLineCount() < grid->GetNumberRows()) {
            grid->DeleteRows(text_file.GetLineCount(), grid->GetNumberRows() - text_file.GetLineCount());
        }

        grid->ClearGrid();

        for (int row = 0; row < text_file.GetLineCount(); ++row) {
            wxStringTokenizer tokenizer(text_file[row], L",");
            for (int col = 0; tokenizer.HasMoreTokens() && col < grid->GetNumberCols(); ++col) {
                wxString token = tokenizer.GetNextToken();

                grid->SetCellValue(row, col, token);
            }
        }
        grid->AutoSize();

        text->Clear();
        lines.clear();

        for (int row = 0; row < text_file.GetLineCount(); ++row) {
            lines.push_back(text_file[row]);
        }

        text_file.Close();

        topsizer->Layout();
        SetStatusText(wxFileName(filename).GetFullName());
    }
}
コード例 #7
0
ファイル: main.cpp プロジェクト: ts14ic/UTM-CO
void MyFrame::FillNotebook(std::vector<Solver::Step> const& steps, wxNotebook* book) {
    bool solutionValid = steps.back().valid();
    if(!solutionValid) return;
    
    using fracType = Fraction;
    
    int stepN = 1;
    for(auto const& step : steps) {
        int pageId = wxNewId();
        wxGrid* page = new wxGrid(book, pageId);
        stepsGrids.emplace_back(page, pageId);
        
        int needMPrice = 0;
        for(auto col : step.mprice.terms()) {
            if(col.coeff() != 0) {
                needMPrice = 1;
                break;
            }
        }
        
        page->CreateGrid(
            step.restrs.size() + 2 + static_cast<int>(needMPrice),
            step.goal.size() + 2
        );
        page->HideColLabels();
        page->HideRowLabels();
        page->EnableDragColSize(false);
        page->EnableDragRowSize(false);
        page->EnableDragGridSize(false);
        page->EnableEditing(false);
        page->Bind(wxEVT_GRID_CELL_LEFT_DCLICK, &MyFrame::on_cell_dclick, this);
        
        // goal row
        int row = 0;
        int col = 0;
        page->SetCellValue(row, col++, step.goal.right());
        page->SetCellValue(row, col++, "B");
        for(int j : step.goal.indices()) {
            page->SetCellValue(row, col++, to_string(step.goal.term(j)));
        }
        
        // restrictions rows
        for(auto const& restr : step.restrs) {
            ++row;
            col = 0;
            page->SetCellValue(row, col++, to_string(step.sel[row - 1]));
            page->SetCellValue(
                row, col++, 
                to_string(static_cast<fracType>(restr.right()))
            );
            for(int j : restr.indices()) {
                page->SetCellValue(
                    row, col++, 
                    to_string(static_cast<fracType>(restr.coeff(j)))
                );
            }
        }
        
        // plain price row
        ++row;
        col = 0;
        page->SetCellValue(row, col++, "W");
        page->SetCellValue(
            row, col++, 
            to_string(static_cast<fracType>(step.w))
        );
        for(int fi : step.pprice.indices()) {
            page->SetCellValue(
                row, col++, 
                to_string(static_cast<fracType>(step.pprice.coeff(fi)))
            );
        }
        
        // mega price row
        if(needMPrice) {
            ++row;
            col = 0;
            page->SetCellValue(row, col++, "M");
            page->SetCellValue(
                row, col++, 
                to_string(static_cast<fracType>(step.m))
            );
            for(int fi : step.mprice.indices()) {
                page->SetCellValue(
                    row, col++, 
                    to_string(static_cast<fracType>(step.mprice.coeff(fi)))
                );
            }
        }
        
        page->AutoSize();
        book->AddPage(page, wxString::Format(wxT("Шаг %d"), stepN++));
    }
    
    mainSizer->SetSizeHints(this);
    Fit();
}
コード例 #8
0
	void append(T *thing, int proportion = 0, int flag = wxEXPAND|wxTOP|wxBOTTOM, int border = 10)
	{
		content->Add(thing, proportion, flag, border);
	}