Example #1
0
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;

}
Example #2
0
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();
}
Example #3
0
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);
}
Example #4
0
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);
}
Example #5
0
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);
}
Example #6
0
		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();
		}
Example #7
0
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);
}
Example #8
0
	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());
	}
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);
}
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;
}
	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());
	}
Example #12
0
    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());
    }
Example #13
0
/*****************************************************************************
 * MessagesWindow::MessagesWindow
 *****************************************************************************/
MessagesWindow::MessagesWindow( intf_thread_t * _p_intf,
                                BRect frame, const char * name )
    : BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
               B_NOT_ZOOMABLE ),
    p_intf(_p_intf)
{
    SetSizeLimits( 400, 2000, 200, 2000 );

    p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL );
    
    BRect rect, textRect;

    rect = Bounds();
    rect.right -= B_V_SCROLL_BAR_WIDTH;
    textRect = rect;
    textRect.InsetBy( 5, 5 );
    fMessagesView = new MessagesView( p_sub,
                                      rect, "messages", textRect,
                                      B_FOLLOW_ALL, B_WILL_DRAW );
    fMessagesView->MakeEditable( false );
    fMessagesView->SetStylable( true );
    fScrollView = new BScrollView( "scrollview", fMessagesView, B_WILL_DRAW,
                                   B_FOLLOW_ALL, false, true );
    fMessagesView->fScrollBar = fScrollView->ScrollBar( B_VERTICAL );
    AddChild( fScrollView );
    
    /* start window thread in hidden state */
    Hide();
    Show();
}
Example #14
0
	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());
	}
Example #15
0
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);
}
Example #16
0
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();
}
Example #17
0
DocInfoWindow::DocInfoWindow(BMessage *docInfo)
	: HWindow(BRect(0, 0, 400, 250), "Document Information", B_TITLED_WINDOW_LOOK,
		B_MODAL_APP_WINDOW_FEEL, B_NOT_MINIMIZABLE),
	fDocInfo(docInfo)
{
	BRect bounds(Bounds());
	BView *background = new BView(bounds, "bachground", B_FOLLOW_ALL, B_WILL_DRAW);
	background->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(background);

	bounds.InsetBy(10.0, 10.0);
	BButton *button = new BButton(bounds, "ok", "OK", new BMessage(OK_MSG),
		B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
	background->AddChild(button);
	button->ResizeToPreferred();
	button->MoveTo(bounds.right - button->Bounds().Width(),
		bounds.bottom - button->Bounds().Height());

	BRect buttonFrame(button->Frame());
	button = new BButton(buttonFrame, "cancel", "Cancel", new BMessage(CANCEL_MSG),
		B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
	background->AddChild(button);
	button->ResizeToPreferred();
	button->MoveTo(buttonFrame.left - (button->Bounds().Width() + 10.0),
		buttonFrame.top);

	bounds.bottom = buttonFrame.top - 10.0;

#if HAVE_FULLVERSION_PDF_LIB
	BString permissions;
	if (_DocInfo()->FindString("permissions", &permissions) == B_OK)
		fPermissions.Decode(permissions.String());

	BTabView *tabView = new BTabView(bounds, "tabView");
	_SetupDocInfoView(_CreateTabPanel(tabView, "Information"));
	_SetupPasswordView(_CreateTabPanel(tabView, "Password"));
	_SetupPermissionsView(_CreateTabPanel(tabView, "Permissions"));

	background->AddChild(tabView);
#else
	BBox* panel = new BBox(bounds, "top_panel", B_FOLLOW_ALL,
		B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_NO_BORDER);

	_SetupDocInfoView(panel);
	background->AddChild(panel);
#endif

	if (fTable->ChildAt(0))
		fTable->ChildAt(0)->MakeFocus();

	BRect winFrame(Frame());
	BRect screenFrame(BScreen().Frame());
	MoveTo((screenFrame.right - winFrame.right) / 2,
		(screenFrame.bottom - winFrame.bottom) / 2);

	SetSizeLimits(400.0, 10000.0, 250.0, 10000.0);
}
Example #18
0
void
ScreenSaverWindow::SetMinimalSizeLimit(float width, float height)
{
	if (width < fMinWidth)
		width = fMinWidth;
	if (height < fMinHeight)
		height = fMinHeight;

	SetSizeLimits(width, 32767, height, 32767);
}
void ParameterWindow::_updateParameterView(
    BMediaTheme *theme) {
    D_INTERNAL(("ParameterWindow::_updateParameterView()\n"));

    // clear the old version
    if (m_parameters) {
        ParameterContainerView *view = dynamic_cast<ParameterContainerView *>(FindView("ParameterContainerView"));
        RemoveChild(view);
        delete m_parameters;
        m_parameters = 0;
        delete view;
    }

    // fetch ParameterWeb from the MediaRoster
    BMediaRoster *roster = BMediaRoster::CurrentRoster();
    if (roster) {
        BParameterWeb *web;
        status_t error = roster->GetParameterWebFor(m_node, &web);
        if (!error && (web->CountParameters() || web->CountGroups())) {
            // if no theme was specified, use the preferred theme
            if (!theme) {
                theme = BMediaTheme::PreferredTheme();
            }
            // acquire the view
            m_parameters = BMediaTheme::ViewFor(web, 0, theme);
            if (m_parameters) {
                BMenuBar *menuBar = KeyMenuBar();
                m_idealSize = m_parameters->Bounds();
                m_idealSize.right += B_V_SCROLL_BAR_WIDTH;
                m_idealSize.bottom += B_H_SCROLL_BAR_HEIGHT;
                if (menuBar) {
                    m_parameters->MoveTo(0.0, menuBar->Bounds().bottom + 1.0);
                    m_idealSize.bottom += menuBar->Bounds().bottom + 1.0;
                }
            }
        }
    }

    // limit min size to avoid funny-looking scrollbars
    float hMin = B_V_SCROLL_BAR_WIDTH*6, vMin = B_H_SCROLL_BAR_HEIGHT*3;
    // limit max size to full extents of the parameter view
    float hMax = m_idealSize.Width(), vMax = m_idealSize.Height();
    SetSizeLimits(hMin, hMax, vMin, vMax);

    // adapt the window to the new dimensions
    ResizeTo(m_idealSize.Width(), m_idealSize.Height());
    m_zoomed = true;

    if (m_parameters) {
        BRect paramRect = m_parameters->Bounds();
        AddChild(new ParameterContainerView(paramRect, m_parameters));
    }
}
void
PulseWindow::SetMode(int newmode)
{
	PulseApp *pulseapp = (PulseApp *)be_app;

	switch (newmode) {
		case PV_NORMAL_MODE:
			if (fMode == MINI_WINDOW_MODE) {
				pulseapp->prefs->mini_window_rect = Frame();
				pulseapp->prefs->window_mode = NORMAL_WINDOW_MODE;
				pulseapp->prefs->Save();
			}
			fMiniPulseView->Hide();
			fNormalPulseView->Show();
			fMode = NORMAL_WINDOW_MODE;
			SetType(B_TITLED_WINDOW);
			SetFlags(B_NOT_RESIZABLE | B_NOT_ZOOMABLE);
			ResizeTo(pulseapp->prefs->normal_window_rect.IntegerWidth(),
				pulseapp->prefs->normal_window_rect.IntegerHeight());
			MoveTo(pulseapp->prefs->normal_window_rect.left,
				pulseapp->prefs->normal_window_rect.top);
			MoveOnScreen();
			break;

		case PV_MINI_MODE:
			if (fMode == NORMAL_WINDOW_MODE) {
				pulseapp->prefs->normal_window_rect = Frame();
				pulseapp->prefs->window_mode = MINI_WINDOW_MODE;
				pulseapp->prefs->Save();
			}
			fNormalPulseView->Hide();
			fMiniPulseView->Show();
			fMode = MINI_WINDOW_MODE;
			SetLook(B_MODAL_WINDOW_LOOK);
			SetFeel(B_NORMAL_WINDOW_FEEL);
			SetFlags(B_NOT_ZOOMABLE);
			SetSizeLimits(GetMinimumViewWidth() - 1, 4096, 2, 4096);
			ResizeTo(pulseapp->prefs->mini_window_rect.IntegerWidth(),
				pulseapp->prefs->mini_window_rect.IntegerHeight());
			MoveTo(pulseapp->prefs->mini_window_rect.left,
				pulseapp->prefs->mini_window_rect.top);
			MoveOnScreen();
			break;

		case PV_DESKBAR_MODE:
			// Do not set window's mode to DESKBAR_MODE because the
			// destructor needs to save the correct BRect. ~PulseApp()
			// will handle launching the replicant after our prefs are saved.
			pulseapp->prefs->window_mode = DESKBAR_MODE;
			PostMessage(B_QUIT_REQUESTED);
			break;
	}
}
Example #21
0
void TStageWindow::Init()
{
	BFont font(be_fixed_font);

	m_StageView = new TStageView(Bounds(), this);

	// Limit the window size
	SetSizeLimits( 100, 1500, 100, 1500);
	        	
	// Add view to frame
	AddChild(m_StageView);
}
Example #22
0
ProtocolWindow::ProtocolWindow(BRect frame, const char *title, window_type type, int stream)
			:BWindow(frame, title, B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_PULSE_NEEDED|B_ASYNCHRONOUS_CONTROLS) {
	SetSizeLimits(300, 10000, 150, 10000);
	fStream=stream;
	mb=new BMenuBar(BRect(0,0,frame.Width(),1), _T("File")); // "TMI_FILE"
	mainM=new BMenu(_T("File")); // "TMI_FILE"
	clearMI=new BMenuItem(_T("Clear"), new BMessage(LOG_CLEAR), 'C'); // "TMI_CLEAR"
	closeMI=new BMenuItem(_T("Close"), new BMessage(B_QUIT_REQUESTED), 'W'); // ""TMI_CLOSE"
	
	logfileM=new BMenu(_T("Log file")); // "TMI_LOG_FILE"
	enablefileloggingMI=new BMenuItem(_T("Log to file"), // "TMI_ENABLE_LOG_FILE"
				new BMessage(ENABLE_LOG_FILE_MSG),'L');
				
	BString tmpstring;
	tmpstring << _T("Set file") << B_UTF8_ELLIPSIS; // "TMI_SETLOGFILENAME"
	setlognameMI=new BMenuItem( tmpstring.String(), new BMessage(SETLOGFILE_MSG));
	tmpstring = "";
	tmpstring << _T("Log settings") << B_UTF8_ELLIPSIS; // "TMI_SETLOGFILENAME"
	logsettingsMI=new BMenuItem( tmpstring.String(),
				new BMessage(LOGSETTINGS_MSG));
	
	contentView=new ProtocolView(BRect(0,0,frame.Width()-B_V_SCROLL_BAR_WIDTH, frame.Height()-(B_H_SCROLL_BAR_HEIGHT)), "contentView", BRect(1,1,2000,1000),B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW | B_PULSE_NEEDED, fStream);
	scrollView=new BScrollView("scrollView", contentView, B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP_BOTTOM, 0, true, true, B_NO_BORDER);
	AddChild(scrollView);
	AddChild(mb);
	mb->AddItem(mainM);
	mainM->AddItem(clearMI);
	mainM->AddItem(closeMI);
	
	mb->AddItem(logfileM);
	logfileM->AddItem(enablefileloggingMI);
	logfileM->AddItem(setlognameMI);
	////////////////////////////////////////////////
	//logfileM->AddItem(logsettingsMI);
	
	logfileF=new BFile();
	logfilenameS="";
	datewritten=false;

//	contentView=new BTextView(BRect(0,0,frame.Width()-B_V_SCROLL_BAR_WIDTH, frame.Height()-B_H_SCROLL_BAR_HEIGHT), "contentView", frame,B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
//	scrollView=new BScrollView("scrollView", contentView, B_FOLLOW_ALL_SIDES, 0, true, true);
	SetPulseRate(0);
//	reader_sem=create_sem(1, "ProtocolWindow(): reader_sem");
	SetLook(B_DOCUMENT_WINDOW_LOOK);
	contentView->MakeEditable(false);
	contentView->MakeResizable(false);
	contentView->SetStylable(true);
	
	MoveTo(40,40);
	contentView->MakeFocus(true);	
}
Example #23
0
TSignatureWindow::TSignatureWindow(BRect rect)
	: BWindow (rect, MDR_DIALECT_CHOICE ("Signatures","署名の編集"), B_TITLED_WINDOW, 0),
	fFile(NULL)
{
	BMenu		*menu;
	BMenuBar	*menu_bar;
	BMenuItem	*item;

	BRect r = Bounds();
	/*** Set up the menus ****/
	menu_bar = new BMenuBar(r, "MenuBar");
	menu = new BMenu(MDR_DIALECT_CHOICE ("Signature","S) 署名"));
	menu->AddItem(fNew = new BMenuItem(MDR_DIALECT_CHOICE ("New","N) 新規"), new BMessage(M_NEW), 'N'));
	fSignature = new TMenu(MDR_DIALECT_CHOICE ("Open","O) 開く"), INDEX_SIGNATURE, M_SIGNATURE);
	menu->AddItem(new BMenuItem(fSignature));
	menu->AddSeparatorItem();
	menu->AddItem(fSave = new BMenuItem(MDR_DIALECT_CHOICE ("Save","S) 保存"), new BMessage(M_SAVE), 'S'));
	menu->AddItem(fDelete = new BMenuItem(MDR_DIALECT_CHOICE ("Delete","T) 削除"), new BMessage(M_DELETE), 'T'));
	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE ("Close","W) 閉じる"), new BMessage(B_QUIT_REQUESTED), 'W'));
	menu_bar->AddItem(menu);

	menu = new BMenu(MDR_DIALECT_CHOICE ("Edit","E) 編集"));
	menu->AddItem(fUndo = new BMenuItem(MDR_DIALECT_CHOICE ("Undo","Z) やり直し"), new BMessage(B_UNDO), 'Z'));
	fUndo->SetTarget(NULL, this);
	menu->AddSeparatorItem();
	menu->AddItem(fCut = new BMenuItem(MDR_DIALECT_CHOICE ("Cut","X) 切り取り"), new BMessage(B_CUT), 'X'));
	fCut->SetTarget(NULL, this);
	menu->AddItem(fCopy = new BMenuItem(MDR_DIALECT_CHOICE ("Copy","C) コピー"), new BMessage(B_COPY), 'C'));
	fCopy->SetTarget(NULL, this);
	menu->AddItem(fPaste = new BMenuItem(MDR_DIALECT_CHOICE ("Paste","V) 貼り付け"), new BMessage(B_PASTE), 'V'));
	fPaste->SetTarget(NULL, this);
	menu->AddItem(item = new BMenuItem(MDR_DIALECT_CHOICE ("Select All","A) 全文選択"), new BMessage(M_SELECT), 'A'));
	item->SetTarget(NULL, this);
	menu_bar->AddItem(menu);

	AddChild(menu_bar);
	/**** Done with the menu set up *****/

	/**** Add on the panel, giving it the width and at least one vertical pixel *****/
	fSigView = new TSignatureView(BRect(0, menu_bar->Frame().bottom+1,
										rect.Width(), menu_bar->Frame().bottom+2));
	AddChild(fSigView);
	
	/* resize the window to the correct height */
	fSigView->SetResizingMode(B_FOLLOW_NONE);
	ResizeTo(rect.Width()-2, fSigView->Frame().bottom-2);
	fSigView->SetResizingMode(B_FOLLOW_ALL);

	SetSizeLimits(kSigWidth, RIGHT_BOUNDARY, r.top + 100, RIGHT_BOUNDARY);
}
Example #24
0
Window::Window()
	: BWindow(BRect(100, 100, 101, 101), "Test", /*B_TITLED_WINDOW*/ B_DOCUMENT_WINDOW
	/*B_BORDERED_WINDOW*/, B_NOT_ZOOMABLE /*| B_NOT_RESIZABLE*/)
{
	Show();

	snooze(500000);	// .5 secs

	Bounds().PrintToStream();
	ResizeTo(55, 55);
	Bounds().PrintToStream();

	snooze(500000);	// .5 secs

	SetSizeLimits(5, 500, 5, 500);
	ResizeTo(5, 5);
	Bounds().PrintToStream();

	snooze(500000);	// .5 secs

	SetSizeLimits(80, 500, 80, 500);	
	Bounds().PrintToStream();
}
MusicCollectionWindow::MusicCollectionWindow(BRect frame, const char* title)
	:
	BWindow(frame, title, B_DOCUMENT_WINDOW, B_AVOID_FRONT)
{
	BView* rootView = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	AddChild(rootView);
	rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	fQueryField = new BTextControl("Search: ", "", NULL);
	fQueryField->SetExplicitAlignment(BAlignment(B_ALIGN_HORIZONTAL_CENTER,
		B_ALIGN_USE_FULL_HEIGHT));
	fQueryField->SetModificationMessage(new BMessage(kMsgQueryInput));

	fCountView = new BStringView("Count View", "Count:");

	fFileListView = new MusicFileListView("File List View");
	fFileListView->SetInvocationMessage(new BMessage(kMsgItemInvoked));
	BScrollView* scrollView = new BScrollView("list scroll", fFileListView, 0,
		true, true, B_PLAIN_BORDER);

	float spacing = be_control_look->DefaultItemSpacing() / 2;
	BALMLayout* layout = new BALMLayout(spacing);
	layout->SetInset(spacing);
	rootView->SetLayout(layout);

	layout->AddView(fQueryField, layout->Left(), layout->Top());
	layout->AddViewToRight(fCountView, layout->Right());
	layout->AddView(scrollView, layout->Left(),
		layout->AreaFor(fQueryField)->Bottom(), layout->Right(),
		layout->Bottom());

	Area* area = layout->AreaFor(scrollView);
	area->SetLeftInset(0);
	area->SetRightInset(0);
	area->SetBottomInset(0);

	BSize min = layout->MinSize();
	BSize max = layout->MaxSize();
	SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());

	fEntryViewInterface = new ListViewListener<FileListItem>(fFileListView,
		fCountView);
	fQueryHandler = new QueryHandler(fEntryViewInterface);
	AddHandler(fQueryHandler);
	fQueryReader = new QueryReader(fQueryHandler);
	fQueryHandler->SetReadThread(fQueryReader);

	// start initial query
	PostMessage(kMsgQueryInput);
}
Example #26
0
void
OpenWithContainerWindow::RestoreWindowState(AttributeStreamNode* node)
{
	SetSizeLimits(fMinimalWidth, 10000, 160, 10000);
	if (node == NULL)
		return;

	const char* rectAttributeName = kAttrWindowFrame;
	BRect frame(Frame());
	if (node->Read(rectAttributeName, 0, B_RECT_TYPE, sizeof(BRect), &frame)
			== sizeof(BRect)) {
		MoveTo(frame.LeftTop());
		ResizeTo(frame.Width(), frame.Height());
	}
}
Example #27
0
void
TFilePanel::RestoreWindowState(AttributeStreamNode* node)
{
	SetSizeLimits(360, 10000, 200, 10000);
	if (!node)
		return;

	const char* rectAttributeName = kAttrWindowFrame;
	BRect frame(Frame());
	if (node->Read(rectAttributeName, 0, B_RECT_TYPE, sizeof(BRect), &frame)
		== sizeof(BRect)) {
		MoveTo(frame.LeftTop());
		ResizeTo(frame.Width(), frame.Height());
	}
}
Example #28
0
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
CalcWindow::CalcWindow(BPoint pt)
		: BWindow(CalcView::TheRect(pt), "Calculator",
				  B_TITLED_WINDOW, B_NOT_H_RESIZABLE)
{
	BRect r = CalcView::TheRect();

	SetSizeLimits(r.right, r.right, r.bottom, r.bottom+CalcView::ExtraHeight());
	SetZoomLimits(r.right, r.bottom+CalcView::ExtraHeight());

	calc_view = new CalcView(r);
	AddChild(calc_view);

	BView *extraView = calc_view->AddExtra();
	AddChild(extraView);
}
Example #29
0
/*****************************************************************************
 * VideoWindow constructor and destructor
 *****************************************************************************/
VideoWindow::VideoWindow(int v_width, int v_height, BRect frame,
                         vout_thread_t *p_videoout)
    : BWindow(frame, NULL, B_TITLED_WINDOW, B_NOT_CLOSABLE | B_NOT_MINIMIZABLE),
      i_width(frame.IntegerWidth()),
      i_height(frame.IntegerHeight()),
      winSize(frame),
      i_buffer(0),
      teardownwindow(false),
      fTrueWidth(v_width),
      fTrueHeight(v_height),
      fCachedFeel(B_NORMAL_WINDOW_FEEL),
      fInterfaceShowing(false),
      fInitStatus(B_ERROR),
      fSettings(new VideoSettings(*VideoSettings::DefaultSettings()))
{
    p_vout = p_videoout;

    // create the view to do the display
    view = new VLCView( Bounds(), p_vout );

    // create background view
    BView *mainView =  new BackgroundView( Bounds(), view );
    AddChild(mainView);
    mainView->AddChild(view);

    // allocate bitmap buffers
    for (int32_t i = 0; i < 3; i++)
        bitmap[i] = NULL;
    fInitStatus = _AllocateBuffers(v_width, v_height, &mode);

    // make sure we layout the view correctly
    FrameResized(i_width, i_height);

    if (fInitStatus >= B_OK && mode == OVERLAY)
    {
       overlay_restrictions r;

       bitmap[0]->GetOverlayRestrictions(&r);
       SetSizeLimits((i_width * r.min_width_scale), i_width * r.max_width_scale,
                     (i_height * r.min_height_scale), i_height * r.max_height_scale);
    }

    // vlc settings override settings from disk
    if (config_GetInt(p_vout, "fullscreen"))
        fSettings->AddFlags(VideoSettings::FLAG_FULL_SCREEN);

    _SetToSettings();
}
Example #30
0
		MyNetWindow(BRect frame) :
		  BWindow(frame, "My Network", B_TITLED_WINDOW, B_NOT_ZOOMABLE)
		{
			BRect r;

			r = Bounds();
			r.bottom = 85;
			headerView = new MyNetHeaderView(r);
			AddChild(headerView);

			CLVContainerView *containerView;
			r = Bounds();
			r.top = r.bottom - 140;
			r.bottom -= 40;

			MyColumnListView = new SmartColumnListView(r, &containerView, NULL, B_FOLLOW_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("Computer", 120.0, CLV_SORT_KEYABLE, 50.0));
			MyColumnListView->AddColumn(new CLVColumn("Share Name", 85.0, CLV_SORT_KEYABLE));
			MyColumnListView->AddColumn(new CLVColumn("Mounted At", 250.0, CLV_SORT_KEYABLE));

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

			AddCLVItems(MyColumnListView);
			AddChild(containerView);

			r = Bounds();
			r.top = 85;
			r.bottom -= 140;
			netView = new MyNetView(r);
			AddChild(netView);

			r = Bounds();
			r.top = r.bottom - 40;
			shareView = new MyShareOptionView(r);
			AddChild(shareView);

			SetSizeLimits(400, 2000, 270, 2000);

			Show();
		}