示例#1
0
ChangeIconDialog::ChangeIconDialog(wxWindow *parent)
    : wxDialog(parent, -1, _("Change Icon"), wxDefaultPosition, wxSize(500, 400))
{
    SetAprilFonts(this);

    wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);

    wxBoxSizer *hSz = new wxBoxSizer(wxHORIZONTAL);
    iconListCtrl = new InstIconListCtrl(this);
    hSz->Add(iconListCtrl, wxSizerFlags(1).Expand().Border(wxALL, 8));

    wxBoxSizer *sideBtnSz = new wxBoxSizer(wxVERTICAL);

    wxButton *addIconBtn = new wxButton(this, ID_AddIcon, _("&Add Icon"));
    sideBtnSz->Add(addIconBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand());

    wxButton *removeIconBtn = new wxButton(this, ID_RemoveIcon, _("&Remove Icon"));
    sideBtnSz->Add(removeIconBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand());

    wxButton *reloadIconBtn = new wxButton(this, ID_ReloadIcons, _("&Reload Icons"));
    reloadIconBtn->Enable(false);
    sideBtnSz->Add(reloadIconBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand());

    hSz->Add(sideBtnSz, wxSizerFlags().Border(wxTOP | wxBOTTOM | wxRIGHT, 4));

    mainSizer->Add(hSz, wxSizerFlags(1).Expand());

    wxSizer *btnSizer = CreateButtonSizer(wxOK | wxCANCEL);
    mainSizer->Add(btnSizer, wxSizerFlags(0).Border(wxBOTTOM | wxRIGHT, 8).
                   Align(wxALIGN_RIGHT | wxALIGN_BOTTOM));

    SetSizer(mainSizer);
// 	mainSizer->SetSizeHints(this);
}
示例#2
0
InstConsoleWindow::InstConsoleWindow(Instance *inst, MainWindow* mainWin, bool quitAppOnClose)
	: wxFrame(NULL, -1, _("MultiMC Console"), wxDefaultPosition, wxSize(620, 250))
{
	SetAprilFonts(this);

	m_quitAppOnClose = quitAppOnClose;
	m_mainWin = mainWin;
	m_running = nullptr;
	m_inst = inst;
	crashReportIsOpen = false;
	
	wxPanel *mainPanel = new wxPanel(this, -1);
	wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
	mainPanel->SetSizer(mainSizer);
	
	consoleTextCtrl = new wxTextCtrl(mainPanel, -1, wxEmptyString, 
									 wxDefaultPosition, wxSize(200, 100), 
									 wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH);
	mainSizer->Add(consoleTextCtrl, wxSizerFlags(1).Expand().Border(wxALL, 8));
	consoleTextCtrl->SetBackgroundColour(*wxWHITE);
	

	wxBoxSizer *btnBox = new wxBoxSizer(wxHORIZONTAL);
	mainSizer->Add(btnBox, 0, wxEXPAND | wxBOTTOM | wxRIGHT | wxLEFT, 8);

	wxButton *crashReportBtn = new wxButton(mainPanel, ID_GENREPORT, _("Generate Crash &Report"));
	btnBox->Add(crashReportBtn, wxSizerFlags(0).Align(wxALIGN_LEFT));

	btnBox->AddStretchSpacer();
	
	killButton = new wxButton(mainPanel, wxID_DELETE, _("&Kill Minecraft"));
	btnBox->Add(killButton, wxSizerFlags(0).Align(wxALIGN_RIGHT));
	closeButton = new wxButton(mainPanel, wxID_CLOSE, _("&Close"));
	btnBox->Add(closeButton, wxSizerFlags(0).Align(wxALIGN_RIGHT));

	// close is close at this point. there is no linked process yet.
	SetCloseIsHide(false);
	
	consoleIcons = new wxIconArray();
	wxMemoryInputStream iconInput1(console, sizeof(console));
	wxMemoryInputStream iconInput2(console_error, sizeof(console_error));
	wxMemoryInputStream iconInput3(console24, sizeof(console24));
	wxMemoryInputStream iconInput4(console_error24, sizeof(console_error24));
	wxIcon icon_OK,icon_BAD,icon_OK24,icon_BAD24;
	icon_OK.CopyFromBitmap(wxBitmap(wxImage(iconInput1)));
	icon_BAD.CopyFromBitmap(wxBitmap(wxImage(iconInput2)));
	icon_OK24.CopyFromBitmap(wxBitmap(wxImage(iconInput3)));
	icon_BAD24.CopyFromBitmap(wxBitmap(wxImage(iconInput4)));
	consoleIcons->Add(icon_OK);
	consoleIcons->Add(icon_BAD);
	consoleIcons->Add(icon_OK24);
	consoleIcons->Add(icon_BAD24);
	
	// Create the task bar icon.
	trayIcon = new ConsoleIcon(this);
	SetState(STATE_OK);
	CenterOnScreen();
}
示例#3
0
LoginDialog::LoginDialog (wxWindow *parent, wxString errorMsg, UserInfo info, bool canGoOffline)
	: wxDialog(parent, -1, _("Login"), wxDefaultPosition, wxSize(520, 140))
{
	SetAprilFonts(this);

	wxGridBagSizer *mainBox = new wxGridBagSizer();
	int offset = (errorMsg.empty() ? 0 : 1);
	const int cols = 3;
	const int padding = 4;
	
	// Error message label
	if (!errorMsg.empty())
	{
		wxStaticText *errorMsgLabel = new wxStaticText(this, -1, errorMsg);
		mainBox->Add(errorMsgLabel, wxGBPosition(0, 0), wxGBSpan(1, cols), 
					 wxTOP | wxLEFT | wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, padding);
	}
	
	// Username text field
	wxStaticText *usernameLabel = new wxStaticText(this, -1, _("Username: "******"Password: "******"&Force update"));
	mainBox->Add(forceUpdateToggle, wxGBPosition(2 + offset, 0), wxGBSpan(1, 1), wxALL, padding);
	
	rememberUsernameCheck = new wxCheckBox(this, -1, _("&Remember username?"));
	rememberUsernameCheck->SetValue(info.rememberUsername);
	mainBox->Add(rememberUsernameCheck, wxGBPosition(2 + offset, 1), wxGBSpan(1, 1), 
		wxALL | wxALIGN_CENTER_VERTICAL, padding);
	
	rememberPasswordCheck = new wxCheckBox(this, -1, _("R&emember password?"));
	rememberPasswordCheck->SetValue(info.rememberPassword);
	mainBox->Add(rememberPasswordCheck, wxGBPosition(2 + offset, 2), wxGBSpan(1, 1),
		wxALL | wxALIGN_CENTER_VERTICAL, padding);
	
	wxBoxSizer *playOfflineSizer = new wxBoxSizer(wxHORIZONTAL);
	playOfflineButton = new wxButton(this, ID_PLAY_OFFLINE, _("Play &Offline"));
	playOfflineSizer->Add(playOfflineButton, 1, wxTOP | wxBOTTOM | wxEXPAND, 8);
	mainBox->Add(playOfflineSizer, wxGBPosition(3 + offset, 0), wxGBSpan(1, 1), 
		wxLEFT | wxRIGHT | wxEXPAND, padding);
	
	if(!canGoOffline)
		playOfflineButton->Enable(false);
	
	wxSizer *btnBox = CreateButtonSizer(wxOK | wxCANCEL);
	mainBox->Add(btnBox, wxGBPosition(3 + offset, 1), wxGBSpan(1, cols - 1), 
		wxRIGHT | wxTOP | wxBOTTOM | wxEXPAND, 8);
	
	usernameTextBox->SetFocus();
	
	SetSizer(mainBox);
	mainBox->SetSizeHints(this);
	(*usernameTextBox) << info.username;
	(*passwordTextBox) << info.password;
}