• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CenterOnScreen函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CenterOnScreen函数的典型用法代码示例。如果您正苦于以下问题:C++ CenterOnScreen函数的具体用法?C++ CenterOnScreen怎么用?C++ CenterOnScreen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: BWindow

MainWindow::MainWindow()
	: BWindow(BRect(0, 0, 1, 1), TR("Fonts"), B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
	fDefaultsButton = new BButton("defaults", TR("Defaults"),
		new BMessage(kMsgSetDefaults), B_WILL_DRAW);
	fDefaultsButton->SetEnabled(false);

	fRevertButton = new BButton("revert", TR("Revert"),
		new BMessage(kMsgRevert), B_WILL_DRAW);
	fRevertButton->SetEnabled(false);	

//	BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL);

	BBox* box = new BBox(B_FANCY_BORDER, NULL);

	fFontsView = new FontView();

//	tabView->AddTab(fFontsView);
	box->AddChild(fFontsView);

	fFontsView->UpdateFonts();

	SetLayout(new BGroupLayout(B_VERTICAL));

	const float kInset = 10;

	AddChild(BGroupLayoutBuilder(B_VERTICAL)
		.Add(box)
//		.Add(tabView)
		.Add(BSpaceLayoutItem::CreateVerticalStrut(kInset))
		.Add(BGroupLayoutBuilder(B_HORIZONTAL)
			.Add(fDefaultsButton)
			.Add(BSpaceLayoutItem::CreateHorizontalStrut(kInset))
			.Add(fRevertButton)
			.Add(BSpaceLayoutItem::CreateGlue())
		)
		.SetInsets(kInset, kInset, kInset, kInset)
	);

	if (fSettings.WindowCorner() == BPoint(-1, -1)) {
		// center window on screen
		CenterOnScreen();
	} else {
		MoveTo(fSettings.WindowCorner());

		// make sure window is on screen
		BScreen screen(this);
		if (!screen.Frame().InsetByCopy(10, 10).Intersects(Frame()))
			CenterOnScreen();
	}

	fRunner = new BMessageRunner(this, new BMessage(kMsgCheckFonts), 3000000);
		// every 3 seconds

	fDefaultsButton->SetEnabled(fFontsView->IsDefaultable());
}
开发者ID:mmanley,项目名称:Antares,代码行数:57,代码来源:MainWindow.cpp


示例2: BWindow

ScreenshotWindow::ScreenshotWindow(BWindow* parent, BRect frame)
	:
	BWindow(frame, B_TRANSLATE("Screenshot"),
		B_FLOATING_WINDOW_LOOK, B_FLOATING_SUBSET_WINDOW_FEEL,
		B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
	fDownloadPending(false),
	fWorkerThread(-1)
{
	AddToSubset(parent);

	fScreenshotView = new BitmapView("screenshot view");
	fScreenshotView->SetExplicitMaxSize(
		BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));

	BGroupView* groupView = new BGroupView(B_VERTICAL);
	groupView->SetViewColor(0, 0, 0);
	fScreenshotView->SetLowColor(0, 0, 0);

	// Build layout
	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.AddGroup(groupView)
			.Add(fScreenshotView)
			.SetInsets(B_USE_WINDOW_INSETS)
		.End()
	;

	CenterOnScreen();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:28,代码来源:ScreenshotWindow.cpp


示例3: BWindow

PrefWindow::PrefWindow(const BMessenger &messenger)
	: BWindow(BRect(0, 0, 375, 185), B_TRANSLATE("Terminal settings"),
		B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
		B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_AUTO_UPDATE_SIZE_LIMITS),
	fPreviousPref(new PrefHandler(PrefHandler::Default())),
	fSavePanel(NULL),
	fDirty(false),
	fTerminalMessenger(messenger)
{
	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.AddGroup(B_VERTICAL)
		.SetInsets(10, 10, 10, 10)
			.Add(new AppearancePrefView(B_TRANSLATE("Appearance"),
				fTerminalMessenger))
			.AddGroup(B_HORIZONTAL)
				.Add(fSaveAsFileButton = new BButton("savebutton",
					B_TRANSLATE("Save to file" B_UTF8_ELLIPSIS),
					new BMessage(MSG_SAVEAS_PRESSED), B_WILL_DRAW))
				.AddGlue()
				.Add(fRevertButton = new BButton("revertbutton",
					B_TRANSLATE("Cancel"), new BMessage(MSG_REVERT_PRESSED),
					B_WILL_DRAW))
				.Add(fSaveButton = new BButton("okbutton", B_TRANSLATE("OK"),
					new BMessage(MSG_SAVE_PRESSED), B_WILL_DRAW))
			.End()
		.End();

	fSaveButton->MakeDefault(true);

	AddShortcut('Q', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
	AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));

	CenterOnScreen();
	Show();
}
开发者ID:mariuz,项目名称:haiku,代码行数:35,代码来源:PrefWindow.cpp


示例4: BSize

void
ScreenshotWindow::_ResizeToFitAndCenter()
{
	// Find out dimensions of the largest screenshot of this package
	ScreenshotInfoList screenshotInfos;
	if (fPackage.Get() != NULL)
		screenshotInfos = fPackage->ScreenshotInfos();

	int32 largestScreenshotWidth = 0;
	int32 largestScreenshotHeight = 0;

	const uint32 numScreenshots = fPackage->ScreenshotInfos().CountItems();
	for (uint32 i = 0; i < numScreenshots; i++) {
		const ScreenshotInfo& info = screenshotInfos.ItemAtFast(i);
		if (info.Width() > largestScreenshotWidth)
			largestScreenshotWidth = info.Width();
		if (info.Height() > largestScreenshotHeight)
			largestScreenshotHeight = info.Height();
	}

	fScreenshotView->SetExplicitMinSize(
		BSize(largestScreenshotWidth, largestScreenshotHeight));
	Layout(false);

	// TODO: Limit window size to screen size (with a little margin),
	//       the image should then become scrollable.

	float minWidth;
	float minHeight;
	GetSizeLimits(&minWidth, NULL, &minHeight, NULL);
	ResizeTo(minWidth, minHeight);
	CenterOnScreen();
}
开发者ID:looncraz,项目名称:haiku,代码行数:33,代码来源:ScreenshotWindow.cpp


示例5: DWindow

AsciiWindow::AsciiWindow(void)
	:
	DWindow(BRect(0.0f, 0.0f, kWindowWidth, kWindowHeight),
		B_TRANSLATE("ASCII table"), B_TITLED_WINDOW, B_AUTO_UPDATE_SIZE_LIMITS),
	fIsZoomed(false),
	fLastFrame(Frame())
{
	BListView* listView = new BListView("listView", B_MULTIPLE_SELECTION_LIST,
		B_WILL_DRAW);
	BScrollView* listScrollView = new BScrollView("scrollView", listView, 0,
		false, true, B_NO_BORDER);

	listView->SetFont(be_fixed_font);
	listView->AddItem(new BStringItem(B_TRANSLATE("  Dec  Hex  Oct  Code  Description")));
	listView->AddItem(new BStringItem(""));

	for (int i = 0; i < 128; i++) {
		char* row;
		asprintf(&row, "  %3d   %2x  %3o   %3s  %s", i, i, i,
			sAsciiTable[i].code, sAsciiTable[i].description.String());
		listView->AddItem(new BStringItem(row));
		free(row);
	}

	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.Add(listScrollView)
		.SetInsets(-1)
		.End();

	CenterOnScreen();
}
开发者ID:humdingerb,项目名称:Paladin,代码行数:31,代码来源:AsciiWindow.cpp


示例6: Lock

void
MidiPlayerWindow::InitControls()
{
	Lock();

	showScope->SetValue(scopeEnabled ? B_CONTROL_ON : B_CONTROL_OFF);
	scopeView->SetEnabled(scopeEnabled);

	inputOff->SetMarked(true);

	reverbNone->SetMarked(reverb == B_REVERB_NONE);
	reverbCloset->SetMarked(reverb == B_REVERB_CLOSET);
	reverbGarage->SetMarked(reverb == B_REVERB_GARAGE);
	reverbIgor->SetMarked(reverb == B_REVERB_BALLROOM);
	reverbCavern->SetMarked(reverb == B_REVERB_CAVERN);
	reverbDungeon->SetMarked(reverb == B_REVERB_DUNGEON);
	be_synth->SetReverb(reverb);

	volumeSlider->SetValue(volume);

	if (windowX != -1 && windowY != -1)
		MoveTo(windowX, windowY);
	else
		CenterOnScreen();

	Unlock();
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:27,代码来源:MidiPlayerWindow.cpp


示例7: BWindow

StatusWindow::StatusWindow(const char *text, BRect aRect)
	: BWindow(aRect, B_TRANSLATE("BePDF status"),
		B_MODAL_WINDOW ,
		B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_NOT_CLOSABLE) {

	BStringView *stringView = new BStringView("stringView", text);
	mStatus = new BStatusBar("mStatus");
	mStatus->SetMaxValue(1);
	mTotal = -1;

	mText = new BStringView("mText", "");

	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
		.SetInsets(0)
		.AddGlue()
		.AddGroup(B_HORIZONTAL)
			.AddGlue()
			.Add(stringView)
			.AddGlue()
		.End()
		.AddGlue()
		.AddGroup(B_HORIZONTAL)
			.Add(mText)
			.AddGlue()
		.End()
		.Add(mStatus);

	ResizeTo(500, 100);

	CenterOnScreen();
	Show();
}
开发者ID:Akujiism,项目名称:BePDF,代码行数:32,代码来源:StatusWindow.cpp


示例8: wxWizard

CStartDialog::CStartDialog(const wxString &title) : wxWizard( NULL, wxID_ANY, title, wxNullBitmap )
{
	std::vector<std::vector<wxString> > hitters, pitchers;
	m_good = true;
//	CDataImporter importer( "2012_DEMO_DB.8.xlsx" );
//	importer.ReadData( hitters, pitchers );
	SetIcon( wxICON( BaseballDraft ) );
	m_db = new CDb();
	m_db->OpenConnection( "draft.db" );
	m_league = NULL;
	if( !m_db->IsConnected() )
		wxMessageBox( "Cannot establish connection to database" );
	else
	{
//		m_db->InsertPlayers( hitters, pitchers );
		m_db->GetLeagueList( m_leaguesList );
		if( !m_leaguesList.empty() )
		{
			GetPageAreaSizer()->Add( CreateOrSelectLeagueWizard( this, m_leaguesList ) );
			CenterOnScreen();
			Bind( wxEVT_WIZARD_CANCEL, &CStartDialog::OnExit, this );
			m_delete->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &CStartDialog::OnLeagueDelete, this );
			m_new->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &CStartDialog::OnLeagueCreated, this );
			m_edit->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &CStartDialog::OnLeagueCreated, this );
			m_leagues->Bind( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, &CStartDialog::OnSelect, this );
		}
		else
		{
			m_good = false;
			delete m_db;
		}
	}
}
开发者ID:oneeyeman1,项目名称:BaseballDraft,代码行数:33,代码来源:startdialog.cpp


示例9: BWindow

SettingsWindow::SettingsWindow(BRect frame, SettingsMessage* settings)
	:
	BWindow(frame, B_TRANSLATE("Settings"), B_TITLED_WINDOW_LOOK,
		B_NORMAL_WINDOW_FEEL, B_AUTO_UPDATE_SIZE_LIMITS
			| B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE),
	fSettings(settings)
{
	fApplyButton = new BButton(B_TRANSLATE("Apply"), new BMessage(MSG_APPLY));
	fCancelButton = new BButton(B_TRANSLATE("Cancel"),
		new BMessage(MSG_CANCEL));
	fRevertButton = new BButton(B_TRANSLATE("Revert"),
		new BMessage(MSG_REVERT));

	fOpenFilePanel = NULL;

	float spacing = be_control_look->DefaultItemSpacing();

	BTabView* tabView = new BTabView("settings pages", B_WIDTH_FROM_LABEL);
	tabView->SetBorder(B_NO_BORDER);

	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
		.SetInsets(0, B_USE_DEFAULT_SPACING, 0, B_USE_WINDOW_SPACING)
		.Add(tabView)
		.Add(new BSeparatorView(B_HORIZONTAL))
		.AddGroup(B_HORIZONTAL)
			.SetInsets(B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING,
				B_USE_WINDOW_SPACING, 0)
			.Add(fRevertButton)
			.AddGlue()
			.Add(fCancelButton)
			.Add(fApplyButton);

	tabView->AddTab(_CreateGeneralPage(spacing));
	tabView->AddTab(_CreateFontsPage(spacing));
	tabView->AddTab(_CreateProxyPage(spacing));

	_SetupFontSelectionView(fStandardFontView,
		new BMessage(MSG_STANDARD_FONT_CHANGED));
	_SetupFontSelectionView(fSerifFontView,
		new BMessage(MSG_SERIF_FONT_CHANGED));
	_SetupFontSelectionView(fSansSerifFontView,
		new BMessage(MSG_SANS_SERIF_FONT_CHANGED));
	_SetupFontSelectionView(fFixedFontView,
		new BMessage(MSG_FIXED_FONT_CHANGED));

	fApplyButton->MakeDefault(true);

	if (!frame.IsValid())
		CenterOnScreen();

	// load settings from disk
	_RevertSettings();
	// apply to WebKit
	_ApplySettings();

	// Start hidden
	Hide();
	Show();
}
开发者ID:looncraz,项目名称:haiku,代码行数:59,代码来源:SettingsWindow.cpp


示例10: BWindow

ScreenSaverWindow::ScreenSaverWindow()
	:
	BWindow(BRect(50.0f, 50.0f, 50.0f + kWindowWidth, 50.0f + kWindowHeight),
		B_TRANSLATE_SYSTEM_NAME("ScreenSaver"), B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
{
	fSettings.Load();

	fMinWidth = floorf(be_control_look->DefaultItemSpacing()
		* (kWindowWidth / kDefaultItemSpacingAt12pt));

	font_height fontHeight;
	be_plain_font->GetHeight(&fontHeight);
	float textHeight = ceilf(fontHeight.ascent + fontHeight.descent);

	fMinHeight = ceilf(std::max(kWindowHeight, textHeight * 28));

	// Create the password editing window
	fPasswordWindow = new PasswordWindow(fSettings);
	fPasswordWindow->Run();

	// Create the tab view
	fTabView = new TabView();
	fTabView->SetBorder(B_NO_BORDER);

	// Create the controls inside the tabs
	fFadeView = new FadeView(B_TRANSLATE("General"), fSettings);
	fModulesView = new ModulesView(B_TRANSLATE("Screensavers"), fSettings);

	fTabView->AddTab(fFadeView);
	fTabView->AddTab(fModulesView);

	// Create the topmost background view
	BView* topView = new BView("topView", B_WILL_DRAW);
	topView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
	topView->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
		B_ALIGN_USE_FULL_HEIGHT));
	topView->SetExplicitMinSize(BSize(fMinWidth, fMinHeight));
	BLayoutBuilder::Group<>(topView, B_VERTICAL)
		.SetInsets(0, B_USE_DEFAULT_SPACING, 0, B_USE_WINDOW_SPACING)
		.Add(fTabView)
		.End();

	SetLayout(new BGroupLayout(B_VERTICAL));
	GetLayout()->AddView(topView);

	fTabView->Select(fSettings.WindowTab());

	if (fSettings.WindowFrame().left > 0 && fSettings.WindowFrame().top > 0)
		MoveTo(fSettings.WindowFrame().left, fSettings.WindowFrame().top);

	if (fSettings.WindowFrame().Width() > 0
		&& fSettings.WindowFrame().Height() > 0) {
		ResizeTo(fSettings.WindowFrame().Width(),
			fSettings.WindowFrame().Height());
	}

	CenterOnScreen();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:59,代码来源:ScreenSaverWindow.cpp


示例11: BWindow

// ResourceUsageWindow - Constructor
ResourceUsageWindow::ResourceUsageWindow(BRect frame, BList &list) 
	: BWindow (frame, B_TRANSLATE("Resource Usage"), B_TITLED_WINDOW_LOOK,
		B_NORMAL_WINDOW_FEEL , B_NOT_ZOOMABLE|B_NOT_RESIZABLE)
{
	InitWindow(list);
	CenterOnScreen();
	Show();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:9,代码来源:ResourceUsageWindow.cpp


示例12: BWindow

Window::Window()
	:
	BWindow(BRect(100, 100, 620, 200), "Alert-Test", B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
{
	BMenu* sizeMenu = new BMenu("Button size");
	sizeMenu->SetLabelFromMarked(true);
	sizeMenu->SetRadioMode(true);
	sizeMenu->AddItem(new BMenuItem("As usual", NULL));
	sizeMenu->AddItem(new BMenuItem("From widest", NULL));
	sizeMenu->AddItem(new BMenuItem("From label", NULL));
	sizeMenu->ItemAt(0)->SetMarked(true);
	fSizeField = new BMenuField("Button size", sizeMenu);

	BMenu* typeMenu = new BMenu("Alert type");
	typeMenu->SetLabelFromMarked(true);
	typeMenu->SetRadioMode(true);
	typeMenu->AddItem(new BMenuItem("Empty", NULL));
	typeMenu->AddItem(new BMenuItem("Info", NULL));
	typeMenu->AddItem(new BMenuItem("Idea", NULL));
	typeMenu->AddItem(new BMenuItem("Warning", NULL));
	typeMenu->AddItem(new BMenuItem("Stop", NULL));
	typeMenu->ItemAt(0)->SetMarked(true);
	fTypeField = new BMenuField("Alert type", typeMenu);

	BMenu* spacingMenu = new BMenu("Button spacing");
	spacingMenu->SetLabelFromMarked(true);
	spacingMenu->SetRadioMode(true);
	spacingMenu->AddItem(new BMenuItem("Even", NULL));
	spacingMenu->AddItem(new BMenuItem("Offset", NULL));
	spacingMenu->ItemAt(0)->SetMarked(true);
	fSpacingField = new BMenuField("Button spacing", spacingMenu);

	fCountSlider = new BSlider("count", "Button count", NULL, 1, 3,
		B_HORIZONTAL);
	fCountSlider->SetValue(3);
	fCountSlider->SetLimitLabels("1", "3");
	fCountSlider->SetHashMarkCount(3);
	fCountSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);

	fLastStringView = new BStringView("last pressed", "");
	fLastStringView->SetAlignment(B_ALIGN_CENTER);

	BButton* button = new BButton("Show alert", new BMessage(kMsgShowAlert));

	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.Add(fSizeField)
		.Add(fTypeField)
		.Add(fSpacingField)
		.Add(fCountSlider)
		.AddGlue()
		.Add(fLastStringView)
		.Add(button)
		.SetInsets(B_USE_DEFAULT_SPACING);

	CenterOnScreen();
	SetFlags(Flags() | B_CLOSE_ON_ESCAPE);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:58,代码来源:SimpleAlertTest.cpp


示例13: BWindow

MainWindow::MainWindow()
	:
	BWindow(BRect(0, 0, 300, 400), "Caya", B_TITLED_WINDOW, 0),
	fWorkspaceChanged(false)
{
	fStatusView = new StatusView("statusView");

	SearchBarTextControl* searchBox = 
		new SearchBarTextControl(new BMessage(kSearchContact));

	fListView = new RosterListView("buddyView");
	fListView->SetInvocationMessage(new BMessage(CAYA_OPEN_CHAT_WINDOW));
	BScrollView* scrollView = new BScrollView("scrollview", fListView,
		B_WILL_DRAW, false, true);

	// Wrench menu
	BPopUpMenu* wrenchMenu = new BPopUpMenu("Wrench");
	(void)wrenchMenu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS,
		new BMessage(B_ABOUT_REQUESTED)));
	(void)wrenchMenu->AddItem(new BSeparatorItem());
	(void)wrenchMenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS,
		new BMessage(CAYA_SHOW_SETTINGS)));
	(void)wrenchMenu->AddItem(new BSeparatorItem());
	(void)wrenchMenu->AddItem(new BMenuItem("Quit",
		new BMessage(B_QUIT_REQUESTED)));
	wrenchMenu->SetTargetForItems(this);

	// Tool icon
	BResources* res = CayaResources();
	BBitmap* toolIcon = IconFromResources(res, kToolIcon);
	delete res;

	// Wrench tool button
	ToolButton* wrench = new ToolButton(NULL, NULL);
	wrench->SetBitmap(toolIcon);
	wrench->SetMenu(wrenchMenu);

	SetLayout(new BGridLayout(1, 2));
	AddChild(BGridLayoutBuilder(1, 2)
		.Add(searchBox, 0, 0)
		.Add(wrench, 1, 0)
		.Add(scrollView, 0, 1, 2)
		.Add(fStatusView, 0, 2, 2)
		.SetInsets(5, 5, 5, 10)
	);

	AddShortcut('a', B_COMMAND_KEY, new BMessage(B_ABOUT_REQUESTED));
	MoveTo(BAlert::AlertPosition(Bounds().Width(), Bounds().Height() / 2));

	// Filter messages using Server
	fServer = new Server();
	AddFilter(fServer);

	CenterOnScreen();

	//TODO check for errors here
	ReplicantStatusView::InstallReplicant();
}
开发者ID:ModeenF,项目名称:Caya,代码行数:58,代码来源:MainWindow.cpp


示例14: wxFrame

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();
}
开发者ID:Drakonas,项目名称:MultiMC4,代码行数:58,代码来源:consolewindow.cpp


示例15: GetSizeLimits

void
ScreenshotWindow::_ResizeToFitAndCenter()
{
	float minWidth;
	float minHeight;
	GetSizeLimits(&minWidth, NULL, &minHeight, NULL);
	ResizeTo(minWidth, minHeight);
	CenterOnScreen();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:9,代码来源:ScreenshotWindow.cpp


示例16: BWindow

MainWindow::MainWindow(BRect frame) 
	: BWindow(frame, "Torrentor!", B_DOCUMENT_WINDOW, 
			  B_AUTO_UPDATE_SIZE_LIMITS |
			  B_ASYNCHRONOUS_CONTROLS | 
			  B_NOT_ZOOMABLE )
{
	SetPulseRate(1000000);
	
	//
	//
	//
	SetLayout(new BGroupLayout(B_VERTICAL, 0.0));
	
	CreateMenuBar();
	
	
	fDownloadView 	= new DownloadView;
	
	
//	BStringView* fStatusText = new BStringView("status", "Laralala");
//	fStatusText->SetAlignment(B_ALIGN_LEFT);
//	fStatusText->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
///	fStatusText->SetExplicitMinSize(BSize(150, 12));

	
	AddChild(BGroupLayoutBuilder(B_VERTICAL, 0.0)
		.Add(fMenuBar)
		.Add(fDownloadView->ScrollView())
/*
		.Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
		.Add(BGroupLayoutBuilder(B_HORIZONTAL, spacing)
			.AddGlue()
			.Add(fRemoveMissingButton)
			.Add(fRemoveFinishedButton)
			.SetInsets(12, 5, 12, 5)
		)*/
	);


	//
	//
	//
	fOpenPanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL, B_FILE_NODE, true, NULL, 
								new TorrentRefFilter);
								
	//
	//
	//
	fPreferencesWindow = new PreferencesWindow();




	//
	CenterOnScreen();
}
开发者ID:bsdn321321,项目名称:Torrentor,代码行数:56,代码来源:MainWindow.cpp


示例17: BWindow

KeyboardWindow::KeyboardWindow()
	:
	BWindow(BRect(0, 0, 200, 200), B_TRANSLATE_SYSTEM_NAME("Keyboard"),
		B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
		| B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
{
	MoveTo(fSettings.WindowCorner());

	// Add the main settings view
	fSettingsView = new KeyboardView();
	BBox* fSettingsBox = new BBox("keyboard_box");
	fSettingsBox->AddChild(fSettingsView);

	// Add the "Default" button..
	fDefaultsButton = new BButton(B_TRANSLATE("Defaults"), new BMessage(BUTTON_DEFAULTS));

	// Add the "Revert" button...
	fRevertButton = new BButton(B_TRANSLATE("Revert"), new BMessage(BUTTON_REVERT));
	fRevertButton->SetEnabled(false);

	// Build the layout
	SetLayout(new BGroupLayout(B_VERTICAL));

	AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
		.Add(fSettingsBox)
		.AddGroup(B_HORIZONTAL, 7)
			.Add(fDefaultsButton)
			.Add(fRevertButton)
			.AddGlue()
		.End()
		.SetInsets(10, 10, 10, 10)
	);

	BSlider* slider = (BSlider* )FindView("key_repeat_rate");
	if (slider !=NULL)
		slider->SetValue(fSettings.KeyboardRepeatRate());

	slider = (BSlider* )FindView("delay_until_key_repeat");
	if (slider !=NULL)
		slider->SetValue(fSettings.KeyboardRepeatDelay());

	fDefaultsButton->SetEnabled(fSettings.IsDefaultable());

	// center window if it would be off-screen
	BScreen screen;
	if (screen.Frame().right < Frame().right
		|| screen.Frame().bottom < Frame().bottom) {
		CenterOnScreen();
	}

#ifdef DEBUG
	fSettings.Dump();
#endif

	Show();
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:56,代码来源:KeyboardWindow.cpp


示例18: DWindow

FindOpenFileWindow::FindOpenFileWindow(const char* panelText)
	:
	DWindow(BRect(0, 0, 0, 0), TR("Find and open file"), B_TITLED_WINDOW,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
	AddCommonFilter(new EscapeCancelFilter());

	BView* top = GetBackgroundView();

	fNameTextControl = new AutoTextControl("nameText", TR("Open: "), "",
		new BMessage);
	fNameTextControl->SetExplicitMinSize(
		BSize(fNameTextControl->StringWidth("M") * 20, B_SIZE_UNSET));
	fSystemCheckBox = new BCheckBox("systembox", TR("Search only system folders"),
		new BMessage);

	BButton* cancel = new BButton("cancel", TR("Cancel"),
		new BMessage(B_QUIT_REQUESTED));

	BButton* open = new BButton("open", TR("Open"), new BMessage(M_FIND_FILE));

	BLayoutBuilder::Group<>(top, B_VERTICAL)
		.AddGrid(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
			.Add(fNameTextControl->CreateLabelLayoutItem(), 0, 0)
			.Add(fNameTextControl->CreateTextViewLayoutItem(), 1, 0)
			.Add(fSystemCheckBox, 1, 1)
			.End()
		.AddGlue()
		.AddGroup(B_HORIZONTAL)
			.AddGlue()
			.Add(cancel)
			.Add(open)
			.End()
		.SetInsets(B_USE_WINDOW_INSETS)
		.End();

	BString text = panelText;
	if (text.CountChars() > 1) {
		fNameTextControl->SetText(text.String());
		int32 position = text.FindLast(".");
		if (position > 0)
			fNameTextControl->TextView()->Select(0, position);
		else
			fNameTextControl->TextView()->SelectAll();
	} else {
		fNameTextControl->SetText(".h");
		fNameTextControl->TextView()->GoToLine(0);
	}

	open->MakeDefault(true);

	fNameTextControl->MakeFocus(true);

	CenterOnScreen();
}
开发者ID:jscipione,项目名称:Paladin,代码行数:55,代码来源:FindOpenFileWindow.cpp


示例19: BWindow

ScreenshotWindow::ScreenshotWindow(BWindow* parent, BRect frame)
	:
	BWindow(frame, B_TRANSLATE("Screenshot"),
		B_FLOATING_WINDOW_LOOK, B_FLOATING_SUBSET_WINDOW_FEEL,
		B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
	fBarberPoleShown(false),
	fDownloadPending(false),
	fWorkerThread(-1)
{
	AddToSubset(parent);

	atomic_set(&fCurrentScreenshotIndex, 0);

	fBarberPole = new BarberPole("barber pole");
	fBarberPole->SetExplicitMaxSize(BSize(100, B_SIZE_UNLIMITED));
	fBarberPole->Hide();

	fIndexView = new BStringView("screenshot index", NULL);

	fToolBar = new BToolBar();
	fToolBar->AddAction(MSG_PREVIOUS_SCREENSHOT, this,
		sNextButtonIcon->Bitmap(SharedBitmap::SIZE_22),
		NULL, NULL);
	fToolBar->AddAction(MSG_NEXT_SCREENSHOT, this,
		sPreviousButtonIcon->Bitmap(SharedBitmap::SIZE_22),
		NULL, NULL);
	fToolBar->AddView(fIndexView);
	fToolBar->AddGlue();
	fToolBar->AddView(fBarberPole);

	fScreenshotView = new BitmapView("screenshot view");
	fScreenshotView->SetExplicitMaxSize(
		BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
	fScreenshotView->SetScaleBitmap(false);

	BGroupView* groupView = new BGroupView(B_VERTICAL);
	groupView->SetViewColor(kBackgroundColor);

	// Build layout
	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
		.SetInsets(0, 3, 0, 0)
		.Add(fToolBar)
		.AddStrut(3)
		.AddGroup(groupView)
			.Add(fScreenshotView)
			.SetInsets(B_USE_WINDOW_INSETS)
		.End()
	;

	fScreenshotView->SetLowColor(kBackgroundColor);
		// Set after attaching all views to prevent it from being overriden
		// again by BitmapView::AllAttached()

	CenterOnScreen();
}
开发者ID:looncraz,项目名称:haiku,代码行数:55,代码来源:ScreenshotWindow.cpp


示例20: wxFrame

//------------------------------------------------------------------------------
WelcomePanel::WelcomePanel(wxFrame *frame, const wxString& title,
      int x, int y, int w, int h)
: wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h),
          // wxRESIZE_BOX is no longer in wxWidgets-3.0
          //(wxDEFAULT_FRAME_STYLE & ~ (wxRESIZE_BORDER | wxRESIZE_BOX | wxMAXIMIZE_BOX)) | wxFRAME_FLOAT_ON_PARENT)
          (wxDEFAULT_FRAME_STYLE & ~ (wxRESIZE_BORDER | wxMAXIMIZE_BOX)) | wxFRAME_FLOAT_ON_PARENT)
{
   SetBackgroundColour(wxNullColour);
   Create();
   CenterOnScreen(wxBOTH);
   SetFocus();
}
开发者ID:rockstorm101,项目名称:GMAT,代码行数:13,代码来源:WelcomePanel.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CenterWindow函数代码示例发布时间:2022-05-30
下一篇:
C++ CenterOnParent函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap