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


C++ SetSizeLimits函数代码示例

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


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

示例1: BWindow

LJAboutWindow::LJAboutWindow()
 : BWindow(BRect(100, 295, 411, 464), "About AliveJournal", B_TITLED_WINDOW, 0, B_CURRENT_WORKSPACE)
{

	MainView = new LJAboutMainView();
	AddChild(MainView);
	SetSizeLimits(0, 1000, 0, 1000);

    char *title = new char[32];
    sprintf( title, "About AliveJournal v%s", VERSION_NUMBER );
    SetTitle( title );
    sprintf( title, "AliveJournal v%s", VERSION_NUMBER );
    MainView->titlestring->SetText( title );
    delete title;

    // Center the about box.
    BScreen *screen = new BScreen(this);
    int x = 0;
    int y = 0;

    x = screen->Frame().IntegerWidth() / 2;
    y = screen->Frame().IntegerHeight() / 2;

    x = x - Frame().IntegerWidth() / 2;
    y = y - Frame().IntegerHeight() / 2;

    MoveTo( x, y );
    
    delete screen;

}
开发者ID:grahams,项目名称:alivejournal,代码行数:31,代码来源:LJAboutWindow.cpp

示例2: BWindow

ReloadedWin::ReloadedWin()
    : BWindow(BRect(80,80,847,619),"Reloaded", B_TITLED_WINDOW,
              B_NOT_ZOOMABLE|B_NOT_RESIZABLE|B_QUIT_ON_WINDOW_CLOSE)
{
    // TODO - compute the size instead of hardcoding it
    SetSizeLimits(847-80,847-80,619-61,619-61);

    BMenuBar* menu = new BMenuBar(BRect(0,0,Bounds().Width() - 16,16),
                                  "mainmenu", B_FOLLOW_LEFT | B_FOLLOW_TOP);
    BMenu* file = new BMenu("File");
    menu->AddItem(file);
    BMenuItem* insertdsk = new BMenuItem("Insert Disc",
                                         new BMessage('dins'));
    file->AddItem(insertdsk);

    BMenu* settings = new BMenu("Settings");
    menu->AddItem(settings);
    BMenuItem* keymap = new BMenuItem("Keymap",
                                      new BMessage('kymp'));
    settings->AddItem(keymap);
    AddChild(menu);

    fStatusLed = new BView(BRect(Bounds().Width() - 16, 0, Bounds().Width(), 16), "fdcLed",
                           B_FOLLOW_RIGHT | B_FOLLOW_TOP, B_WILL_DRAW);
    fStatusLed->SetViewColor(0x77,00,00);
    AddChild(fStatusLed);

    fBitmapView = new RBitmapView(this, false);
    fBitmapView->MoveTo(0, menu->Bounds().bottom + 1);

    Show();
}
开发者ID:pedgarcia,项目名称:cpcsdk,代码行数:32,代码来源:RWin.cpp

示例3: BWindow

ZKWindow::ZKWindow(BRect winframe)
	:	BWindow(winframe, "ZooKeeper", B_TITLED_WINDOW, B_NOT_V_RESIZABLE),
	m_topbox	(NULL),
	m_editbox	(NULL),
	dropmode	(false)
{
	PRINT(("ZKWindow::ZKWindow()\n"));

	app_info app;
	be_app->GetAppInfo(& app);
	SetTitle(app.ref.name);
	
	BRect rect (Bounds());

	m_topbox = new BBox(rect, "view", B_FOLLOW_ALL_SIDES, B_NAVIGABLE, B_FANCY_BORDER);
	m_editbox = new	EditView(app.ref);
	
	m_topbox->AddChild(m_editbox);
	AddChild(m_topbox);

	MakeSettingsFolder();
	ReadSettings();
	
	SetSizeLimits(336, 800, 100, 5000);
}
开发者ID:HaikuArchives,项目名称:ZooKeeper,代码行数:25,代码来源:ZKWindow.cpp

示例4: GetSizeLimits

void
FileTypesWindow::_ShowSnifferRule(bool show)
{
	if (fRuleControl->IsHidden() == !show)
		return;

	float minWidth, maxWidth, minHeight, maxHeight;
	GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);

	float diff = fRuleControl->Bounds().Height() + 8.0f;

	if (!show) {
		fRuleControl->Hide();
		diff = -diff;
	}

	// adjust other controls to make space or take it again

	fIconBox->ResizeBy(0.0f, diff);
	fRecognitionBox->ResizeBy(0.0f, diff);
	fDescriptionBox->MoveBy(0.0f, diff);
	fPreferredBox->MoveBy(0.0f, diff);
	fAttributeBox->MoveBy(0.0f, diff);
	fAttributeBox->ResizeBy(0.0f, -diff);

	if (show)
		fRuleControl->Show();

	SetSizeLimits(minWidth, maxWidth, minHeight + diff, maxHeight);
}
开发者ID:mmanley,项目名称:Antares,代码行数:30,代码来源:FileTypesWindow.cpp

示例5: SetSizeLimits

void Win::WorkspacesChanged(uint32 oldws, uint32 newws) 
{
	//we don't really care what workspace we're running in, however, we need to
	//reset the size limits to match.
	BScreen Screen;
	SetSizeLimits(300,Screen.Frame().right,200,Screen.Frame().bottom);
}
开发者ID:svn2github,项目名称:Themis,代码行数:7,代码来源:win.cpp

示例6: FileShareWindow

		FileShareWindow(BWindow *win, BRect frame, const char *name, uint32 ipAddr) :
		  BWindow(frame, name, B_TITLED_WINDOW, B_NOT_ZOOMABLE)
		{
			parent = win;
			strcpy(host, name);
			address = ipAddr;

			CLVContainerView *containerView;
			BRect r = Bounds();

			MyColumnListView = new SmartColumnListView(r, &containerView, NULL, B_FOLLOW_TOP_BOTTOM | B_FOLLOW_LEFT_RIGHT,
				B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE, B_SINGLE_SELECTION_LIST,
				false, false, false, false, B_NO_BORDER);

			MyColumnListView->AddColumn(new CLVColumn(NULL, 20.0, CLV_LOCK_AT_BEGINNING | CLV_NOT_MOVABLE |
				CLV_NOT_RESIZABLE | CLV_PUSH_PASS | CLV_MERGE_WITH_RIGHT));
			MyColumnListView->AddColumn(new CLVColumn("Resource", 140.0, CLV_SORT_KEYABLE, 50.0));
			MyColumnListView->AddColumn(new CLVColumn("Type", 90.0, CLV_SORT_KEYABLE));

			MyColumnListView->SetSelectionMessage(new BMessage(MSG_SHARE_SELECT));
			MyColumnListView->SetInvocationMessage(new BMessage(MSG_SHARE_INVOKE));

			AddCLVItems(MyColumnListView);
			AddChild(containerView);

			SetSizeLimits(260, 2000, 110, 2000);
			Show();
		}
开发者ID:HaikuArchives,项目名称:BeServed,代码行数:28,代码来源:MyNetApp.cpp

示例7: BWindow

CalcWindow::CalcWindow(BRect frame, BMessage* settings)
	: BWindow(frame, kWindowTitle, B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
{
	// create calculator view with calculator description and
	// desktop background color
	BScreen screen(this);
	rgb_color baseColor = screen.DesktopColor();

	SetSizeLimits(100.0, 400.0, 100.0, 400.0);

	frame.OffsetTo(B_ORIGIN);
	fCalcView = new CalcView(frame, baseColor, settings);

	// create replicant dragger
	BRect replicantFrame(frame);
	replicantFrame.top = replicantFrame.bottom - 7.0f;
	replicantFrame.left = replicantFrame.right - 7.0f;
	BDragger* dragger = new BDragger(replicantFrame, fCalcView,
		B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);

	// attach views
	AddChild(fCalcView);
	fCalcView->AddChild(dragger);

	BRect rect;
	if (settings->FindRect("window frame", &rect) == B_OK)
		SetFrame(rect);
	else
		SetFrame(frame, true);
}
开发者ID:mariuz,项目名称:haiku,代码行数:30,代码来源:CalcWindow.cpp

示例8: ThreeButtonsWindow

	ThreeButtonsWindow(BRect frame) 
		:
		BWindow(frame, "ALM Three Buttons", B_TITLED_WINDOW,
			B_QUIT_ON_WINDOW_CLOSE)
	{
		BButton* button1 = new BButton("A");
		BButton* button2 = new BButton("B");
		BButton* button3 = new BButton("C");

		button1->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
			B_ALIGN_USE_FULL_HEIGHT));
		button1->SetExplicitMaxSize(BSize(500, 50));

		button2->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
			B_ALIGN_USE_FULL_HEIGHT));
		button2->SetExplicitMaxSize(BSize(500, 500));

		button3->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
			B_ALIGN_USE_FULL_HEIGHT));
		button3->SetExplicitMaxSize(BSize(500, 500));

		fLayout = new BALMLayout(0, 0);
		BALM::BALMLayoutBuilder(this, fLayout)
			.Add(button1, fLayout->Left(), fLayout->Top(), fLayout->Right())
			.StartingAt(button1)
				.AddBelow(button2)
				.AddBelow(button3, fLayout->Bottom());

		// test size limits
		BSize min = fLayout->MinSize();
		BSize max = fLayout->MaxSize();
		SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());
	}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:33,代码来源:ThreeButtons.cpp

示例9: GetSizeLimits

void
ExpanderWindow::_UpdateWindowSize(bool showContents)
{
	float minWidth, maxWidth, minHeight, maxHeight;
	GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);

	float bottom = fSizeLimit;

	if (showContents) {
		if (fPreviousHeight < 0.0) {
			BFont font;
			font_height fontHeight;
			fListingText->GetFont(&font);
			font.GetHeight(&fontHeight);
			fLineHeight = ceilf(fontHeight.ascent + fontHeight.descent
				+ fontHeight.leading);
			fPreviousHeight = bottom + 10.0 * fLineHeight;
		}
		minHeight = bottom + 5.0 * fLineHeight;
		maxHeight = 32767.0;

		bottom = max_c(fPreviousHeight, minHeight);
	} else {
		minHeight = fSizeLimit;
		maxHeight = fSizeLimit;
		fPreviousHeight = Frame().Height();
	}

	SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight);
	ResizeTo(Frame().Width(), bottom);
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:31,代码来源:ExpanderWindow.cpp

示例10: BWindow

PulseWindow::PulseWindow(BRect rect)
	:
	BWindow(rect, B_TRANSLATE_SYSTEM_NAME("Pulse"), B_TITLED_WINDOW,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
{
	SetPulseRate(200000);
	
	PulseApp *pulseapp = (PulseApp *)be_app;
	BRect bounds = Bounds();
	fNormalPulseView = new NormalPulseView(bounds);
	AddChild(fNormalPulseView);

	fMiniPulseView = new MiniPulseView(bounds, "MiniPulseView", 
		pulseapp->prefs);
	AddChild(fMiniPulseView);

	fMode = pulseapp->prefs->window_mode;
	if (fMode == MINI_WINDOW_MODE) {
		SetLook(B_MODAL_WINDOW_LOOK);
		SetFeel(B_NORMAL_WINDOW_FEEL);
		SetFlags(B_NOT_ZOOMABLE);
		fNormalPulseView->Hide();
		SetSizeLimits(GetMinimumViewWidth() - 1, 4096, 2, 4096);
		ResizeTo(rect.Width(), rect.Height());
	} else
		fMiniPulseView->Hide();

	fPrefsWindow = NULL;
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:29,代码来源:PulseWindow.cpp

示例11: ThreeButtonsWindow

	ThreeButtonsWindow(BRect frame) 
		:
		BWindow(frame, "ALM Three Buttons", B_TITLED_WINDOW,
			B_QUIT_ON_WINDOW_CLOSE)
	{
		BButton* button1 = new BButton("A");
		BButton* button2 = new BButton("B");
		BButton* button3 = new BButton("C");

		button1->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
			B_ALIGN_USE_FULL_HEIGHT));
		button1->SetExplicitMaxSize(BSize(500, 50));

		button2->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
			B_ALIGN_USE_FULL_HEIGHT));
		button2->SetExplicitMaxSize(BSize(500, 500));

		button3->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
			B_ALIGN_USE_FULL_HEIGHT));
		button3->SetExplicitMaxSize(BSize(500, 500));

		// create a new BALMLayout and use  it for this window
		fLayout = new BALMLayout();
		SetLayout(fLayout);
		
		fLayout->AddView(button1, fLayout->Left(), fLayout->Top(),
			fLayout->Right(), NULL);
		fLayout->AddViewToBottom(button2);
		fLayout->AddViewToBottom(button3, fLayout->Bottom());

		// test size limits
		BSize min = fLayout->MinSize();
		BSize max = fLayout->MaxSize();
		SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());
	}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:35,代码来源:ThreeButtons.cpp

示例12: TableDemoWindow

    TableDemoWindow(BRect frame)
        : BWindow(frame, "ALM Table Demo", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE)
    {
        // create a new BALMLayout and use  it for this window
        BALMLayout* layout = new BALMLayout();
        SetLayout(layout);

        Column* c1 = layout->AddColumn(layout->Left(), layout->Right());
        Row* r1 = layout->AddRow(layout->Top(), NULL);
        Row* r2 = layout->AddRow(r1->Bottom(), NULL);
        Row* r3 = layout->AddRow(r2->Bottom(), layout->Bottom());

        BButton* b1 = new BButton("A1");
        layout->AddView(b1, r1, c1);
        b1->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));

        BButton* b2 = new BButton("A2");
        layout->AddView(b2, r2, c1);
        b2->SetExplicitAlignment(BAlignment(
                                     B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER));

        BButton* b3 = new BButton("A3");
        layout->AddView(b3, r3, c1);
        b3->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT, B_ALIGN_BOTTOM));

        // test size limits
        BSize min = layout->MinSize();
        BSize max = layout->MaxSize();
        SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());
    }
开发者ID:yunxiaoxiao110,项目名称:haiku,代码行数:30,代码来源:TableDemo.cpp

示例13: PinwheelWindow

	PinwheelWindow(BRect frame) 
		:
		BWindow(frame, "ALM Pinwheel", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE)
	{
		button1 = new BButton("1");
		button2 = new BButton("2");
		button3 = new BButton("3");
		button4 = new BButton("4");
		textView1 = new BTextView("textView1");
		textView1->SetText("5");	

		button1->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
		button2->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
		button3->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
		button4->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));

		// create a new BALMLayout and use  it for this window
		BALMLayout* layout = new BALMLayout(10, 10);

		BReference<XTab> xTabs[2];
		BReference<YTab> yTabs[2];
		layout->AddXTabs(xTabs, 2);
		layout->AddYTabs(yTabs, 2);

		BALM::BALMLayoutBuilder(this, layout)
			.SetInsets(5)
			.Add(textView1, xTabs[0], yTabs[0], xTabs[1], yTabs[1])
			.StartingAt(textView1)
				.AddAbove(button1, layout->Top(), layout->Left())
				.AddToRight(button2, layout->Right(), NULL, yTabs[1])
				.AddBelow(button3, layout->Bottom(), xTabs[0])
				.AddToLeft(button4, layout->Left(),  yTabs[0]);

		// alternative setup
		/*
		SetLayout(layout);

		layout->SetInsets(5.);

		// create extra tabs
		BReference<XTab> x1 = layout->AddXTab();
		BReference<XTab> x2 = layout->AddXTab();
		BReference<YTab> y1 = layout->AddYTab();
		BReference<YTab> y2 = layout->AddYTab();

		layout->AddView(button1, layout->Left(), layout->Top(), x2,
			y1);
		layout->AddView(button2, x2, layout->Top(), layout->Right(), y2);
		layout->AddView(button3, x1, y2, layout->Right(),
			layout->Bottom());
		layout->AddView(button4, layout->Left(), y1, x1, layout->Bottom());
		layout->AddView(textView1, x1, y1, x2, y2);
		*/

		// test size limits
		BSize min = layout->MinSize();
		BSize max = layout->MaxSize();
		SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());
	}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:59,代码来源:Pinwheel.cpp

示例14: SetSizeLimits

void HDialog::ResizeToLimits(float minW, float maxW, float minH, float maxH)
{
	SetSizeLimits(minW, maxW, minH, maxH);
	BRect frame = Frame();
	float w = std::min(maxW, std::max(minW, frame.Width()));
	float h = std::min(maxH, std::max(minH, frame.Height()));
	ResizeTo(w, h);
}
开发者ID:HaikuArchives,项目名称:Pe,代码行数:8,代码来源:HDialog.cpp

示例15: BWindow

GDWindow::GDWindow(BRect frame)
				: BWindow(frame, "GrafDemo 4.6", B_DOCUMENT_WINDOW,0)
{
	Lock();
	// Add the graph to the window
	BRect grafRect = Bounds();
	grafRect.top += mb_height + 2;
	mGraphView= new GDView(grafRect);
	AddChild(mGraphView);
	SetSizeLimits(frame.right - frame.left,9999,frame.bottom - frame.top,9999);

	// Add the main menu bar and menus
	BRect menuRect(0,0,1000,mb_height);
	BMenuBar* menuBar = new BMenuBar(menuRect,"MB");
	
	BMenu*	fileMenu = new BMenu("File");
	BMenuItem* aboutItem = new BMenuItem("About...",new BMessage(B_ABOUT_REQUESTED));
	aboutItem->SetTarget(be_app);
	fileMenu->AddItem(aboutItem);
	fileMenu->AddSeparatorItem();
	fileMenu->AddItem(new BMenuItem("Quit",new BMessage(B_QUIT_REQUESTED)));
	menuBar->AddItem(fileMenu);
	
	BMenu*	editMenu = new BMenu("Edit");
	editMenu->AddItem(new BMenuItem("Erase",new BMessage(G_erase_data)));
	editMenu->AddItem(new BMenuItem("Reset Axes",new BMessage(G_reset_axes)));
	editMenu->SetTargetForItems(mGraphView);
	menuBar->AddItem(editMenu);
	
	BMenu*	paramsMenu = new BMenu("Params");
	BMessage* cFitMesg = new BMessage(G_set_params);
	cFitMesg->AddInt16(pName,0);
	BMessage* p2Mesg = new BMessage(G_set_params);
	p2Mesg->AddInt16(pName,2);
	BMessage* p3Mesg = new BMessage(G_set_params);
	p3Mesg->AddInt16(pName,3);
	BMessage* p4Mesg = new BMessage(G_set_params);
	p4Mesg->AddInt16(pName,4);
	paramsMenu->AddItem(new BMenuItem("Cubic Spline",cFitMesg));
	paramsMenu->AddSeparatorItem();
	paramsMenu->AddItem(new BMenuItem("1st Order",p2Mesg));
	paramsMenu->AddItem(new BMenuItem("2nd Order",p3Mesg));
	paramsMenu->AddItem(new BMenuItem("3rd Order",p4Mesg));
	paramsMenu->SetRadioMode(true);
	paramsMenu->FindItem("2nd Order")->SetMarked(true);
	paramsMenu->SetTargetForItems(mGraphView);
	menuBar->AddItem(paramsMenu);

	BMenu*	axisMenu = new BMenu("Axes");
	axisMenu->AddItem(new BMenuItem("Set Axes"B_UTF8_ELLIPSIS,new BMessage(G_change_axis)));
	axisMenu->SetTargetForItems(mGraphView);
	menuBar->AddItem(axisMenu);

	AddChild(menuBar);
	
	Unlock();
}
开发者ID:HaikuArchives,项目名称:PlottingTools,代码行数:57,代码来源:GDWindow.cpp


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