ActivityView::ActivityView(const char* name, const BMessage* settings)
#ifdef __HAIKU__
	: BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS),
#else
	: BView(BRect(0, 0, 300, 200), name, B_FOLLOW_NONE,
		B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS),
#endif
	fSourcesLock("data sources")
{
	SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	_Init(settings);

	BRect rect(Bounds());
	rect.top = rect.bottom - kDraggerSize;
	rect.left = rect.right - kDraggerSize;
	BDragger* dragger = new BDragger(rect, this,
		B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
	AddChild(dragger);
}
BView *BassBoostFilter::ConfigView()
{
	BRect r(0,0,200,100);

	BView *view = new BView(r, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	r.InsetBy(8,8);
	r.bottom = r.top + 23;
	freq = new SpinSlider(r, NULL, Language.get("BB_FREQUENCY"), new BMessage(CONTROL_CHANGED), 1, 1000);
	freq->SetValue(Prefs.filter_bassboost_frequency);
	view->AddChild(freq);

	r.OffsetBy(0,40);
	boost = new SpinSlider(r, NULL, Language.get("BB_BOOST"), new BMessage(CONTROL_CHANGED), 0, 24);
	boost->SetValue(Prefs.filter_bassboost_boost);
	view->AddChild(boost);

	return view;
}
Exemple #3
0
void
_BMCMenuBar_::AttachedToWindow()
{
	fMenuField = static_cast<BMenuField*>(Parent());

	// Don't cause the KeyMenuBar to change by being attached
	BMenuBar* menuBar = Window()->KeyMenuBar();
	BMenuBar::AttachedToWindow();
	Window()->SetKeyMenuBar(menuBar);

	if (fFixedSize && (Flags() & B_SUPPORTS_LAYOUT) == 0)
		SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);

	if (Parent() != NULL)
		SetLowColor(Parent()->LowColor());
	else
		SetLowColor(ui_color(B_MENU_BACKGROUND_COLOR));

	fPreviousWidth = Bounds().Width();
}
Exemple #4
0
void PaneSwitch::Draw(BRect)
{
	if (fPressing)
		DrawInState(kPressed);
	else if (Value())
		DrawInState(kExpanded);
	else
		DrawInState(kCollapsed);

	rgb_color markColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
	
	bool focused = IsFocus() && Window()->IsActive();
	BRect bounds(Bounds());
	BeginLineArray(2);
	AddLine(BPoint(bounds.left + 2, bounds.bottom - 1),
		BPoint(bounds.right - 2, bounds.bottom - 1), focused ? markColor : ViewColor());
	AddLine(BPoint(bounds.left + 2, bounds.bottom),
		BPoint(bounds.right - 2, bounds.bottom), focused ? kWhite : ViewColor());
	EndLineArray();
}
Exemple #5
0
FontView::FontView()
	: BView("Fonts", B_WILL_DRAW )
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	fPlainView = new FontSelectionView("plain", B_TRANSLATE("Plain font:"));
	fBoldView = new FontSelectionView("bold", B_TRANSLATE("Bold font:"));
	fFixedView = new FontSelectionView("fixed", B_TRANSLATE("Fixed font:"));
	fMenuView = new FontSelectionView("menu", B_TRANSLATE("Menu font:"));

	BGridLayout* layout = new BGridLayout(5, 5);
	layout->SetInsets(10, 10, 10, 10);
	SetLayout(layout);

	int32 row = 0;
	add_font_selection_view(layout, fPlainView, row, true);
	add_font_selection_view(layout, fBoldView, row, true);
	add_font_selection_view(layout, fFixedView, row, true);
	add_font_selection_view(layout, fMenuView, row, false);
}
Exemple #6
0
void
ConflictView::Draw(BRect updateRect)
{
    // Draw background

    if (Parent())
        SetLowColor(Parent()->ViewColor());
    else
        SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));

    FillRect(updateRect, B_SOLID_LOW);

    // Draw icon
    if (fIcon == NULL)
        return;

    SetDrawingMode(B_OP_ALPHA);
    SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
    DrawBitmapAsync(fIcon, BPoint(0, 0));
}
Exemple #7
0
// constructor
AlphaSlider::AlphaSlider(orientation dir, BMessage* message)
	: BControl(dir == B_HORIZONTAL ? BRect(0, 0, 255 + 4, 7 + 4)
								   : BRect(0, 0, 7 + 4, 255 + 4),
			   "alpha slider", NULL, message,
								   
			   B_FOLLOW_NONE,
			   B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE),

	  fBitmap(NULL),
	  fColor(kBlack),
	  fDragging(false),
	  fOrientation(dir)
{
	FrameResized(Bounds().Width(), Bounds().Height());

	SetViewColor(B_TRANSPARENT_32_BIT);
	SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	SetValue(255);
}
BView *ReverbWindow::ConfigView()
{
	BRect r(0,0,200,100);

	BView *view = new BView(r, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	r.InsetBy(8,8);
	r.bottom = r.top + 23;
	delay = new SpinSlider(r, NULL, Language.get("DELAY_MS"), new BMessage(CONTROL_CHANGED), 1, 500);
	delay->SetValue(Prefs.filter_reverb_delay * 1000);
	view->AddChild(delay);

	r.OffsetBy(0,40);
	gain = new SpinSlider(r, NULL, Language.get("GAIN"), new BMessage(CONTROL_CHANGED), 1, 100);
	gain->SetValue(Prefs.filter_reverb_gain * 200);
	view->AddChild(gain);

	return view;
}
Exemple #9
0
void
TabView::DrawBackground(BView* owner, BRect frame, const BRect& updateRect,
	bool isFirst, bool isLast, bool isFront)
{
	rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
	uint32 borders = BControlLook::B_TOP_BORDER
		| BControlLook::B_BOTTOM_BORDER;

	if (isFirst)
		borders |= BControlLook::B_LEFT_BORDER;
	if (isLast)
		borders |= BControlLook::B_RIGHT_BORDER;
	if (isFront) {
		be_control_look->DrawActiveTab(owner, frame, updateRect, base,
			0, borders);
	} else {
		be_control_look->DrawInactiveTab(owner, frame, updateRect, base,
			0, borders);
	}
}
Exemple #10
0
void YabTabView::DrawBox(BRect selTabRect)
{
	BRect rect(Bounds());
	if(fTabOrientation == B_TAB_TOP)
		rect.top = selTabRect.bottom;
	else
		rect.bottom -= selTabRect.Height();

//		BRegion clipping(Bounds());
//		selTabRect.left += 2;
//		selTabRect.right -= 2;
//		clipping.Exclude(selTabRect);
//		ConstrainClippingRegion(&clipping);

	rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
	be_control_look->DrawGroupFrame(this, rect, rect, base);

//		ConstrainClippingRegion(NULL);

}
Exemple #11
0
void
TypeIconView::Draw(BRect updateRect)
{
	if (!IsEnabled())
		return;

	IconView::Draw(updateRect);

	const char* text = NULL;

	switch (IconSource()) {
		case kNoIcon:
			text = "no icon";
			break;
		case kApplicationIcon:
			text = "(from application)";
			break;
		case kSupertypeIcon:
			text = "(from super type)";
			break;

		default:
			return;
	}

	SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DISABLED_LABEL_TINT));
	SetLowColor(ViewColor());

	font_height fontHeight;
	GetFontHeight(&fontHeight);

	float y = fontHeight.ascent;
	if (IconSource() == kNoIcon) {
		// center text in the middle of the icon
		y += (IconSize() - fontHeight.ascent - fontHeight.descent) / 2.0f;
	} else
		y += IconSize() + 3.0f;

	DrawString(text, BPoint(ceilf((Bounds().Width() - StringWidth(text)) / 2.0f),
		ceilf(y)));
}
Exemple #12
0
void ContactItem::DrawItem(BView *owner, BRect itemRect, bool drawEverything)
{
	BString name = m_contact->FriendlyName();
	Status *status = m_contact->GetStatus();
	//draw status icon
	BBitmap *statusBitmap = status->GetStatusIcon();
	
	owner->SetDrawingMode(B_OP_OVER);
	float bitmapWidth = (statusBitmap->Bounds()).Width();
	BRect fillRect = itemRect;
	itemRect.left += bitmapWidth;

	//if selected
	if(IsSelected())
		owner->SetHighColor(ui_color(B_MENU_SELECTION_BACKGROUND_COLOR));
	else
		owner->SetHighColor(255,255,255);	
	owner->FillRect(fillRect);
	
	owner->SetDrawingMode(B_OP_ALPHA);
	if (statusBitmap)
		owner->DrawBitmap(statusBitmap, itemRect.LeftTop() + BPoint(0.0f,1.0f));
	
	//draw name(with emoticons)
	float textHeight = 12.0f;			
	BFont normal;
	owner->SetFont(&normal);
	owner->SetHighColor(0,0,0);
	owner->SetDrawingMode(B_OP_ALPHA);
	owner->DrawString(name.String(), itemRect.LeftTop() + BPoint(bitmapWidth + 5.0f, 1.0f + textHeight));
	//draw personal message, if available
	if (m_contact->HasPersonalMessage())
	{
		owner->DrawString(" - ");
		BFont italic;
		italic.SetFace(B_ITALIC_FACE); 
		owner->SetFont(&italic);	
		BString personalMessage = m_contact->PersonalMessage();
		owner->DrawString(personalMessage.String());
	}
}
ProjectView::ProjectView(BRect frame)
	: BView(frame, "ProjectView",
	        B_FOLLOW_ALL,
	        B_FULL_UPDATE_ON_RESIZE),
	  fPointer(0)
{
	// Create a new empty project
	fProject = new Project;

	// Set background color
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	BRect rect = Bounds();

	// Add timeline view
	rect.left = 128.0f;
	fTimeLineView = new TimeLineView(rect);
	fTimeLineView->ResizeToPreferred();
	AddChild(fTimeLineView);

	// Add tracks view
	rect.top = fTimeLineView->Bounds().Height();
	rect.right -= B_V_SCROLL_BAR_WIDTH;
	rect.bottom -= B_H_SCROLL_BAR_HEIGHT;
	fTracksView = new TracksView(rect);
	fTracksScrollView = new BScrollView("TracksScrollView", fTracksView,
		B_FOLLOW_ALL_SIDES, 0, true, true, B_NO_BORDER); 
	AddChild(fTracksScrollView);

	// Add scale slider
	rect.left = 0.0f;
	rect.top = Bounds().Height() - B_H_SCROLL_BAR_HEIGHT;
	rect.right = 127.0f;
	rect.bottom = Bounds().Height();
	fSlider = new BSlider(rect, "ScaleSlider", NULL,
		new BMessage(kScaleChanged), 10, 100, B_TRIANGLE_THUMB);
	fSlider->SetValue(DEFAULT_SCALE);
	fSlider->SetHashMarks(B_HASH_MARKS_TOP);
	fSlider->SetHashMarkCount(10);
	AddChild(fSlider);
}
void
BChannelSlider::_InitData()
{
	_UpdateFontDimens();

	fLeftKnob = NULL;
	fMidKnob = NULL;
	fRightKnob = NULL;
	fBacking = NULL;
	fBackingView = NULL;
	fIsVertical = Bounds().Width() / Bounds().Height() < 1;
	fClickDelta = B_ORIGIN;

	fCurrentChannel = -1;
	fAllChannels = false;
	fInitialValues = NULL;
	fMinPoint = 0;
	fFocusChannel = -1;

	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}
ControlView::ControlView(BRect rect)
    : BView(rect, "ControlView", B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE_JUMP),
      fMessenger(NULL),
      fMessageRunner(NULL),
      fTextControl(NULL),
      fFontMenuField(NULL),
      fFontsizeSlider(NULL),
      fShearSlider(NULL),
      fRotationSlider(NULL),
      fSpacingSlider(NULL),
      fOutlineSlider(NULL),
      fAliasingCheckBox(NULL),
      fBoundingboxesCheckBox(NULL),
      fCyclingFontButton(NULL),
      fFontFamilyMenu(NULL),
      fDrawingModeMenu(NULL),
      fCycleFonts(false),
      fFontStyleindex(0)
{
    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}
Exemple #16
0
BView *DelayWindow::ConfigView()
{
	BRect r(0,0,200,100);
	BView *view = new BView(r, "delayview", B_FOLLOW_ALL, B_WILL_DRAW);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	delay = new SpinSlider("delay", B_TRANSLATE("Delay (ms)"),
		new BMessage(CONTROL_CHANGED), 1, 500);
	delay->SetValue(Prefs.filter_delay_delay * 1000);

	gain = new SpinSlider("gain", B_TRANSLATE("Gain %"),
		new BMessage(CONTROL_CHANGED), 1, 200);
	gain->SetValue(Prefs.filter_delay_gain * 100);

	BLayoutBuilder::Group<>(view, B_VERTICAL, 2)
		.Add(delay, 0)
		.Add(gain, 1)
	.End();

	return view;
}
Exemple #17
0
void PickUserView::Draw(BRect rect)
{
	BRect r = Bounds();
	rgb_color black = { 0, 0, 0, 255 };
	rgb_color gray = ui_color(B_PANEL_BACKGROUND_COLOR);

	SetViewColor(gray);
	SetLowColor(gray);
	FillRect(r, B_SOLID_LOW);

	SetHighColor(black);
	SetFont(be_plain_font);
	SetFontSize(10);
	MovePenTo(10, 12);
	DrawString("Select a user from the list below, then click the OK button.");
	MovePenTo(10, 24);
	DrawString("Click the Cancel button to abort the selection.");

	MovePenTo(13, 43);
	DrawString("Users:");
}
SimpleColorPicker::SimpleColorPicker(rgb_color color)
	:
	ColorPickerView(color),
	fColor(color)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	fColorPreview = new ColorPreview(BRect(0, 0, 50, 50), "ColorPreview", "",
		new BMessage(kColorDropped));
	fColorPreview->SetExplicitAlignment(BAlignment(B_ALIGN_HORIZONTAL_CENTER,
		B_ALIGN_BOTTOM));

	fColorControl = new BColorControl(B_ORIGIN, B_CELLS_32x8,
		8.0, "ColorPicker", new BMessage(kColorChanged));

	BLayoutBuilder::Group<>(this, B_HORIZONTAL, 0)
		.Add(fColorPreview)
		.Add(BSpaceLayoutItem::CreateHorizontalStrut(B_USE_SMALL_SPACING))
		.Add(fColorControl)
		.End();
}
Exemple #19
0
void TextEntryAlertBackgroundView::Draw(BRect update_rect)
{
	if(update_rect.Intersects(m_entry_text_rect))
	{
		SetHighColor(m_dark_1_color);
		StrokeLine(BPoint(m_entry_text_rect.left,m_entry_text_rect.top),
			BPoint(m_entry_text_rect.right,m_entry_text_rect.top));
		StrokeLine(BPoint(m_entry_text_rect.left,m_entry_text_rect.top+1),
			BPoint(m_entry_text_rect.left,m_entry_text_rect.bottom));
		SetHighColor( ui_color(B_SHINE_COLOR));
		StrokeLine(BPoint(m_entry_text_rect.right,m_entry_text_rect.top+1),
			BPoint(m_entry_text_rect.right,m_entry_text_rect.bottom-1));
		StrokeLine(BPoint(m_entry_text_rect.left+1,m_entry_text_rect.bottom),
			BPoint(m_entry_text_rect.right,m_entry_text_rect.bottom));
		SetHighColor( BmWeakenColor(B_SHADOW_COLOR, BeShadowMod));
		StrokeLine(BPoint(m_entry_text_rect.left+1,m_entry_text_rect.top+1),
			BPoint(m_entry_text_rect.right-1,m_entry_text_rect.top+1));
		StrokeLine(BPoint(m_entry_text_rect.left+1,m_entry_text_rect.top+2),
			BPoint(m_entry_text_rect.left+1,m_entry_text_rect.bottom-1));
	}
}
Exemple #20
0
void
TBarView::AttachedToWindow()
{
	BView::AttachedToWindow();

	SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR));
	SetFont(be_plain_font);

	fReplicantTray = new TReplicantTray(this, fVertical);
	fDragRegion = new TDragRegion(this, fReplicantTray);
	fDragRegion->AddChild(fReplicantTray);
	if (fTrayLocation != 0)
		AddChild(fDragRegion);

	UpdateAutoRaise();
	UpdatePlacement();

	fTrackingHookData.fTrackingHook = MenuTrackingHook;
	fTrackingHookData.fTarget = BMessenger(this);
	fTrackingHookData.fDragMessage = new BMessage(B_REFS_RECEIVED);
}
Exemple #21
0
void
SoundListView::Draw(BRect updateRect)
{
	if (IsEmpty()) {
		SetLowColor(ViewColor());
		FillRect(Bounds(), B_SOLID_LOW);

		SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
		BFont font(be_bold_font);
		SetFont(&font);
		font_height height;
		font.GetHeight(&height);
		float width = font.StringWidth(B_TRANSLATE("Drop files here"));

		BPoint pt;
		pt.x = (Bounds().Width() - width) / 2;
		pt.y = (Bounds().Height() + height.ascent + height.descent)/ 2;
		DrawString(B_TRANSLATE("Drop files here"), pt);
	}
	BListView::Draw(updateRect);
}
void PatternToolItem::Draw(BRect updateRect)
{
    BButton::Draw(updateRect);
    SetDrawingMode(B_OP_OVER);
    BRect buttonFrame=BRect(0,0,17,17);
    if (Value() != B_CONTROL_ON)
    {
        buttonFrame.OffsetTo(4,4);
    }
    else
    {
        buttonFrame.OffsetTo(5,5);
        buttonFrame.bottom -=2;
        buttonFrame.right -=2;
    }
    SetLowColor(255,255,255,255);
    SetHighColor(0,0,0,255);
    FillRoundRect(buttonFrame,4,4,value);
    SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));
    StrokeRoundRect(buttonFrame,4,4);
}
Exemple #23
0
void
SeekSlider::DrawBar()
{
	BSlider::DrawBar();
	if (IsEnabled())
		return;

	BRect r(BarFrame());
	font_height fh;
	GetFontHeight(&fh);
	float width = ceilf(StringWidth(fDisabledString.String()));
	BPoint textPos;
	textPos.x = r.left + (r.Width() - width) / 2.0;
	textPos.y = (r.top + r.bottom - ceilf(fh.ascent + fh.descent)) / 2.0
		+ ceilf(fh.ascent);

	SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
		B_DARKEN_3_TINT));
	SetDrawingMode(B_OP_OVER);
	DrawString(fDisabledString.String(), textPos);
}
/*
 * Make inside state picture.
 */
BPicture*
HToolbarButton::MakeInsidePicture(BBitmap *in)
{
	HToolbar *toolbar = cast_as(Parent(),HToolbar);
	BRect buttonRect = toolbar->ButtonRect();
	BView *view = new BView(BRect(0,0,buttonRect.Width(),buttonRect.Height())
							,"offview",0,0);
	BBitmap *bitmap = new BBitmap(view->Bounds(), in->ColorSpace(), true);
	BPicture *pict;
	bitmap->AddChild(view);
	bitmap->Lock();
	view->SetDrawingMode(B_OP_ALPHA); 
	view->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
	view->BeginPicture(new BPicture); 
	
	DrawBitmap(view,in);
	DrawString(view,fName.String());
	
	//view->SetHighColor(White);
	//view->FillRect(BRect(0,0,0,22));
	//view->FillRect(BRect(0,0,22,0));
	//view->SetHighColor(BeShadow);
	//view->FillRect(BRect(21,0,21,21));
	//view->FillRect(BRect(0,21,21,21));
	BRect rect(Bounds());
	view->SetDrawingMode(B_OP_OVER); 
	rect.InsetBy(1,1);
	view->BeginLineArray(5);
	view->AddLine(rect.LeftTop(), rect.LeftBottom(),
			tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_MAX_TINT));
	view->AddLine(rect.LeftTop(), rect.RightTop(),
			tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_MAX_TINT));
	view->AddLine(rect.LeftBottom(), rect.RightBottom(),
			tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
	rect.bottom--;
	view->AddLine(rect.LeftBottom(), rect.RightBottom(),
			tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
	view->AddLine(rect.RightTop(), rect.RightBottom(),
			tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
	view->EndLineArray();
	
	view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
	view->StrokeRect(Bounds());
	pict = view->EndPicture();
	bitmap->Unlock();
	delete bitmap;
	return pict;
}
Exemple #25
0
void CPathItem::DrawItem(LView *owner, BRect bounds, bool /*complete*/)
{
	char buf[256];
	strncpy(buf, fPath, 255);
	buf[strlen(fPath)] = 0;

	TruncPathString(buf, 133, (int)Width());
	
	if (IsSelected())
		owner->SetLowColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT));
	else
		owner->SetLowColor(kWhite);
	
	owner->FillRect(bounds, B_SOLID_LOW);
	
	font_height fi;
	be_plain_font->GetHeight(&fi);
	
	owner->DrawString(buf, BPoint(bounds.left + 4, bounds.bottom - fi.descent));
	owner->SetLowColor(kWhite);
} // CPathItem::DrawItem
Exemple #26
0
BottomPrefsView::BottomPrefsView(BRect rect, const char *name) :
	BView(rect, name, B_FOLLOW_NONE, B_WILL_DRAW) {

	// Set the background color dynamically, don't hardcode 216, 216, 216
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	BRect r = Bounds();
	r.right -= 13;
	r.left = r.right - 75;
	r.top += 10;
	r.bottom = r.top + 24;
	BButton *ok = new BButton(r, "OKButton", "OK", new BMessage(PRV_BOTTOM_OK));
	AddChild(ok);
	
	r.right = r.left - 10;
	r.left = r.right - 75;
	BButton *defaults = new BButton(r, "DefaultsButton", "Defaults", new BMessage(PRV_BOTTOM_DEFAULTS));
	AddChild(defaults);
	
	ok->MakeDefault(true);
}
Exemple #27
0
Window::Window()
	: BWindow(BRect(100, 100, 520, 200), "StatusBar-Test",
			B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
{
	BView* main = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	main->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(main);

	BRect rect(20, 10, 400, 30);
	fStatusBar = new BStatusBar(rect, NULL, "label", "trailing label");
	fStatusBar->SetResizingMode(B_FOLLOW_LEFT_RIGHT);
	//fStatusBar->ResizeToPreferred();
	float width, height;
	fStatusBar->GetPreferredSize(&width, &height);
	fStatusBar->ResizeTo(rect.Width(), height);
	fStatusBar->SetMaxValue(50.0f);
	main->AddChild(fStatusBar);

	BMessage update(kMsgUpdate);
	fUpdater = new BMessageRunner(this, &update, 10000LL);
}
Exemple #28
0
PathBox::PathBox(const BRect &frame, const char *name, const char *path,
				const char *label, const int32 &resize, const int32 &flags)
 :	BView(frame,name,resize,flags),
 	fValidate(false)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	BMessenger msgr(this);
	BEntry entry(path);
	entry_ref ref;
	entry.GetRef(&ref);
	
	fFilePanel = new BFilePanel(B_OPEN_PANEL, &msgr, &ref, B_DIRECTORY_NODE | B_SYMLINK_NODE, false,
								new BMessage(M_ENTRY_CHOSEN));
	fFilePanel->SetButtonLabel(B_DEFAULT_BUTTON,"Select");
	
	fBrowseButton = new BButton(BRect(0,0,1,1),"browse","Browse…",
								new BMessage(M_SHOW_FILEPANEL),
								B_FOLLOW_RIGHT | B_FOLLOW_TOP);
	fBrowseButton->ResizeToPreferred();
	fBrowseButton->MoveTo( frame.right - fBrowseButton->Bounds().Width() - 10, 0);
	
	fPathControl = new DropControl(BRect(0,0,1,1),"path",label,path,
									new BMessage(M_PATHBOX_CHANGED),
									B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	
	float w,h;
	
	if (B_BEOS_VERSION <= B_BEOS_VERSION_5) {
		BWindow *win = new BWindow(BRect(100,100,400,400),"",B_TITLED_WINDOW,0);
		win->AddChild(fPathControl);
		fPathControl->GetPreferredSize(&w,&h);
		fPathControl->RemoveSelf();
		win->Quit();
	} else
		fPathControl->GetPreferredSize(&w,&h);
	fPathControl->ResizeTo(fBrowseButton->Frame().left - 20, h);
	AddChild(fPathControl);
	AddChild(fBrowseButton);
}
Exemple #29
0
OpenGLView::OpenGLView()
	: BView("OpenGLView", 0, NULL)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	SetLayout(new BGroupLayout(B_VERTICAL));

	const float kInset = 10;
	BRect dummy(0, 0, 2, 2);

	fGLView = new BGLView(dummy, (char*) "gl info", B_FOLLOW_NONE, 0,
		BGL_RGB | BGL_DOUBLE);
	fGLView->Hide();
	AddChild(fGLView);

	fGLView->LockGL();

	LogoView *logoView = new LogoView(dummy);

	BTabView *tabView = new BTabView("tab view", B_WIDTH_FROM_LABEL);

	InfoView *infoView = new InfoView();
	tabView->AddTab(infoView);

	CapabilitiesView *capabilitiesView = new CapabilitiesView();
	tabView->AddTab(capabilitiesView);

	ExtensionsView *extensionsView = new ExtensionsView();
	tabView->AddTab(extensionsView);

	fGLView->UnlockGL();

	AddChild(BGroupLayoutBuilder(B_VERTICAL)
		.Add(logoView)
		.Add(BGroupLayoutBuilder(B_HORIZONTAL)
			.Add(tabView)
			.SetInsets(kInset, kInset, kInset, kInset)
		)
	);
}
void
DownloadProgressView::DownloadCanceled()
{
	fDownload = NULL;
	fTopButton->SetLabel(B_TRANSLATE("Restart"));
	fTopButton->SetMessage(new BMessage(RESTART_DOWNLOAD));
	fTopButton->SetEnabled(true);
	fBottomButton->SetLabel(B_TRANSLATE("Remove"));
	fBottomButton->SetMessage(new BMessage(REMOVE_DOWNLOAD));
	fBottomButton->SetEnabled(true);
	fInfoView->SetText("");
	fStatusBar->SetBarColor(ui_color(B_FAILURE_COLOR));

	BNotification success(B_ERROR_NOTIFICATION);
	success.SetTitle(B_TRANSLATE("Download aborted"));
	success.SetContent(fPath.Leaf());
	// Don't make a click on the notification open the file: it is not complete
	success.SetIcon(fIconView->Bitmap());
	success.Send();

	fPath.Unset();
}