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


C++ BRect函数代码示例

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


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

示例1: BWindow

ChatWindow::ChatWindow(entry_ref & ref)
:	BWindow( 
		BRect(100,100,400,300), 
		"unknown contact - unknown status", 
		B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_AVOID_FOCUS
	),
	fEntry(ref),
	fMan( new IM::Manager(BMessenger(this))),
	fChangedNotActivated(false),
	fStatusBar(NULL),
	fSendButton(NULL),
	fProtocolHack(NULL)
{

	bool command, sendButton;
	int32 iconBarSize;
	
	BMessage chatSettings;
	im_load_client_settings("im_emoclient", &chatSettings);
	
	if ( chatSettings.FindBool("command_sends", &command) != B_OK )
		command = true;
	if ( chatSettings.FindBool("show_send_button", &sendButton) != B_OK )
		sendButton = true;
	if ( chatSettings.FindInt32("icon_size", &iconBarSize) != B_OK )
		iconBarSize = kLargeIcon;
	if ( iconBarSize <= 0 )
		iconBarSize = kLargeIcon;
	if (chatSettings.FindString("people_handler", &fPeopleHandler) != B_OK) {
		fPeopleHandler = kDefaultPeopleHandler;
	};
	if (chatSettings.FindString("other", &fOtherText) != B_OK ) {
		fOtherText.SetTo( "$name$ ($nickname$) ($protocol$) ");
	}
	
	// Set window size limits
	SetSizeLimits(
		220, 8000, // width,
		150, 8000  // height
	);
	
	// get the size of various things
	font_height height;
	be_plain_font->GetHeight(&height);
	fFontHeight = height.ascent + height.descent + height.leading;
	
	// default window size
	BRect windowRect(100, 100, 400, 300);
	BPoint inputDivider(0, 150);
	
	// load window size if possible
	if (LoadSettings() == B_OK) {
		bool was_ok = true;
		
		if (fWindowSettings.FindRect("windowrect", &windowRect) != B_OK) {
			was_ok = false;
		}
		if (fWindowSettings.FindPoint("inputdivider", &inputDivider) != B_OK) {
			was_ok = false;
		}
		
		if ( !was_ok )
		{
			windowRect = BRect(100, 100, 400, 300);
			inputDivider = BPoint(0, 200);
		}
	}
	
	// sanity check for divider location
	if ( inputDivider.y > windowRect.Height() - 50 ) {
		LOG("im_emoclient", liLow, "Insane divider, fixed.");
		inputDivider.y = windowRect.Height() - 50;
	};
	
	// set size and position
	MoveTo(windowRect.left, windowRect.top);
	ResizeTo(windowRect.Width(), windowRect.Height());
	
	// create views
	BRect textRect = Bounds();
	BRect inputRect = Bounds();
	BRect dockRect = Bounds();

	dockRect.bottom = iconBarSize + kDockPadding;
	fDock = new IconBar(dockRect);
	
#if B_BEOS_VERSION > B_BEOS_VERSION_5
	fDock->SetViewUIColor(B_UI_PANEL_BACKGROUND_COLOR);
	fDock->SetLowUIColor(B_UI_PANEL_BACKGROUND_COLOR);
	fDock->SetHighUIColor(B_UI_PANEL_TEXT_COLOR);
#else
	fDock->SetViewColor( ui_color(B_PANEL_BACKGROUND_COLOR) );
	fDock->SetLowColor( ui_color(B_PANEL_BACKGROUND_COLOR) );
	fDock->SetHighColor(0, 0, 0, 0);
#endif
	AddChild(fDock);
	
	// add buttons
	ImageButton * btn;
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:IMKit,代码行数:101,代码来源:ChatWindow.cpp

示例2: BWindow

MainWin::MainWin(BRect frame_rect)
	:
	BWindow(frame_rect, B_TRANSLATE_SYSTEM_NAME(NAME), B_TITLED_WINDOW,
 	B_ASYNCHRONOUS_CONTROLS /* | B_WILL_ACCEPT_FIRST_CLICK */)
 ,	fController(new Controller)
 ,	fIsFullscreen(false)
 ,	fKeepAspectRatio(true)
 ,	fAlwaysOnTop(false)
 ,	fNoMenu(false)
 ,	fNoBorder(false)
 ,	fSourceWidth(720)
 ,	fSourceHeight(576)
 ,	fWidthScale(1.0)
 ,	fHeightScale(1.0)
 ,	fMouseDownTracking(false)
 ,	fFrameResizedTriggeredAutomatically(false)
 ,	fIgnoreFrameResized(false)
 ,	fFrameResizedCalled(true)
{
	BRect rect = Bounds();

	// background
	fBackground = new BView(rect, "background", B_FOLLOW_ALL,
		B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
	fBackground->SetViewColor(0,0,0);
	AddChild(fBackground);

	// menu
	fMenuBar = new BMenuBar(fBackground->Bounds(), "menu");
	CreateMenu();
	fBackground->AddChild(fMenuBar);
	fMenuBar->ResizeToPreferred();
	fMenuBarHeight = (int)fMenuBar->Frame().Height() + 1;
	fMenuBar->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);

	// video view
	BRect video_rect = BRect(0, fMenuBarHeight, rect.right, rect.bottom);
	fVideoView = new VideoView(video_rect, "video display", B_FOLLOW_ALL,
		B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
	fBackground->AddChild(fVideoView);

	fVideoView->MakeFocus();

//	SetSizeLimits(fControlViewMinWidth - 1, 32767,
//		fMenuBarHeight + fControlViewHeight - 1, fMenuBarHeight
//		+ fControlViewHeight - 1);

//	SetSizeLimits(320 - 1, 32767, 240 + fMenuBarHeight - 1, 32767);

	SetSizeLimits(0, 32767, fMenuBarHeight - 1, 32767);

	fController->SetVideoView(fVideoView);
	fController->SetVideoNode(fVideoView->Node());

	fVideoView->IsOverlaySupported();

	SetupInterfaceMenu();
	SelectInitialInterface();
	SetInterfaceMenuMarker();
	SetupChannelMenu();
	SetChannelMenuMarker();

	VideoFormatChange(fSourceWidth, fSourceHeight, fWidthScale, fHeightScale);

	CenterOnScreen();
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:66,代码来源:MainWin.cpp

示例3: SetTextRect

void
EditorTextView::FrameResized(float new_width, float new_height)
{
	SetTextRect(BRect(0, 0, new_width, new_height));
}
开发者ID:mmlr,项目名称:libbsvg,代码行数:5,代码来源:EditorTextView.cpp

示例4: switch

void Slider::KeyDown (const char *bytes, int32 numBytes)
{
	if (numBytes == 1)
	{
		switch (*bytes)
		{
		case B_ESCAPE:
		{
			if (tc)
			{
				// printf ("TextControl is open\n");
				RemoveChild (tc);
				delete (tc);
				tc = NULL;
			}
			break;
		}
		case B_SPACE:
		case B_ENTER:
		{	
			//printf ("Enter\n");
			if (tc)
			{
				// printf ("TextControl is open\n");
				BMessage *key = new BMessage ('tcVC');
				MessageReceived (key);
				delete key;
			}
			else
			{
				knobpos = BPoint (float (value - min)/(max - min)*(width - knobsize), 1);
				BRect kbr = BRect (knobpos.x + sep, knobpos.y, knobpos.x + knobsize - 2 + sep, knobpos.y + height - 3);
		//		kbr.PrintToStream();
				tc = new BTextControl (kbr, "slider value field", "", "", new BMessage ('tcVC'));
				tc->SetTarget (this);
				tc->SetDivider (0);
				EnterFilter *filter = new EnterFilter (this);
				tc->TextView()->AddFilter (filter);
				char vs[64];
				sprintf (vs, fmt, value);
				tc->SetText (vs);
				AddChild (tc);
				tc->MakeFocus (true);
				inherited::KeyDown (bytes, numBytes);
			}
			break;
		}
		case B_LEFT_ARROW:
			//printf ("Left\n");
			if (value > min)
			{
				value -= step;
				Invalidate();
				NotifyTarget();
			}
			break;
		case B_RIGHT_ARROW:
			//printf ("Right\n");
			if (value < max)
			{
				value += step;
				Invalidate();
				NotifyTarget();
			}
			break;
		case B_TAB:
			// printf ("Tab\n");
			if (tc)
			{
				// printf ("TextControl is open\n");
				BMessage *key = new BMessage ('tcVC');
				MessageReceived (key);
				delete key;
			}
			else
			{
			// MakeFocus (false);
				inherited::KeyDown (bytes, numBytes);
				Invalidate();
				break;
			}
		default:
			inherited::KeyDown (bytes, numBytes);
		}
	}
	else
		inherited::KeyDown (bytes, numBytes);
}
开发者ID:gedrin,项目名称:Becasso,代码行数:88,代码来源:Slider.cpp

示例5: BWindow

CharismaWindow::CharismaWindow(BPoint origin):
	BWindow(BRect(origin.x,origin.y,origin.x+200,origin.y+80),
		"Charisma", B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 
		B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_WILL_ACCEPT_FIRST_CLICK)
{
	BRect nullrect(0,0,0,0),r;
	BMenu *m;
	BWindow *w;
	char buf[100];
	
	isminim=0;
	
	// le menu
	menubar=new BMenuBar(BRect(0,0,0,0),"menu bar");
	m=new BMenu("File");
	m->AddItem(new BMenuItem("About…",new BMessage(kMsg_About)));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("Quit",new BMessage(B_QUIT_REQUESTED),'Q'));
	menubar->AddItem(m);
	m=new BMenu("Settings");
	m->AddItem(new BMenuItem("Select Web Directory…",new BMessage(kMsg_SelectDirectory)));
	m->AddSeparatorItem();
	m->AddItem(extcontrol_item=new BMenuItem("External Control",new BMessage(kMsg_ExternalControl)));
	m->AddItem(netposautoset_item=new BMenuItem("Net+ Autosettings",new BMessage(kMsg_NetposAutosettings)));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("Clear Hits",new BMessage(kMsg_ClearHits)));
	menubar->AddItem(m);
	AddChild(menubar);

	// le fond gris
	r=Frame();
	setupview=new BView(
		BRect(0,menubar->Frame().bottom,r.Width(),r.Height()),
		"background",B_FOLLOW_NONE,B_WILL_DRAW);
	setupview->SetViewColor(0xDD,0xDD,0xDD);
	AddChild(setupview);
	
	// "Mode"
	m=new BPopUpMenu("");
	m->AddItem(new BMenuItem("Disabled",MSG));
	m->AddItem(new BMenuItem("Offline",MSG));
	m->AddItem(new BMenuItem("Online",MSG));
	modemenu=new BMenuField(
		BRect(10.0f,10.0f,20.0f,20.0f),"mode",
		"Mode:",
		m);
	BMenuField_resize(modemenu);
	setupview->AddChild(modemenu);

	// "Refresh"
	m=new BPopUpMenu("");
	m->AddItem(new BMenuItem("Dumb",MSG));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("Always",MSG));
	m->AddItem(new BMenuItem("Once per session",MSG));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("After 1 hour",MSG));
	m->AddItem(new BMenuItem("After 6 hours",MSG));
	m->AddItem(new BMenuItem("After 12 hours",MSG));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("After 1 day",MSG));
	m->AddItem(new BMenuItem("After 2 days",MSG));
	m->AddItem(new BMenuItem("After 3 days",MSG));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("After 1 week",MSG));
	m->AddItem(new BMenuItem("After 2 weeks",MSG));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("After 1 month",MSG));
	m->AddItem(new BMenuItem("After 2 month",MSG));
	m->AddItem(new BMenuItem("After 6 month",MSG));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("After 1 year",MSG));
	m->AddItem(new BMenuItem("After 2 years",MSG));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("never",MSG));
	smartrefresh=new BMenuField(
		rectunder(modemenu),"refresh",
		"Refresh:",
		m);
	BMenuField_resize(smartrefresh);
	setupview->AddChild(smartrefresh);
	
	// "Hits"
	r.left=10.0f;
	r.top=smartrefresh->Frame().bottom+10.0f;
	r.right=r.left+setupview->StringWidth("hits: 99999");
	r.bottom=r.top+BView_textheight(setupview);
	hits=new BStringView(r,"hits","");
	setupview->AddChild(hits);

	if(!gregistered){
		sprintf(buf,"This copy is not registered");
		r.left=10.0f;
		r.top=hits->Frame().bottom+10.0f;
		r.right=r.left+setupview->StringWidth(buf);
		r.bottom=r.top+BView_textheight(setupview);
		setupview->AddChild(new BStringView(r,NULL,buf));
	}

	r=BView_childrenframe(setupview);
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:Stamina,代码行数:101,代码来源:main.cpp

示例6: SetDrawingMode

void KlondikeView::Draw(BRect rect)
{
	
	SetDrawingMode(B_OP_ALPHA);
	
	int hSpacing = _CardHSpacing();
	
	// stock
	int revealed = 0;
	for (short i = 0; i < 24; i++)
		if (fStock[i]->fRevealed)
			revealed++;
	
	if (revealed < 24)
		DrawBitmap(fBack[0], BRect(hSpacing, 15,
			hSpacing + CARD_WIDTH, 15 + CARD_HEIGHT));
	else
		DrawBitmap(fEmpty, BRect(hSpacing, 15,
		hSpacing + CARD_WIDTH, 15 + CARD_HEIGHT));
	
	// waste
	if (fIsWasteCardPicked) {
		int lastWasteCard = fWasteCard - 1;
		
		if (lastWasteCard != -1)
			while (fStock[lastWasteCard]->fRevealed) {
				lastWasteCard--;
				if (lastWasteCard == -1) {
					break;
				}
			}
		
		if (lastWasteCard != -1)
			DrawBitmap(
				fCards[fStock[lastWasteCard]->fColor
				* CARDS_IN_SUIT + fStock[lastWasteCard]->fValue],
				BRect(2 * hSpacing + CARD_WIDTH, 15,
				2 * hSpacing + 2 * CARD_WIDTH, 15 + CARD_HEIGHT));
		else
			DrawBitmap(fEmpty, BRect(2 * hSpacing + CARD_WIDTH, 15,
				2 * hSpacing + 2 * CARD_WIDTH, 15 + CARD_HEIGHT));
	} else if (fWasteCard != -1) {
		if (fWasteCard > 23) {
			fWasteCard = -1;
			
			fPoints -= 100;
			if (fPoints < 0)
				fPoints = 0;
			
			Invalidate();
			return;
		}
		
		while (fStock[fWasteCard]->fRevealed) {
			fWasteCard++;
			if (fWasteCard > 23) {
				fWasteCard = -1;
				
				fPoints -= 100;
				if (fPoints < 0)
					fPoints = 0;
				
				break;
			}
		}
		
		rect = BRect(2 * hSpacing + CARD_WIDTH, 15,
			2 * hSpacing + 2 * CARD_WIDTH, 15 + CARD_HEIGHT);
		
		if (fWasteCard != -1)
			DrawBitmap(
				fCards[fStock[fWasteCard]->fColor
				* CARDS_IN_SUIT + fStock[fWasteCard]->fValue], rect);
		else
			DrawBitmap(fEmpty, rect);
			
	} else
		DrawBitmap(fEmpty, BRect(2 * hSpacing + CARD_WIDTH, 15,
			2 * hSpacing + 2 * CARD_WIDTH, 15 + CARD_HEIGHT));
	
	// foundations
	for (short i = 0; i < 4; i++) {
		BRect rect = BRect((i + 4)*hSpacing + (i + 3)*CARD_WIDTH, 15,
			(i + 4)*hSpacing + (i + 4)*CARD_WIDTH, 15 + CARD_HEIGHT);
		
		if (fFoundations[i]	== -1) {
			DrawBitmap(fEmpty, rect);
		} else {
			DrawBitmap(
				fCards[fFoundationsColors[i] * CARDS_IN_SUIT + fFoundations[i]],
				rect);
		}
	}
	
	// tableaux
	for (short i = 0; i < 7; i++) {
		BRect rect(hSpacing + i * (CARD_WIDTH + hSpacing), 146,
				hSpacing + (i + 1) * CARD_WIDTH + i * hSpacing,
				146 + CARD_HEIGHT);
		if (solitare.fBoard[i] == NULL)
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:BeSpider,代码行数:101,代码来源:KlondikeView.cpp

示例7: BWindow

TeamMonitorWindow::TeamMonitorWindow()
	:
	BWindow(BRect(0, 0, 350, 100), B_TRANSLATE("Team monitor"),
		B_TITLED_WINDOW_LOOK, B_MODAL_ALL_WINDOW_FEEL,
		B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS
			| B_CLOSE_ON_ESCAPE | B_AUTO_UPDATE_SIZE_LIMITS,
		B_ALL_WORKSPACES),
	fQuitting(false),
	fUpdateRunner(NULL)
{
	BGroupLayout* layout = new BGroupLayout(B_VERTICAL);
	float inset = 10;
	layout->SetInsets(inset, inset, inset, inset);
	layout->SetSpacing(inset);
	SetLayout(layout);

	layout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	fListView = new BListView("teams");
	fListView->SetSelectionMessage(new BMessage(TM_SELECTED_TEAM));

	BScrollView* scrollView = new BScrollView("scroll_teams", fListView,
		0, B_SUPPORTS_LAYOUT, false, true, B_FANCY_BORDER);
	scrollView->SetExplicitMinSize(BSize(B_SIZE_UNSET, 150));

	fKillButton = new BButton("kill", B_TRANSLATE("Kill application"),
		new BMessage(TM_KILL_APPLICATION));
	fKillButton->SetEnabled(false);

	fQuitButton = new BButton("quit", B_TRANSLATE("Quit application"),
		new BMessage(TM_QUIT_APPLICATION));
	fQuitButton->SetEnabled(false);

	fDescriptionView = new TeamDescriptionView;

	BButton* forceReboot = new BButton("force", B_TRANSLATE("Force reboot"),
		new BMessage(TM_FORCE_REBOOT));

	fRestartButton = new BButton("restart", B_TRANSLATE("Restart the desktop"),
		new BMessage(TM_RESTART_DESKTOP));

	fCancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
		new BMessage(TM_CANCEL));
	SetDefaultButton(fCancelButton);

	BGroupLayoutBuilder(layout)
		.Add(scrollView)
		.AddGroup(B_HORIZONTAL)
			.Add(fKillButton)
			.Add(fQuitButton)
			.AddGlue()
			.End()
		.Add(fDescriptionView)
		.AddGroup(B_HORIZONTAL)
			.Add(forceReboot)
			.AddGlue()
			.Add(fRestartButton)
			.AddGlue(inset)
			.Add(fCancelButton);

	CenterOnScreen();

	fRestartButton->Hide();

	AddShortcut('T', B_COMMAND_KEY | B_OPTION_KEY,
		new BMessage(kMsgLaunchTerminal));
	AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));

	gLocalizedNamePreferred
		= BLocaleRoster::Default()->IsFilesystemTranslationPreferred();

	gTeamMonitorWindow = this;

	this->AddCommonFilter(new BMessageFilter(B_ANY_DELIVERY,
		B_ANY_SOURCE, B_KEY_DOWN, FilterKeyDown));

	if (be_app->Lock()) {
		be_app->AddCommonFilter(new BMessageFilter(B_ANY_DELIVERY,
			B_ANY_SOURCE, B_LOCALE_CHANGED, FilterLocaleChanged));
		be_app->Unlock();
	}
}
开发者ID:Ithamar,项目名称:haiku,代码行数:82,代码来源:TeamMonitorWindow.cpp

示例8: BWindow

ModifierKeysWindow::ModifierKeysWindow()
    :
    BWindow(BRect(0, 0, 360, 220), B_TRANSLATE("Modifier keys"),
           B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
           | B_AUTO_UPDATE_SIZE_LIMITS)
{
    get_key_map(&fCurrentMap, &fCurrentBuffer);
    get_key_map(&fSavedMap, &fSavedBuffer);

    BStringView* keyRole = new BStringView("key role",
                                           B_TRANSLATE_COMMENT("Role", "As in the role of a modifier key"));
    keyRole->SetAlignment(B_ALIGN_RIGHT);
    keyRole->SetFont(be_bold_font);

    BStringView* keyLabel = new BStringView("key label",
                                            B_TRANSLATE_COMMENT("Key", "As in a computer keyboard key"));
    keyLabel->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
    keyLabel->SetFont(be_bold_font);

    BMenuField* shiftMenuField = _CreateShiftMenuField();
    shiftMenuField->SetAlignment(B_ALIGN_RIGHT);

    BMenuField* controlMenuField = _CreateControlMenuField();
    controlMenuField->SetAlignment(B_ALIGN_RIGHT);

    BMenuField* optionMenuField = _CreateOptionMenuField();
    optionMenuField->SetAlignment(B_ALIGN_RIGHT);

    BMenuField* commandMenuField = _CreateCommandMenuField();
    commandMenuField->SetAlignment(B_ALIGN_RIGHT);

    fShiftConflictView = new ConflictView("shift warning view");
    fShiftConflictView->SetExplicitMaxSize(BSize(15, 15));

    fControlConflictView = new ConflictView("control warning view");
    fControlConflictView->SetExplicitMaxSize(BSize(15, 15));

    fOptionConflictView = new ConflictView("option warning view");
    fOptionConflictView->SetExplicitMaxSize(BSize(15, 15));

    fCommandConflictView = new ConflictView("command warning view");
    fCommandConflictView->SetExplicitMaxSize(BSize(15, 15));

    fCancelButton = new BButton("cancelButton", B_TRANSLATE("Cancel"),
                                new BMessage(B_QUIT_REQUESTED));

    fRevertButton = new BButton("revertButton", B_TRANSLATE("Revert"),
                                new BMessage(kMsgRevertModifiers));
    fRevertButton->SetEnabled(false);

    fOkButton = new BButton("okButton", B_TRANSLATE("Set modifier keys"),
                            new BMessage(kMsgApplyModifiers));
    fOkButton->MakeDefault(true);

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

    AddChild(BLayoutBuilder::Group<>(B_VERTICAL)
             .AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING)
             .Add(keyRole, 0, 0)
             .Add(keyLabel, 1, 0, 2, 1)

             .Add(shiftMenuField->CreateLabelLayoutItem(), 0, 1)
             .Add(shiftMenuField->CreateMenuBarLayoutItem(), 1, 1)
             .Add(fShiftConflictView, 2, 1)

             .Add(controlMenuField->CreateLabelLayoutItem(), 0, 2)
             .Add(controlMenuField->CreateMenuBarLayoutItem(), 1, 2)
             .Add(fControlConflictView, 2, 2)

             .Add(optionMenuField->CreateLabelLayoutItem(), 0, 3)
             .Add(optionMenuField->CreateMenuBarLayoutItem(), 1, 3)
             .Add(fOptionConflictView, 2, 3)

             .Add(commandMenuField->CreateLabelLayoutItem(), 0, 4)
             .Add(commandMenuField->CreateMenuBarLayoutItem(), 1, 4)
             .Add(fCommandConflictView, 2, 4)
             .End()
             .AddGlue()
             .AddGroup(B_HORIZONTAL)
             .Add(fCancelButton)
             .AddGlue()
             .Add(fRevertButton)
             .Add(fOkButton)
             .End()
             .SetInsets(B_USE_DEFAULT_SPACING)
            );

    _MarkMenuItems();
    _ValidateDuplicateKeys();

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

示例9: invalid_rect

static BRect invalid_rect()
{
	return BRect(-1, -1, -1, -1);
}
开发者ID:HaikuArchives,项目名称:Sequitur,代码行数:4,代码来源:SeqToolBarView.cpp

示例10: HWindow

HApp::HApp() :BApplication(APP_SIG)
{
	HWindow *win = new HWindow(BRect(50,50,300,300),"IconMenu");
	win->Show();
}	
开发者ID:BackupTheBerlios,项目名称:haiku-pim-svn,代码行数:5,代码来源:HApp.cpp

示例11: find_directory

// fill out the icon with the stop symbol from app_server
void
ConflictView::_FillSavedIcon()
{
    // return if the fSavedIcon has already been filled out
    if (fSavedIcon != NULL && fSavedIcon->InitCheck() == B_OK)
        return;

    BPath path;
    status_t status = find_directory(B_BEOS_SERVERS_DIRECTORY, &path);
    if (status < B_OK) {
        FTRACE((stderr,
                "_FillWarningIcon() - find_directory failed: %s\n",
                strerror(status)));
        delete fSavedIcon;
        fSavedIcon = NULL;
        return;
    }

    path.Append("app_server");
    BFile file;
    status = file.SetTo(path.Path(), B_READ_ONLY);
    if (status < B_OK) {
        FTRACE((stderr,
                "_FillWarningIcon() - BFile init failed: %s\n",
                strerror(status)));
        delete fSavedIcon;
        fSavedIcon = NULL;
        return;
    }

    BResources resources;
    status = resources.SetTo(&file);
    if (status < B_OK) {
        FTRACE((stderr,
                "_WarningIcon() - BResources init failed: %s\n",
                strerror(status)));
        delete fSavedIcon;
        fSavedIcon = NULL;
        return;
    }

    // Allocate the fSavedIcon bitmap
    fSavedIcon = new(std::nothrow) BBitmap(BRect(0, 0, 15, 15), 0, B_RGBA32);
    if (fSavedIcon->InitCheck() < B_OK) {
        FTRACE((stderr, "_WarningIcon() - No memory for warning bitmap\n"));
        delete fSavedIcon;
        fSavedIcon = NULL;
        return;
    }

    // Load the raw stop icon data
    size_t size = 0;
    const uint8* rawIcon;
    rawIcon = (const uint8*)resources.LoadResource(B_VECTOR_ICON_TYPE,
              "stop", &size);

    // load vector warning icon into fSavedIcon
    if (rawIcon == NULL
            || BIconUtils::GetVectorIcon(rawIcon, size, fSavedIcon) < B_OK) {
        delete fSavedIcon;
        fSavedIcon = NULL;
    }
}
开发者ID:RAZVOR,项目名称:haiku,代码行数:64,代码来源:ModifierKeysWindow.cpp

示例12: switch

BBitmap *targatobbitmap(
	const unsigned char* targa, int targasize)
{
	BBitmap *bitmap;
	int idlength;
	int colormaptype;
	int imagetype;
	int height;
	int width;
	int depth;
	int imagedescriptor;
	int rowbytes;
	int bitssize;
	unsigned char *bits;
	const unsigned char *ptarga;
	unsigned char *pbits;
	int i,j,k;
	int count;
	unsigned char px0,px1,px2;
	
	idlength=targa[0];
	
	colormaptype=targa[1];
	if(colormaptype!=0) return NULL;
	
	imagetype=targa[2];
	if(imagetype!=2 && imagetype!=10) return NULL;
	
	width=targa[12]+(targa[13]<<8);
	height=targa[14]+(targa[15]<<8);
	
	depth=targa[16];
	if(depth!=24) return NULL;
	
	imagedescriptor=targa[17];
	if(imagedescriptor!=0) return NULL;
	
	rowbytes=3*width;
	bitssize=height*rowbytes;
	if(imagetype==2 
	&& 18+idlength+bitssize>targasize) return NULL;	
	
	bits=new unsigned char[bitssize];
	if(!bits) return NULL;

	ptarga=targa+18+idlength;
	
	switch(imagetype){
	case 2:
		pbits=bits+(height-1)*rowbytes;
		for(j=0;j<height;j++){
			for(i=0;i<width;i++){
				pbits[2]=*ptarga++;
				pbits[1]=*ptarga++;
				pbits[0]=*ptarga++;
				pbits+=3;
			}
			pbits-=2*rowbytes;
		}
		break;

		
	case 10:	//	RLE
		pbits=bits+(height-1)*rowbytes;
		for(j=0;j<height;j++){
			for(i=0;i<width;i+=count){
				count=*ptarga++;
				if(count&0x80){
					count&=0x7F;
					count++;
					if(i+count>width) count=width-i;
					px2=*ptarga++;
					px1=*ptarga++;
					px0=*ptarga++;
					for(k=0;k<count;k++){
						pbits[2]=px2;
						pbits[1]=px1;
						pbits[0]=px0;
						pbits+=3;
					}
				}else{
					count++;
					if(i+count>width) count=width-i;
					for(k=0;k<count;k++){
						pbits[2]=*ptarga++;
						pbits[1]=*ptarga++;
						pbits[0]=*ptarga++;
						pbits+=3;
					}
				}
			}
			pbits-=2*rowbytes;
		}
		break;
	}
	
	bitmap=new BBitmap(BRect(0,0,width-1,height-1),B_RGB_32_BIT);
	bitmap->SetBits(bits,bitssize,0,B_RGB_32_BIT);
	
	delete[] bits;
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:Stamina,代码行数:101,代码来源:targatobbitmap.cpp

示例13: GetMouse

/*=============================================================================================*\
|	Draw																						|
+-----------------------------------------------------------------------------------------------+
|	Effet: Redessine la view selon son status.													|
|																								|
\*=============================================================================================*/
void BeNetButton::Draw(BRect updateRect)
{
	BPoint pPointList[8];
	BPoint cursor;
	uint32 iButton;
	float leftBmp = 0;
	float topBmp = 0;
	float leftLab = 0;
	float topLab = 0;
	bool m_bBorderIn = false;
	bool m_bBorderOut = false;
	BFont font;
	
	GetMouse(&cursor, &iButton);
	
	m_bMouseOver = false;
	if(cursor.x >= 0 && cursor.x < Bounds().Width() && cursor.y >= 0 && cursor.y < Bounds().Height())
	{
		m_bMouseOver = true;
	}

	
	//Mode de dessinement utilisant seulement des bitmap.
	if(m_iDrawMode == BENET_DM_FULL_BMP || (m_iDrawMode == BENET_DM_TOGGLE && !m_bToggle))
	{
		SetDrawingMode(B_OP_COPY);
		//Le bouton est disable.
		if(!IsEnabled())
		{
			DrawBitmap(m_pBitmap, BRect(3 * Bounds().Width(),0, 4 * Bounds().Width()-1,Bounds().Height()-1), BRect(0,0,Bounds().Width()-1,Bounds().Height()-1));
		}	
	
		//Le boutton est enfoncer
		else if(Value())
		{
			DrawBitmap(m_pBitmap, BRect(2 * Bounds().Width(),0, 3 * Bounds().Width()-1,Bounds().Height()-1), BRect(0,0,Bounds().Width()-1,Bounds().Height()-1));
		}
		//La sourie est par dessus le bouton.
		else if(m_bMouseOver)
		{
			DrawBitmap(m_pBitmap, BRect(Bounds().Width(),0, 2 * Bounds().Width()-1,Bounds().Height()-1), BRect(0,0,Bounds().Width()-1,Bounds().Height()-1));
		}
		//boutton par defaut
		else
		{
			DrawBitmap(m_pBitmap, BRect(0,0,Bounds().Width()-1,Bounds().Height()-1), BRect(0,0,Bounds().Width()-1,Bounds().Height()-1));
		}

	}
	else if(m_iDrawMode == BENET_DM_TOGGLE && m_bToggle)
	{
		SetDrawingMode(B_OP_COPY);		//Le bouton est disable.
		if(!IsEnabled())
		{
			DrawBitmap(m_pBitmap, BRect(3 * Bounds().Width(),Bounds().Height(), 4 * Bounds().Width()-1,Bounds().Height()*2-1), BRect(0,0,Bounds().Width()-1,Bounds().Height()-1));
		}	
	
		//Le boutton est enfoncer
		else if(Value())
		{
			DrawBitmap(m_pBitmap, BRect(2 * Bounds().Width(),Bounds().Height(), 3 * Bounds().Width()-1,Bounds().Height()*2-1), BRect(0,0,Bounds().Width()-1,Bounds().Height()-1));
		}
		//La sourie est par dessus le bouton.
		else if(m_bMouseOver)
		{
			DrawBitmap(m_pBitmap, BRect(Bounds().Width(),Bounds().Height(), 2 * Bounds().Width()-1,Bounds().Height()*2-1), BRect(0,0,Bounds().Width()-1,Bounds().Height()-1));
		}
		//boutton par defaut
		else
		{
			DrawBitmap(m_pBitmap, BRect(0,Bounds().Height(),Bounds().Width()-1,Bounds().Height()*2-1), BRect(0,0,Bounds().Width()-1,Bounds().Height()-1));
		}


	}
	

	
	///////////////////////////
	
	// Debut de l'ancient mode de dessinement.
	else if(m_iDrawMode == BENET_DM_DEFAULT)
	{
		//Aller chercher les propriete du font.
		GetFont(&font);		
		font_height height;
		font.GetHeight(&height);
		
		//Trouver le coin superieur gauche du bitmap.
		if(m_bLabel)
		{
			topBmp = 2;
		}
		else
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:dengon-svn,代码行数:101,代码来源:BeNetButton.cpp

示例14: SetViewPanelBgColor

void
ThemeInterfaceView::AllAttached()
{
	BView::AllAttached();

	SetViewPanelBgColor();
	
	fThemeManager = new ThemeManager;

	BRect frame = Bounds();
	frame.InsetBy(10.0, 10.0);
	
	// add the theme listview
	BRect list_frame = frame;
	list_frame.right = 130;
	fThemeList = new BListView(list_frame.InsetByCopy(3.0, 3.0), "themelist");
	fThemeListSV = new BScrollView("themelistsv", fThemeList, B_FOLLOW_LEFT|B_FOLLOW_TOP, 0, false, true);
	AddChild(fThemeListSV);
	fThemeList->SetSelectionMessage(new BMessage(kThemeSelected));
	fThemeList->SetInvocationMessage(new BMessage(kApplyThemeBtn));
	fThemeList->SetTarget(this);

	// buttons...
	fNewBtn = new BButton(BRect(), "create", B_TRANSLATE("New"), new BMessage(kCreateThemeBtn));
	AddChild(fNewBtn);
	fNewBtn->SetTarget(this);
	fNewBtn->ResizeToPreferred();
	fNewBtn->MoveTo(fThemeListSV->Frame().right + 15.0, frame.bottom - fNewBtn->Bounds().Height());
	BPoint lt = fNewBtn->Frame().LeftTop();

	fNameText = new BTextControl(BRect(), "text", "", "My Theme", new BMessage(kCreateThemeBtn));
	AddChild(fNameText);
	fNameText->SetTarget(this);
	fNameText->ResizeToPreferred();
	// default is a bit small
	fNameText->ResizeBy(fNameText->Bounds().Width(), 0);
	fNameText->MoveTo(lt);
	fNameText->MoveBy(0, (fNewBtn->Bounds().Height() - fNameText->Bounds().Height()) / 2);
	//fNameText->MoveBy(0, - fNewBtn->Bounds().Height());
	fNameText->Hide();

	lt.x = fNewBtn->Frame().right + 10.0;
	fSaveBtn = new BButton(BRect(), "save", B_TRANSLATE("Save"), new BMessage(kSaveThemeBtn));
	AddChild(fSaveBtn);
	fSaveBtn->SetTarget(this);
	fSaveBtn->ResizeToPreferred();
	fSaveBtn->MoveTo(lt);

	lt.x = fSaveBtn->Frame().right + 10.0;
	fDeleteBtn = new BButton(BRect(), "delete", B_TRANSLATE("Delete"), new BMessage(kDeleteThemeBtn));
	AddChild(fDeleteBtn);
	fDeleteBtn->SetTarget(this);
	fDeleteBtn->ResizeToPreferred();
	fDeleteBtn->MoveTo(lt);

	// buttons...
	fSetShotBtn = new BButton(BRect(), "makeshot", B_TRANSLATE("Add screenshot"), new BMessage(kMakeScreenshot), B_FOLLOW_RIGHT | B_FOLLOW_TOP);
	AddChild(fSetShotBtn);
	fSetShotBtn->SetTarget(this);
	fSetShotBtn->ResizeToPreferred();
	
	fMoreThemesBtn = new BButton(BRect(), "getthemes", B_TRANSLATE("More themes"), new BMessage(skOnlineThemes), B_FOLLOW_RIGHT | B_FOLLOW_TOP);
	AddChild(fMoreThemesBtn);
	fMoreThemesBtn->SetTarget(this);
	fMoreThemesBtn->ResizeToPreferred();

	fDefaultsBtn = new BButton(BRect(), "defaults", B_TRANSLATE("Defaults"), new BMessage(B_PREF_APP_SET_DEFAULTS), B_FOLLOW_RIGHT | B_FOLLOW_TOP);
	AddChild(fDefaultsBtn);
	fDefaultsBtn->ResizeToPreferred();
	fDefaultsBtn->SetTarget(this);

	fApplyBtn = new BButton(BRect(), "apply", B_TRANSLATE("Apply"), new BMessage(kApplyThemeBtn), B_FOLLOW_RIGHT | B_FOLLOW_TOP);
	AddChild(fApplyBtn);
	fApplyBtn->ResizeToPreferred();
	fApplyBtn->SetTarget(this);

	float widest = max_c(fSetShotBtn->Bounds().Width(), fMoreThemesBtn->Bounds().Width());
	widest = max_c(widest, fDefaultsBtn->Bounds().Width());
	widest = max_c(widest, fApplyBtn->Bounds().Width());
	float height = fSetShotBtn->Bounds().Height();
	fSetShotBtn->ResizeTo(widest, height);
	fMoreThemesBtn->ResizeTo(widest, height);
	fDefaultsBtn->ResizeTo(widest, height);
	fApplyBtn->ResizeTo(widest, height);
	
	fSetShotBtn->MoveTo(frame.right - widest, frame.top + 5.0);
	fMoreThemesBtn->MoveTo(frame.right - widest, fSetShotBtn->Frame().bottom + 10.0);
	fApplyBtn->MoveTo(frame.right - widest, fNewBtn->Frame().top - fApplyBtn->Bounds().Height() - 10);
	fDefaultsBtn->MoveTo(frame.right - widest, fNewBtn->Frame().top - (fApplyBtn->Bounds().Height() + 10) * 2);

	// add the preview screen
	BRect preview_frame(fNewBtn->Frame().left, fThemeListSV->Frame().top, frame.right - widest - 10, fNewBtn->Frame().top - 10);

	fTabView = new BTabView(preview_frame, "tabs");
	fTabView->SetViewPanelBgColor();
	AddChild(fTabView);

	preview_frame = fTabView->ContainerView()->Bounds();

	fScreenshotTab = new BView(preview_frame, B_TRANSLATE("Screenshot"), B_FOLLOW_ALL, B_WILL_DRAW);
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:HaikuThemeManager,代码行数:101,代码来源:ThemeInterfaceView.cpp

示例15: BWindow

ScreenWindow::ScreenWindow(ScreenSettings* settings)
	:
	BWindow(settings->WindowFrame(), B_TRANSLATE_SYSTEM_NAME("Screen"),
		B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
		| B_AUTO_UPDATE_SIZE_LIMITS, B_ALL_WORKSPACES),
	fIsVesa(false),
	fBootWorkspaceApplied(false),
	fOtherRefresh(NULL),
	fScreenMode(this),
	fUndoScreenMode(this),
	fModified(false)
{
	BScreen screen(this);

	accelerant_device_info info;
	if (screen.GetDeviceInfo(&info) == B_OK
		&& !strcasecmp(info.chipset, "VESA"))
		fIsVesa = true;

	_UpdateOriginal();
	_BuildSupportedColorSpaces();
	fActive = fSelected = fOriginal;

	fSettings = settings;

	// we need the "Current Workspace" first to get its height

	BPopUpMenu *popUpMenu = new BPopUpMenu(B_TRANSLATE("Current workspace"),
		true, true);
	fAllWorkspacesItem = new BMenuItem(B_TRANSLATE("All workspaces"),
		new BMessage(WORKSPACE_CHECK_MSG));
	popUpMenu->AddItem(fAllWorkspacesItem);
	BMenuItem *item = new BMenuItem(B_TRANSLATE("Current workspace"),
		new BMessage(WORKSPACE_CHECK_MSG));

	popUpMenu->AddItem(item);
	fAllWorkspacesItem->SetMarked(true);

	BMenuField* workspaceMenuField = new BMenuField("WorkspaceMenu", NULL,
		popUpMenu);
	workspaceMenuField->ResizeToPreferred();

	// box on the left with workspace count and monitor view

	BBox* screenBox = new BBox("screen box");
	BGroupLayout* layout = new BGroupLayout(B_VERTICAL, 5.0);
	layout->SetInsets(10, 10, 10, 10);
	screenBox->SetLayout(layout);

	fMonitorInfo = new BStringView("monitor info", "");
	screenBox->AddChild(fMonitorInfo);

	fMonitorView = new MonitorView(BRect(0.0, 0.0, 80.0, 80.0),
		"monitor", screen.Frame().IntegerWidth() + 1,
		screen.Frame().IntegerHeight() + 1);
	screenBox->AddChild(fMonitorView);

	fColumnsControl = new BTextControl(B_TRANSLATE("Columns:"), "0",
		new BMessage(kMsgWorkspaceColumnsChanged));
	fRowsControl = new BTextControl(B_TRANSLATE("Rows:"), "0",
		new BMessage(kMsgWorkspaceRowsChanged));

	screenBox->AddChild(BLayoutBuilder::Grid<>(5.0, 5.0)
		.Add(new BStringView("", B_TRANSLATE("Workspaces")), 0, 0, 3)
		.AddTextControl(fColumnsControl, 0, 1, B_ALIGN_RIGHT)
		.AddGroup(B_HORIZONTAL, 0, 2, 1)
			.Add(_CreateColumnRowButton(true, false))
			.Add(_CreateColumnRowButton(true, true))
			.End()
		.AddTextControl(fRowsControl, 0, 2, B_ALIGN_RIGHT)
		.AddGroup(B_HORIZONTAL, 0, 2, 2)
			.Add(_CreateColumnRowButton(false, false))
			.Add(_CreateColumnRowButton(false, true))
			.End()
		.View());

	fBackgroundsButton = new BButton("BackgroundsButton",
		B_TRANSLATE("Set background" B_UTF8_ELLIPSIS),
		new BMessage(BUTTON_LAUNCH_BACKGROUNDS_MSG));
	fBackgroundsButton->SetFontSize(be_plain_font->Size() * 0.9);
	screenBox->AddChild(fBackgroundsButton);

	// box on the right with screen resolution, etc.

	BBox* controlsBox = new BBox("controls box");
	controlsBox->SetLabel(workspaceMenuField);
	BGroupView* outerControlsView = new BGroupView(B_VERTICAL, 10.0);
	outerControlsView->GroupLayout()->SetInsets(10, 10, 10, 10);
	controlsBox->AddChild(outerControlsView);

	fResolutionMenu = new BPopUpMenu("resolution", true, true);

	uint16 maxWidth = 0;
	uint16 maxHeight = 0;
	uint16 previousWidth = 0;
	uint16 previousHeight = 0;
	for (int32 i = 0; i < fScreenMode.CountModes(); i++) {
		screen_mode mode = fScreenMode.ModeAt(i);

		if (mode.width == previousWidth && mode.height == previousHeight)
//.........这里部分代码省略.........
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:101,代码来源:ScreenWindow.cpp


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