Exemplo n.º 1
0
void
_BMCMenuBar_::_Init()
{
	SetFlags(Flags() | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE);
	SetBorder(B_BORDER_CONTENTS);

	float left, top, right, bottom;
	GetItemMargins(&left, &top, &right, &bottom);

#if 0
	// TODO: Better fix would be to make BMenuItem draw text properly
	// centered
	font_height fontHeight;
	GetFontHeight(&fontHeight);
	top = ceilf((Bounds().Height() - ceilf(fontHeight.ascent)
		- ceilf(fontHeight.descent)) / 2) + 1;
	bottom = top - 1;
#else
	// TODO: Fix content location properly. This is just a quick fix to
	// make the BMenuField label and the super-item of the BMenuBar
	// align vertically.
	top++;
	bottom--;
#endif

	if (be_control_look != NULL)
		left = right = be_control_look->DefaultLabelSpacing();

	SetItemMargins(left, top,
		right + fShowPopUpMarker ? kPopUpIndicatorWidth : 0, bottom);
}
Exemplo n.º 2
0
TTeamMenu::TTeamMenu()
	:
	BMenu("Team Menu")
{
	SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
	SetFont(be_plain_font);
}
Exemplo n.º 3
0
TExpandoMenuBar::TExpandoMenuBar(TBarView* bar, BRect frame, const char* name,
	bool vertical, bool drawLabel)
	:
	BMenuBar(frame, name, B_FOLLOW_NONE,
		vertical ? B_ITEMS_IN_COLUMN : B_ITEMS_IN_ROW, vertical),
	fVertical(vertical),
	fOverflow(false),
	fDrawLabel(drawLabel),
	fIsScrolling(false),
	fShowTeamExpander(static_cast<TBarApp*>(be_app)->Settings()->superExpando),
	fExpandNewTeams(static_cast<TBarApp*>(be_app)->Settings()->expandNewTeams),
	fDeskbarMenuWidth(kDefaultDeskbarMenuWidth),
	fBarView(bar),
	fFirstApp(0),
	fPreviousDragTargetItem(NULL),
	fLastClickItem(NULL)
{
	SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
	SetFont(be_plain_font);
	if (fVertical)
		SetMaxContentWidth(sMinimumWindowWidth);
	else {
		// Make more room for the icon in horizontal mode
		int32 iconSize = static_cast<TBarApp*>(be_app)->IconSize();
		float maxContentWidth = sMinimumWindowWidth + iconSize
			- kMinimumIconSize;
		SetMaxContentWidth(maxContentWidth);
	}
}
Exemplo n.º 4
0
TWindowMenu::TWindowMenu(const BList* team, const char* signature)
	: BMenu("Deskbar Team Menu"),
	fTeam(team),
	fApplicationSignature(signature),
	fExpanded(false),
	fExpandedIndex(0)
{
	SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
}
Exemplo n.º 5
0
TBarMenuBar::TBarMenuBar(TBarView* bar, BRect frame, const char* name)
	: BMenuBar(frame, name, B_FOLLOW_NONE, B_ITEMS_IN_ROW, false),
	fBarView(bar),
	fAppListMenuItem(NULL)
{
	SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);

	TDeskbarMenu* beMenu = new TDeskbarMenu(bar);
	TBarWindow::SetDeskbarMenu(beMenu);

	fDeskbarMenuItem = new TBarMenuTitle(frame.Width(), frame.Height(),
		AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_LeafLogoBitmap), beMenu);
	AddItem(fDeskbarMenuItem);
}
Exemplo n.º 6
0
TExpandoMenuBar::TExpandoMenuBar(TBarView* bar, BRect frame, const char* name,
	bool vertical, bool drawLabel)
	:
	BMenuBar(frame, name, B_FOLLOW_NONE,
		vertical ? B_ITEMS_IN_COLUMN : B_ITEMS_IN_ROW, vertical),
	fVertical(vertical),
	fOverflow(false),
	fDrawLabel(drawLabel),
	fIsScrolling(false),
	fShowTeamExpander(static_cast<TBarApp*>(be_app)->Settings()->superExpando),
	fExpandNewTeams(static_cast<TBarApp*>(be_app)->Settings()->expandNewTeams),
	fBeMenuWidth(kDefaultBeMenuWidth),
	fBarView(bar),
	fFirstApp(0),
	fPreviousDragTargetItem(NULL),
	fLastClickItem(NULL)
{
	SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
	SetFont(be_plain_font);
	SetMaxContentWidth(sMinimumWindowWidth);
}
Exemplo n.º 7
0
TExpandoMenuBar::TExpandoMenuBar(TBarView *bar, BRect frame, const char *name,
	bool vertical, bool drawLabel)
	:	BMenuBar(frame, name, B_FOLLOW_NONE,
			vertical ? B_ITEMS_IN_COLUMN : B_ITEMS_IN_ROW, vertical),
	fVertical(vertical),
	fOverflow(false),
	fDrawLabel(drawLabel),
	fIsScrolling(false),
	fShowTeamExpander(static_cast<TBarApp *>(be_app)->Settings()->superExpando),
	fExpandNewTeams(static_cast<TBarApp *>(be_app)->Settings()->expandNewTeams),
	fBarView(bar),
	fFirstApp(0)
{
#ifdef DOUBLECLICKBRINGSTOFRONT
	fLastClickItem = -1;
	fLastClickTime = 0;
#endif

	SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);	
	//SetFont(be_plain_font); FIXME
	SetMaxContentWidth(kMinimumWindowWidth);
}
Exemplo n.º 8
0
TExpandoMenuBar::TExpandoMenuBar(TBarView* barView, bool vertical)
	:
	BMenuBar(BRect(0, 0, 0, 0), "ExpandoMenuBar", B_FOLLOW_NONE,
		vertical ? B_ITEMS_IN_COLUMN : B_ITEMS_IN_ROW),
	fBarView(barView),
	fVertical(vertical),
	fOverflow(false),
	fFirstBuild(true),
	fDeskbarMenuWidth(kMinMenuItemWidth),
	fPreviousDragTargetItem(NULL),
	fLastMousedOverItem(NULL),
	fLastClickedItem(NULL)
{
	SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
	SetFont(be_plain_font);
	SetMaxItemWidth();

	// top or bottom mode, add deskbar menu and sep for menubar tracking
	// consistency
	const BBitmap* logoBitmap = AppResSet()->FindBitmap(B_MESSAGE_TYPE,
		R_LeafLogoBitmap);
	if (logoBitmap != NULL)
		fDeskbarMenuWidth = logoBitmap->Bounds().Width() + 16;
}