Example #1
0
LoginView::LoginView(BRect rect, char *server, char *share) :
  BView(rect, "LoginView", B_FOLLOW_ALL, B_WILL_DRAW)
{
	strcpy(resource, share);
	strcat(resource, " on ");
	strcat(resource, server);

	rgb_color gray = ui_color(B_PANEL_BACKGROUND_COLOR);
	SetViewColor(gray);

	BRect bmpRect(0.0, 0.0, 31.0, 31.0);
	icon = new BBitmap(bmpRect, B_CMAP8);
	BMimeType mime("application/x-vnd.Teldar-FileSharing");
	mime.GetIcon(icon, B_LARGE_ICON);

	BRect r(10, 72, 240, 92);
	user = new BTextControl(r, "User", "User:"******"", NULL);
	user->SetDivider(55);
	AddChild(user);

	r.top = 97;
	r.bottom = r.top + 20;
	password = new BTextControl(r, "Password", "Password:"******"", NULL);
	password->SetDivider(55);
	password->TextView()->HideTyping(true);
	AddChild(password);

	r.Set(LOGIN_PANEL_WIDTH - 160, LOGIN_PANEL_HEIGHT - 33, LOGIN_PANEL_WIDTH - 90, LOGIN_PANEL_HEIGHT - 13);
	BButton *okBtn = new BButton(r, "OkayBtn", "Login", new BMessage(MSG_LOGIN_OK), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
	okBtn->MakeDefault(true);
	AddChild(okBtn);

	r.Set(LOGIN_PANEL_WIDTH - 80, LOGIN_PANEL_HEIGHT - 33, LOGIN_PANEL_WIDTH - 10, LOGIN_PANEL_HEIGHT - 13);
	AddChild(new BButton(r, "CancelBtn", "Cancel", new BMessage(MSG_LOGIN_CANCEL), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM));
}
void
SetupView::AttachedToWindow()
{
	float width = MAX(StringWidth(SERVER_TEXT), StringWidth(QUEUE_TEXT)) + 10;

	/* server name box */

	fServerAddress = new BTextControl(SERVER_RECT, "", SERVER_TEXT, "<printer's hostname or address>", NULL);
	AddChild(fServerAddress);
	fServerAddress->SetDivider(width);

	/* queue name box */

	fQueuePort = new BTextControl(QUEUE_RECT, "", QUEUE_TEXT, "9100", NULL);	// 9100 is default HP JetDirect port number
	AddChild(fQueuePort);
	fQueuePort->SetDivider(width);

	/* cancel */

	BButton* button = new BButton(CANCEL_RECT, "", CANCEL_TEXT, new BMessage(M_CANCEL));
	AddChild(button);

	/* ok */

	button = new BButton(OK_RECT, "", OK_TEXT, new BMessage(M_OK));
	AddChild(button);
	button->MakeDefault(true);
}
Example #3
0
MainView::MainView( BRect frame ) : BView (frame, "mainView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW) {

	SetViewColor(216, 216, 216);

	// nutzbare Größe
	frame.OffsetTo( 0.0, 0.0 );
	frame.InsetBy( 5.0, 5.0 );
	
	// Erstellen der beiden inneren Frames
	TopView* topView = new TopView( BRect( frame.left, frame.top, frame.right, frame.bottom - 72.0 - be_plain_font->Size() - be_bold_font->Size() ) );
	AddChild( topView );

	BottomView* bottomView = new BottomView( BRect( frame.left, frame.bottom - 67.0 - be_plain_font->Size() - be_bold_font->Size(), frame.right, frame.bottom - 43.0 ) );
	AddChild( bottomView );

	// StatusBar
	BStatusBar*	statusBar	= new BStatusBar( BRect(frame.left + 5.0, frame.bottom - be_plain_font->Size() - 23.0, frame.left + 400.0, frame.bottom), "statusBar", STATUS_STATUS, NULL);
	statusBar->SetText(STATUS_SELECT_FILES);
	statusBar->SetResizingMode(B_FOLLOW_BOTTOM);
	rgb_color color = { 70, 100, 180, 255};
	statusBar->SetBarColor(color);
	statusBar->SetBarHeight(14.0);
	AddChild(statusBar);
	
	// Do it! - Button
	BButton* DoItButton = new BButton( BRect ( frame.right - be_plain_font->StringWidth(STR_DO_IT) - 25.0, frame.bottom - 30.0, frame.right - 5.0 , frame.bottom - 5.0 ), "DoIt", STR_DO_IT, new BMessage(MSG_DO_IT), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM );
	DoItButton->SetEnabled(false);
	AddChild(DoItButton);
};
Example #4
0
		InetHostView(BRect rect) :
		  BView(rect, "InetHostView", B_FOLLOW_ALL, B_WILL_DRAW)
		{
			rgb_color gray = ui_color(B_PANEL_BACKGROUND_COLOR);
			SetViewColor(gray);

			BRect bmpRect(0.0, 0.0, 31.0, 31.0);
			icon = new BBitmap(bmpRect, B_CMAP8);
			BMimeType mime("application/x-vnd.BeServed-inetserver");
			mime.GetIcon(icon, B_LARGE_ICON);

			BRect r(10, 52, 310, 72);
			editName = new BTextControl(r, "ShareName", "Name or Address:", "", NULL);
			editName->SetDivider(90);
			AddChild(editName);

			r.Set(155, 97, 225, 117);
			BButton *okBtn = new BButton(r, "OkayBtn", "OK", new BMessage(MSG_HOST_OK), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
			okBtn->MakeDefault(true);
			AddChild(okBtn);

			r.Set(235, 97, 310, 117);
			AddChild(new BButton(r, "CancelBtn", "Cancel", new BMessage(MSG_HOST_CANCEL), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM));

			editName->MakeFocus();
		}
Example #5
0
	LoadLayoutArchiveWindow(BRect frame) 
		:
		BWindow(frame, "Layout Loaded From Archive", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE
			| B_AUTO_UPDATE_SIZE_LIMITS)
	{
		fLayout = new BALMLayout(10, 10);
		BALM::BALMLayoutBuilder builder(this, fLayout);

		// Restore gui specifications. 
		BFile guiFile;
		_FindGUISpecifications(kGUIFileName, guiFile);

		LayoutArchive layoutArchive(fLayout);
		if (layoutArchive.RestoreFromFile(&guiFile) != B_OK) {
			BString text = "Can't find layout specification file: \"";
			text << kGUIFileName;
			text << "\"";
			BAlert* alert = new BAlert("Layout Specifications Not Found",
				text, "Quit");
			alert->Go();
			PostMessage(B_QUIT_REQUESTED);
		}

		// Access the views in the layout.

		BButton* button = layoutArchive.FindView<BButton>("ButtonTest");
		if (button != NULL)
			button->SetLabel("Hey");

		BRadioButton* radioButton
			= layoutArchive.FindView<BRadioButton>("RadioButtonTest");
		if (radioButton != NULL)
			radioButton->SetLabel("World");
	}
Example #6
0
TView::TView(BRect frame, const char *name, uint32 resizingMode, uint32 flags)
		: BView(frame, name, resizingMode, flags)
{
	BFont font;

	BButton *btn = new BButton(BRect(10, 10, 150, 50), NULL, "Hello World", new BMessage(BTN_HELLO_WORLD_EN_MSG));
	btn->ForceFontAliasing(true);
	if (font.SetFamilyAndStyle("SimSun", "Regular") == B_OK) btn->SetFont(&font, B_FONT_FAMILY_AND_STYLE);
	btn->SetFontSize(20);
	AddChild(btn);

	btn = new BButton(BRect(10, 100, 50, 120), NULL, "Ciao Mondo", new BMessage(BTN_HELLO_WORLD_IT_MSG));
	btn->ForceFontAliasing(true);
	if (font.SetFamilyAndStyle("SimHei", "Regular") == B_OK) {
		btn->SetFont(&font, B_FONT_FAMILY_AND_STYLE);
		btn->SetFontSize(24);
	}
	AddChild(btn);
	btn->ResizeToPreferred();

	btn = new BButton(BRect(10, 150, 40, 180), NULL, "Disabled", new BMessage(BTN_NOT_ENABLED_MSG));
	btn->SetEnabled(false);
	AddChild(btn);
	btn->ResizeToPreferred();
}
GroupPropertiesView::GroupPropertiesView(BRect rect, const char *name) :
    BView(rect, "GroupInfoView", B_FOLLOW_ALL, B_WILL_DRAW)
{
    newGroup = name == NULL;
    strcpy(group, newGroup ? "unknown" : name);
    getGroupDesc(group, desc, sizeof(desc));

    rgb_color gray = ui_color(B_PANEL_BACKGROUND_COLOR);
    SetViewColor(gray);

    BRect bmpRect(0.0, 0.0, 31.0, 31.0);
    icon = new BBitmap(bmpRect, B_CMAP8);
    BMimeType mime("application/x-vnd.Teldar-Group");
    mime.GetIcon(icon, B_LARGE_ICON);

    BRect r(10, 52, 200, 72);
    editName = new BTextControl(r, "GroupName", "Name:", group, NULL);
    editName->SetDivider(70);
    editName->SetEnabled(newGroup);
    AddChild(editName);

    r.Set(10, 77, 250, 97);
    editDesc = new BTextControl(r, "Description", "Description:", desc, NULL);
    editDesc->SetDivider(70);
    AddChild(editDesc);

    r.Set(205, 320, 275, 340);
    BButton *okBtn = new BButton(r, "OkayBtn", "OK", new BMessage(MSG_GROUP_OK), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
    okBtn->MakeDefault(true);
    AddChild(okBtn);

    r.Set(285, 320, 360, 340);
    AddChild(new BButton(r, "CancelBtn", "Cancel", new BMessage(MSG_GROUP_CANCEL), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM));

    r.Set(285, 125, 360, 145);
    AddChild(new BButton(r, "AddUserBtn", "Add", new BMessage(MSG_GROUP_ADD), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM));

    r.Set(285, 155, 360, 175);
    removeBtn = new BButton(r, "RemoveBtn", "Remove", new BMessage(MSG_GROUP_REMOVE), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
    removeBtn->SetEnabled(false);
    AddChild(removeBtn);

    // Now add the membership list.
    CLVContainerView *listContView;
    r.Set(13, 125, 280 - B_V_SCROLL_BAR_WIDTH, 305);
    listView = new SmartColumnListView(r, &listContView, NULL, B_FOLLOW_ALL_SIDES,
                                       B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE, B_SINGLE_SELECTION_LIST,
                                       false, false, true, false, B_FANCY_BORDER);

    listView->AddColumn(new CLVColumn(NULL, 20.0, CLV_LOCK_AT_BEGINNING | CLV_NOT_MOVABLE |
                                      CLV_NOT_RESIZABLE | CLV_PUSH_PASS | CLV_MERGE_WITH_RIGHT));
    listView->AddColumn(new CLVColumn("User", 85.0, CLV_SORT_KEYABLE, 50.0));
    listView->AddColumn(new CLVColumn("Full Name", 130.0, CLV_SORT_KEYABLE));

    listView->SetSelectionMessage(new BMessage(MSG_MEMBER_SELECT));
    listView->SetInvocationMessage(new BMessage(MSG_LIST_DESELECT));

    AddGroupMembers(listView);
    AddChild(listContView);
}
Example #8
0
void _OwqList::AttachedToWindow()
{
	inherited::AttachedToWindow();
	if( mAdd ) mAdd->SetTarget( this );
	if( mChange ) mChange->SetTarget( this );
	if( mRemove ) mRemove->SetTarget( this );
}
Example #9
0
void
LprSetupView::AttachedToWindow()
{
	float width = max(StringWidth(SERVER_TEXT), StringWidth(QUEUE_TEXT)) + 10;

	/* server name box */

    // TODO remember previous value
	fServer = new BTextControl(SERVER_RECT, "", SERVER_TEXT, "192.168.0.0",
		NULL);
	AddChild(fServer);
	fServer->SetDivider(width);

	/* queue name box */

    // TODO remember previous value
	fQueue = new BTextControl(QUEUE_RECT, "", QUEUE_TEXT, "LPT1_PASSTHRU",
		NULL);
	AddChild(fQueue);
	fQueue->SetDivider(width);

	/* cancel */

	BButton *button = new BButton(CANCEL_RECT, "", CANCEL_TEXT,
		new BMessage(M_CANCEL));
	AddChild(button);

	/* ok */

	button = new BButton(OK_RECT, "", OK_TEXT, new BMessage(M_OK));
	AddChild(button);
	button->MakeDefault(true);
}
Example #10
0
// show_window
void
show_window(BRect frame, const char* name)
{
	BWindow* window = new BWindow(frame, name,
								  B_TITLED_WINDOW,
								  B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);

	BView* view = new TestView(window->Bounds(), "test", B_FOLLOW_ALL,
							   B_WILL_DRAW/* | B_FULL_UPDATE_ON_RESIZE*/);

	window->AddChild(view);
	BRect b(0.0, 0.0, 50.0, 15.0);
	b.OffsetTo(5.0, view->Bounds().bottom - (b.Height() + 15.0));
	BButton* control = new BButton(b, "button", "Copy", new BMessage(MSG_COPY_BITS));
	view->AddChild(control);
	control->SetTarget(view);

	// test CopyBits() on top of children
	b = BRect(80, 130, 130, 160);
	BView* child = new BView(b, "some child", B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, 0);
	child->SetViewColor(255, 0, 0);
	view->AddChild(child);

	b = BRect(136, 127, 158, 140);
	child = new BView(b, "some other child", B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, 0);
	child->SetViewColor(255, 255, 0);
	view->AddChild(child);

	window->Show();
}
Example #11
0
Tearoff::Tearoff(BRect frame, const char *name, MainWindow *parent, MenuName menu_name, int idx)
	: BWindow(frame, name, B_FLOATING_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE, 0)
{
	int y = 0;
	BFont font;
	BMenu *menu;
	
	this->parent = parent;
	menu = parent->GetMenu(menu_name);
	menu->GetFont(&font);
	for(int i = 1; i < menu->CountItems(); i++) {
		BMenuItem *item = menu->ItemAt(i);
		if(item->Message()) {
			BButton *b = new BButton(BRect(0, y, frame.IntegerWidth(), y + TEAROFF_BUTTON_HEIGHT), "", item->Label(), new BMessage(item->Message()->what), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW); 
			font.SetSize(TEAROFF_FONT_SIZE);
			b->SetFont(&font);
			AddChild(b);
			y = y + TEAROFF_BUTTON_HEIGHT;
		}
	}
	this->ResizeTo(frame.IntegerWidth(), y);
	this->SetTitle(menu->Name());
	this->index = idx;
	delete menu;
}
Example #12
0
status_t addon_init (uint32 index, becasso_addon_info *info)
{
	strcpy (info->name, "CaptureTest");
	strcpy (info->author, "Sander Stoks");
	strcpy (info->copyright, "© 1998-2001 ∑ Sum Software");
	strcpy (info->description, "Fake Capture add-on");
	info->type				= BECASSO_CAPTURE;
	info->index				= index;
	info->version			= 1;
	info->release			= 2;
	info->becasso_version	= 2;
	info->becasso_release	= 0;
	info->does_preview		= 0;
	info->flags				= 0;
	window = new CaptureWindow (BRect (100, 180, 100 + 188, 180 + 72));
	BView *bg = new BView (BRect (0, 0, 188, 72), "bg", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
	bg->SetViewColor (LightGrey);
	window->AddChild (bg);
	BMessage *msg = new BMessage (CAPTURE_READY);
	msg->AddInt32 ("index", index);
	BButton *grab = new BButton (BRect (128, 40, 180, 64), "grab", "Grab", msg);
	grab->SetTarget (be_app);
	bg->AddChild (grab);
	window->Run();
	return (0);
}
Example #13
0
TStatusWindow::TStatusWindow(BRect rect, BMessenger target, const char* status)
	: BWindow(rect, "", B_MODAL_WINDOW, B_NOT_RESIZABLE),
	fTarget(target)
{
	BView* view = new BView(Bounds(), "", B_FOLLOW_ALL, B_WILL_DRAW);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(view);

	BRect r(STATUS_FIELD_H, STATUS_FIELD_V,
		STATUS_FIELD_WIDTH, STATUS_FIELD_V + STATUS_FIELD_HEIGHT);

	fStatus = new BTextControl(r, "", STATUS_TEXT, status, new BMessage(STATUS));
	view->AddChild(fStatus);

	fStatus->SetDivider(fStatus->StringWidth(STATUS_TEXT) + 6);
	fStatus->BTextControl::MakeFocus(true);

	r.Set(S_OK_BUTTON_X1, S_OK_BUTTON_Y1, S_OK_BUTTON_X2, S_OK_BUTTON_Y2);
	BButton *button = new BButton(r, "", S_OK_BUTTON_TEXT, new BMessage(OK));
	view->AddChild(button);
	button->MakeDefault(true);

	r.Set(S_CANCEL_BUTTON_X1, S_CANCEL_BUTTON_Y1, S_CANCEL_BUTTON_X2, S_CANCEL_BUTTON_Y2);
	button = new BButton(r, "", S_CANCEL_BUTTON_TEXT, new BMessage(CANCEL));
	view->AddChild(button);

	Show();
}
Example #14
0
BButton*
BAlert::_CreateButton(int32 which, const char* label)
{
	BMessage* message = new BMessage(kAlertButtonMsg);
	if (message == NULL)
		return NULL;

	message->AddInt32("which", which);

	BRect rect;
	rect.top = Bounds().bottom - kBottomOffset;
	rect.bottom = rect.top;

	char name[32];
	snprintf(name, sizeof(name), "_b%ld_", which);

	BButton* button = new(std::nothrow) BButton(rect, name, label, message,
		B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
	if (button == NULL)
		return NULL;

	float width, height;
	button->GetPreferredSize(&width, &height);

	if (fButtonWidth == B_WIDTH_AS_USUAL) {
		float fontFactor = be_plain_font->Size() / 11.0f;
		width = max_c(width, kButtonUsualWidth * fontFactor);
	}

	button->ResizeTo(width, height);
	button->MoveBy(0.0f, -height);
	return button;
}
// Stuff we can only do when the main view is attached to a window
void
OutputFormatView::AttachedToWindow()
{
	// Get the window and lock it
	the_window = Window();
	the_window->Lock();

	// Set some size limits on the window
	the_window->SetSizeLimits(
		200.0,
		32767.0,
		Bounds().Height() - scroll_view->Bounds().Height() + 50.0,
		32767.0);
	// Set the target for messages sent to this view
	list_view->SetTarget(this);
	the_button->SetTarget(this);

	// Make the list view the keyboard focus
	list_view->MakeFocus();

	// Select the first item in the list,
	// and make its config view show up
	if (list_view->CountItems() > 0)
		list_view->Select(0);
	else
		the_button->SetEnabled(false);

	// Unlock the window
	the_window->Unlock();

	// Call the base class
	BView::AttachedToWindow();
}
Example #16
0
void AboutBoxView::AttachedToWindow()
{
	BRect rect;
	rect.Set(110, 50, 175, 55);
	BButton *button = new BButton(rect, "", "OK", new BMessage(kMsgOK));
	AddChild(button);
	button->MakeDefault(true);
}
Example #17
0
	FriendWindow(BRect frame) 
		:
		BWindow(frame, "ALM Friend Test", B_TITLED_WINDOW,
			B_QUIT_ON_WINDOW_CLOSE | B_AUTO_UPDATE_SIZE_LIMITS),
		fLayout2(NULL),
		fBoom(NULL),
		fLeft(NULL),
		fTop(NULL),
		fRight(NULL),
		fBottom(NULL)
	{
		BButton* button1 = _MakeButton("friends!");
		BButton* button2 = _MakeButton("friends!");
		BButton* button3 = _MakeButton("friends!");

		BButton* button4 = _MakeButton("friends!");
		BButton* button5 = _MakeButton("friends!");
		BButton* button6 = _MakeButton("friends!");

		BALMLayout* layout1 = new BALMLayout(10, 10);
		BView* almView1 = _MakeALMView(layout1);

		BReference<XTab> xTabs[2];
		layout1->AddXTabs(xTabs, 2);

		BALM::BALMLayoutBuilder(layout1)
			.Add(button1, layout1->Left(), layout1->Top(),
				xTabs[0], layout1->Bottom())
			.StartingAt(button1)
				.AddToRight(button2, xTabs[1])
				.AddToRight(button3, layout1->Right());

		fLayout2 = new BALMLayout(10, 10, layout1);
		BView* almView2 = _MakeALMView(fLayout2);

		BALM::BALMLayoutBuilder(fLayout2)
			.Add(button4, fLayout2->Left(), fLayout2->Top(), xTabs[0])
			.StartingAt(button4)
				.AddBelow(button5, NULL, xTabs[1], fLayout2->Right())
				.AddBelow(button6, fLayout2->Bottom(), xTabs[0]);

		fLeft = fLayout2->Left();
		fBottom = fLayout2->BottomOf(button5);
		fTop = fLayout2->BottomOf(button4);
		fRight = xTabs[1];

		layout1->AreaFor(button2)->SetContentAspectRatio(1.0f);
		fLayout2->Solver()->AddConstraint(-1.0f, layout1->Left(), 1.0f, xTabs[0],
			LinearProgramming::kLE, 90.0f);

		BButton* archiveButton = new BButton("clone", new BMessage('arcv'));
		archiveButton->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED,
				B_SIZE_UNSET));
		BLayoutBuilder::Group<>(this, B_VERTICAL)
			.Add(almView1->GetLayout())
			.Add(almView2->GetLayout())
			.Add(archiveButton);
	}
Example #18
0
/////
// view attached to window
//
void MCMainView::AttachedToWindow()
{
	BButton	*btn;

	btn = (BButton*) this->FindView("newchipbtn");
	btn->SetTarget(be_app);
	btn = (BButton*) this->FindView("prefbtn");
	btn->SetTarget(be_app);
}
Example #19
0
void
ModulesView::AttachedToWindow()
{
	_OpenSaver();

	fScreenSaversListView->SetTarget(this);
	fTestButton->SetTarget(this);
	fAddButton->SetTarget(this);
}
Example #20
0
	BButton* _MakeButton(const char* label)
	{
		BButton* button = new BButton(label, new BMessage('BOOM'));
		button->SetExplicitMinSize(BSize(10, 50));
		button->SetExplicitMaxSize(BSize(500, 500));
		button->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
			B_ALIGN_USE_FULL_HEIGHT));
		return button;
	}
Example #21
0
AskName::AskName():
	BWindow(BRect(100, 100, 500, 200), "Enter your name",
		B_TITLED_WINDOW,	
		B_NOT_RESIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE
		| B_NOT_MINIMIZABLE),
	Text(NULL),
	text(NULL)
{
BView *back;
BButton * Accept;
BTextView *TV;
BStringView *str;


	const char *names[] =
	{
		"BeOS forever!",
		"BShisen Rules!",
		"Thanks Sheppy",
		"Say NO to drugs!",
		"Say NO to piracy!",
		"Say YES to BeOS!",
		"Just say \"BShisen\"",
		"Say YES to BShisen!",
	};

	back = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	back->SetViewColor(216, 216, 216);
	AddChild(back);
	
	str = new BStringView(BRect(10, 10, 390, 25), "",
		"Congratulations!  Enter your name for posterity.");
	
	str->SetFont(be_bold_font);
	back->AddChild(str);
	
	Accept = new BButton( BRect(10, 60+5, 90, 75+5), "Accept",
		"Accept", new BMessage(ACCEPT_BUTTON));
	Accept->MakeDefault(true);
	back->AddChild(Accept);

	Text = new BTextControl(BRect(10, 35, 390, 50), "",
		"Your Name", "", NULL);
	
	Text->SetDivider(Text->StringWidth("Your Name "));


	TV = Text->TextView();
	TV->SetMaxBytes(31);	

	Text->SetText(REGISTERED ? names[rand() % 8] : "I Want To Register!");

	back->AddChild(Text);
	Text->MakeFocus(true);
}
Example #22
0
FindOpenFileWindow::FindOpenFileWindow(const char* panelText)
	:
	DWindow(BRect(0, 0, 0, 0), TR("Find and open file"), B_TITLED_WINDOW,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
	AddCommonFilter(new EscapeCancelFilter());

	BView* top = GetBackgroundView();

	fNameTextControl = new AutoTextControl("nameText", TR("Open: "), "",
		new BMessage);
	fNameTextControl->SetExplicitMinSize(
		BSize(fNameTextControl->StringWidth("M") * 20, B_SIZE_UNSET));
	fSystemCheckBox = new BCheckBox("systembox", TR("Search only system folders"),
		new BMessage);

	BButton* cancel = new BButton("cancel", TR("Cancel"),
		new BMessage(B_QUIT_REQUESTED));

	BButton* open = new BButton("open", TR("Open"), new BMessage(M_FIND_FILE));

	BLayoutBuilder::Group<>(top, B_VERTICAL)
		.AddGrid(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
			.Add(fNameTextControl->CreateLabelLayoutItem(), 0, 0)
			.Add(fNameTextControl->CreateTextViewLayoutItem(), 1, 0)
			.Add(fSystemCheckBox, 1, 1)
			.End()
		.AddGlue()
		.AddGroup(B_HORIZONTAL)
			.AddGlue()
			.Add(cancel)
			.Add(open)
			.End()
		.SetInsets(B_USE_WINDOW_INSETS)
		.End();

	BString text = panelText;
	if (text.CountChars() > 1) {
		fNameTextControl->SetText(text.String());
		int32 position = text.FindLast(".");
		if (position > 0)
			fNameTextControl->TextView()->Select(0, position);
		else
			fNameTextControl->TextView()->SelectAll();
	} else {
		fNameTextControl->SetText(".h");
		fNameTextControl->TextView()->GoToLine(0);
	}

	open->MakeDefault(true);

	fNameTextControl->MakeFocus(true);

	CenterOnScreen();
}
// Private function to switch between follow bottom behaviour
void
OutputFormatView::MakeFollowBottom(bool flag)
{
	scroll_view->SetResizingMode(B_FOLLOW_LEFT_RIGHT | (flag ? B_FOLLOW_TOP_BOTTOM : B_FOLLOW_TOP));
	cancel_button->SetResizingMode(B_FOLLOW_RIGHT | (flag ? B_FOLLOW_BOTTOM : B_FOLLOW_TOP));
	the_button->SetResizingMode(B_FOLLOW_RIGHT | (flag ? B_FOLLOW_BOTTOM : B_FOLLOW_TOP));
	info_caption->SetResizingMode(B_FOLLOW_LEFT_RIGHT | (flag ? B_FOLLOW_BOTTOM : B_FOLLOW_TOP));
	info_view->SetResizingMode(B_FOLLOW_LEFT_RIGHT | (flag ? B_FOLLOW_BOTTOM : B_FOLLOW_TOP));
	if (config_caption)
		config_caption->SetResizingMode(B_FOLLOW_LEFT_RIGHT | (flag ? B_FOLLOW_BOTTOM : B_FOLLOW_TOP));
}
Example #24
0
void _OwqList::SelectionChanged()
{
	inherited::SelectionChanged();
	BRow*	selection = CurrentSelection();
	if( selection ) {
		if( mChange ) mChange->SetEnabled( true );
		if( mRemove ) mRemove->SetEnabled( true );
	} else {
		if( mChange ) mChange->SetEnabled( false );
		if( mRemove ) mRemove->SetEnabled( false );
	}
}
Example #25
0
ID_Win::ID_Win(BLooper *l, unsigned int g): 
	Txt_Ctl(NULL), done(0), Game(0),
	BWindow(BRect(100, 100, 300, 180), "New Game By ID",
		B_TITLED_WINDOW,	
		B_NOT_RESIZABLE | /*B_NOT_CLOSABLE |*/ B_NOT_ZOOMABLE
		| B_NOT_MINIMIZABLE)
{
BView *back;
BButton * Cancel;
BButton * Accept;
BTextView *T;
register int i;

	loop = l;
	Game = g;
	back = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	back->SetViewColor(216, 216, 216);
	AddChild(back);
	
	Accept = new BButton( BRect(10, 40, 90, 55), "Accept",
		"Accept", new BMessage(ACCEPT_BUTTON));
	Accept->MakeDefault(true);
	back->AddChild(Accept);

	Cancel = new BButton( BRect(120, 40, 190, 55), "Cancel",
		"Cancel", new BMessage(CANCEL_BUTTON));
	back->AddChild(Cancel);

	Txt_Ctl = new BTextControl(BRect(10, 10, 190, 25), "",
		"Game Number", "", NULL);
        T = Txt_Ctl->TextView();

	/*
	 * Only allow #s in there.
	 */
        for (i = 0; i < 256; i++)
                T->DisallowChar(i);

        for (i = '0'; i < '9' + 1; i++)
                T->AllowChar(i);   

	back->AddChild(Txt_Ctl);

	char buffer[64];
	if (!Game) Game = rand();
	sprintf(buffer, "%d", Game);
	Txt_Ctl->SetText(buffer);
	Txt_Ctl->MakeFocus(true);
	
	//Port = create_port(1, "ID Window Port");
	Show();
}
Example #26
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 #27
0
void CPrefsDialog::UpdateFields()
{
	if (fNewOrCur->IndexOf(fNewOrCur->FindMarked()) == 1)
		GrabDocFont();
	else
		GrabNewFont();
	
	BButton *b;
	b = (BButton *)FindView("ok");
	b->SetEnabled(true);
	b = (BButton *)FindView("cancel");
	b->SetEnabled(true);
} /* CPrefsDialog::UpdateFields */
Example #28
0
TWindow::TWindow(BRect frame, const char *title, window_type type, uint32 flags, uint32 workspace)
		: BWindow(frame, title, type, flags, workspace), quited(false)
{
//	SetBackgroundColor(0, 255, 255);

	BButton *btn = new BButton(BRect(10, 200, 40, 230), NULL, "Focus Button", new BMessage(BTN_FOCUS_MSG));
	AddChild(btn);
	btn->ResizeToPreferred();
	btn->MakeFocus(true);

	BView *view = new TView(frame.OffsetToCopy(B_ORIGIN), NULL, B_FOLLOW_ALL, B_WILL_DRAW |B_FRAME_EVENTS);
	AddChild(view);
}
Example #29
0
bool CPrefsDialog::CancelClicked()
{
	char s[256];
	
	ResetFontSheet();
	
	SetOn("autorecalc", fAutoRecalc);
	SetOn("displayzero", fDisplayZero);
	
	s[1] = 0;
	s[0] = gDecimalPoint;
	SetText("decsep", s);
	s[0] = gThousandSeparator;
	SetText("thoussep", s);
	s[0] = gListSeparator;
	SetText("listsep", s);
	s[0] = gTimeSeparator;
	SetText("timesep", s);
	s[0] = gDateSeparator;
	SetText("datesep", s);
	fDMY->FindItem(gPrefs->GetPrefString("date order"))->SetMarked(true);
	SetOn("24 hours", g24Hours);
	SetOn("excel", gPrefs->GetPrefInt("Excel keys", 0));
	SetOn("grayselect", gPrefs->GetPrefInt("Select Gray", 0));
	SetOn(gPrefs->GetPrefInt("start with new", 1) ? "donew" : "doopen", B_CONTROL_ON);
	SetOn("formula starts with equal", gPrefs->GetPrefInt("formula starts with equal", 0));
	SetOn("dark gridlines", gPrefs->GetPrefInt("dark gridlines"));
	
	SetText("c_symbol", gPrefs->GetPrefString("c_symbol", "$"));
	SetOn(gPrefs->GetPrefInt("c_before", 1) ? "c_before" : "c_after", B_CONTROL_ON);
	SetOn("c_neg_par", gPrefs->GetPrefInt("c_neg_par", 1) ? B_CONTROL_ON : B_CONTROL_OFF);
	sprintf(s, "%d", gPrefs->GetPrefInt("c_digits"));
	SetText("c_digits", s);

	if (fPageSetup) FREE(fPageSetup);
	fPageSetup = (char *)Hex2Bin(gPrefs->GetPrefString("default page setup", ""), fPageSetupSize);
	
	SetOn("prgrid", fPrGrid);
	SetOn("prhead", fPrBorders);
	SetOn("dispgrid", fShGrid);
	SetOn("disphead", fShBorders);
	
	BButton *b;
	b = (BButton *)FindView("ok");
	b->SetEnabled(false);
	b = (BButton *)FindView("cancel");
	b->SetEnabled(false);
	
	return false;
} /* CPrefsDialog::CancelClicked */
Example #30
0
void
HWindow::Pulse()
{
	HEventRow* row = (HEventRow*)fEventList->CurrentSelection();
	BMenuField* menufield = dynamic_cast<BMenuField*>(FindView("filemenu"));
	BButton* button = dynamic_cast<BButton*>(FindView("play"));
	BButton* stop = dynamic_cast<BButton*>(FindView("stop"));

	if (menufield == NULL || button == NULL || stop == NULL)
		return;

	if (row != NULL) {
		menufield->SetEnabled(true);

		const char* path = row->Path();
		if (path != NULL && strcmp(path, ""))
			button->SetEnabled(true);
		else
			button->SetEnabled(false);
	} else {
		menufield->SetEnabled(false);
		button->SetEnabled(false);
	}

	if (fPlayer != NULL) {
		if (fPlayer->IsPlaying())
			stop->SetEnabled(true);
		else
			stop->SetEnabled(false);
	} else
		stop->SetEnabled(false);
}