Exemplo n.º 1
0
void
set_tab_width(struct MyGadget *gd,int val)
{
	BTabView	*bt;
	WrkWindow	*wi;

	button_width tb;

	if (wi = (WrkWindow *)gd->pt->Window())
	{
		BAutolock tst(wi);

		if (bt = (BTabView *)((GadView *)gd->pt)->ChildAt(0))
		{
			switch(val)
			{
				case	0:	tb = B_WIDTH_FROM_WIDEST;	break;
				case	1:	tb = B_WIDTH_AS_USUAL;		break;
				case	2:	tb = B_WIDTH_FROM_LABEL;	break;
			}			

			bt->SetTabWidth(tb);			

			bt->Invalidate();

			gd->pt->Invalidate();
		}
	}
}
Exemplo n.º 2
0
void SeqPrefWin::AddViews(const BMessage& prefs)
{
	BRect		b = Bounds();
	/* Add the bottom panel with the Cancel OK buttons.  When this
	 * block is done, it will adjust the bounds accordingly (i.e.,
	 * without the space used by this view).
	 */
	{
		float		buttonW = 60, buttonH = 24;
		float		edgeR = 8, edgeB = 8, edgeT = 8;
		BRect		f(b);
		f.top = f.bottom - edgeB - buttonH - edgeT;
		BView*		v = new BView( f, "button_panel", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM, 0 );
		if( v ) {
			BRect		f( b.right - edgeR - buttonW, edgeT, b.right - edgeR, edgeT + buttonH );
			BButton*	button = new BButton( f, "ok_button", "OK", new BMessage( OK_MSG ), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM );
			if( button ) {
				v->AddChild( button );
				button->MakeDefault( true );
			}
			f.OffsetBy( 0-(buttonW + 10), 0 );	
			button = new BButton( f, "cancel_button", "Cancel", new BMessage( CANCEL_MSG ), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM );
			if( button ) v->AddChild( button );

			v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) );
			AddChild( v );
			b.bottom = b.bottom - edgeB - buttonH - edgeT - 1;
		}
	}
	BTabView*	tv = new BTabView(b, TABVIEW_STR);
	if (!tv) return;
	BView*		fileView = NewFileView(b, prefs);
	if (fileView) tv->AddTab(fileView);
	BView*		editView = NewEditView(b, prefs);
	if (editView) tv->AddTab(editView);
	BView*		playbackView = NewTrackView(b, prefs);
	if (playbackView) tv->AddTab(playbackView);
	mFactoryView = NewFactoriesView(b, prefs);
	if (mFactoryView) tv->AddTab(mFactoryView);

	AddChild(tv);
	/* NOTE:  Have to do this after the tab view's been added to the window or else
	 * you get a crash.  It's a bug in the tab view, nothing to be done about it.
	 */
	tv->SetTabWidth(B_WIDTH_FROM_WIDEST);
}