Example #1
0
int
main()
{		
	BApplication pictureApp("application/x-vnd.picture");

	BWindow *pictureWindow = new BWindow(BRect(100, 100, 500, 400),
		"BPicture test", B_TITLED_WINDOW,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_QUIT_ON_WINDOW_CLOSE);

	BRect rect(pictureWindow->Bounds());
	rect.right -= (rect.Width() + 1) / 2;
	OriginalView *testView = new OriginalView(rect);
	
	rect.OffsetBy(rect.Width() + 1, 0);
	PictureView *pictureView = new PictureView(rect);
	
	pictureWindow->AddChild(testView);
	pictureWindow->AddChild(pictureView);
	pictureWindow->Show();

	BPath path;
	if (find_directory(B_SYSTEM_DATA_DIRECTORY, &path) == B_OK) {
		path.Append("artwork/lion.svg");
		BEntry entry(path.Path());
		if (entry.Exists()) {
			BWindow *svgWindow = new Svg2PictureWindow(BRect(300, 300, 600, 600),
				path.Path());
			svgWindow->Show();
		}
	}

	pictureApp.Run();
	return 0;
}
Example #2
0
void AmControlChangeReport::ReadSong(const AmSong* song)
{
	_AmControlEntryCollection	entries;
	const AmTrack*				track;
	for (uint32 k = 0; (track = song->Track(k)); k++) {
		_AmControlEntry			entry(track);
		control_report(&(track->Phrases()), entry);
		if (entry.controls.size() > 0) entries.AddEntry(entry);
	}

	BRect		f(100, 100, 400, 400);
	BWindow*	window = new BWindow(	f, "Control Change Report", B_DOCUMENT_WINDOW_LOOK,
										B_NORMAL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS);
	if (window) {
		BOutlineListView*	lv = new BOutlineListView(	BRect(0, 0, f.Width() - 15, f.Height() - 15), "outline",
														B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL);
		if (lv) {
			entries.AddTo(lv);
			BScrollView*	scroll = new BScrollView("scroll", lv, B_FOLLOW_ALL, 0, true, true);
			if (scroll) window->AddChild(scroll);
			else window->AddChild(lv);
		}
		window->Show();
	}
}
Example #3
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 = NULL;
	BFile file("/tmp/archived_view", B_READ_ONLY);
	if (file.InitCheck() == B_OK) {
		printf("found archive file\n");
		BMessage archive;
		if (archive.Unflatten(&file) == B_OK) {
			printf("unflattened archive message\n");
			BArchivable* archivable = instantiate_object(&archive);
			view = dynamic_cast<BView*>(archivable);
			if (view)
				printf("instatiated BView\n");
		}
	}

	if (!view)
		view = new TestView(window->Bounds(), "test", B_FOLLOW_ALL, B_WILL_DRAW);

	window->Show();

	window->Lock();
	window->AddChild(view);
	window->Unlock();
}
Example #4
0
void
PathBox::GetPreferredSize(float *w, float *h)
{
	float width, height;
	float tempw, temph;
	
	if (Window()) {
		fPathControl->GetPreferredSize(&width, &height);
	} else {
		if (B_BEOS_VERSION <= B_BEOS_VERSION_5) {
			fPathControl->RemoveSelf();
			BWindow *win = new BWindow(BRect(100,100,400,400),"",B_TITLED_WINDOW,0);
			win->AddChild(fPathControl);
			fPathControl->GetPreferredSize(&width,&height);
			fPathControl->RemoveSelf();
			win->Quit();
			AddChild(fPathControl);
		} else {
			fPathControl->GetPreferredSize(&width, &height);
		}
	}
	
	fBrowseButton->GetPreferredSize(&tempw, &temph);
	width += tempw + 30;
	height = (height > temph) ? height : temph;
	
	if (w)
		*w = width;
	if (h)
		*h = height;
}
Example #5
0
int
main(int argc, char** argv)
{
	BApplication app("application/x-vnd.Antares-DrawAfterChildren");

	BRect frame(100, 100, 700, 400);
	BWindow* window = new BWindow(frame, "Window",
		B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE);

	frame.OffsetTo(B_ORIGIN);
	TestView* view = new TestView(frame);
	window->AddChild(view);

	frame.InsetBy(20, 20);
	frame.right = frame.left + frame.Width() / 2 - 10;
	BView* child = new ChildView(frame, "child 1",
		(rgb_color){ 200, 200, 200, 255 });
	view->AddChild(child);

	frame.OffsetBy(frame.Width() + 20, 0);
	child = new ChildView(frame, "child 2", B_TRANSPARENT_COLOR);
	view->AddChild(child);

	window->Show();

	app.Run();
	return 0;
}
Example #6
0
int targatobpic(
	const unsigned char* targa, int targasize,
	BPicture* picture)
{
	BRect frame(0,0,100,100);	// arbitraire
	BBitmap *bitmap;
	BView *view;
	BWindow *window;
	
	bitmap=targatobbitmap(targa,targasize);
	if(!bitmap) return -1;
	
	window=new BWindow(frame,NULL,B_MODAL_WINDOW,0);
	view=new BView(frame,NULL,B_FOLLOW_NONE,0);
	window->AddChild(view);
	
	view->BeginPicture(picture);
	view->DrawBitmap(bitmap);
	view->EndPicture();
	
	delete bitmap;
	delete window;
	
	return 0;
}
Example #7
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 #8
0
/**
 * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
 */
static _EGLSurface *
haiku_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
	_EGLConfig *conf, void *native_window, const EGLint *attrib_list)
{
	CALLED();

	struct haiku_egl_surface* surface;
	surface = (struct haiku_egl_surface*) calloc(1, sizeof (*surface));
	if (!surface) {
		_eglError(EGL_BAD_ALLOC, "haiku_create_window_surface");
		return NULL;
	}

	if (!_eglInitSurface(&surface->surf, disp, EGL_WINDOW_BIT,
		conf, attrib_list)) {
		free(surface);
		return NULL;
	}

	(&surface->surf)->SwapInterval = 1;

	TRACE("Creating window\n");
	BWindow* win = (BWindow*)native_window;

	TRACE("Creating GL view\n");
	surface->gl = new BGLView(win->Bounds(), "OpenGL", B_FOLLOW_ALL_SIDES, 0,
		BGL_RGB | BGL_DOUBLE | BGL_ALPHA);

	TRACE("Adding GL\n");
	win->AddChild(surface->gl);

	TRACE("Showing window\n");
	win->Show();
	return &surface->surf;
}
Example #9
0
void 
Shelf::StartConfig(BView *view) 
{
	PRINT(("%p:%s()\n", this, __FUNCTION__));
	fInConfig = true;

	BStringView* titleString = new BStringView("Title",
		B_TRANSLATE("Shelf"));
	titleString->SetFont(be_bold_font);

	BStringView* copyrightString = new BStringView("Copyright",
		B_TRANSLATE("© 2012 François Revol."));

	BTextView* helpText = new BTextView("Help Text");
	helpText->MakeEditable(false);
	helpText->SetViewColor(view->ViewColor());
	rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
	helpText->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor);
	BString help;
	help << B_TRANSLATE("Drop replicants on the full-screen window "
		"behind the preferences panel.");
	//help << "\n\n";
	//help << B_TRANSLATE("You can also drop colors.");
	helpText->SetText(help.String());

	BLayoutBuilder::Group<>(view, B_VERTICAL, B_USE_HALF_ITEM_SPACING)
		.SetInsets(B_USE_DEFAULT_SPACING)
		.Add(titleString)
		.Add(copyrightString)
		.AddStrut(roundf(be_control_look->DefaultItemSpacing() / 2))
		.Add(helpText)
		.AddGlue()
	.End();

	BScreen screen;
	fConfigWindow = new BWindow(screen.Frame(), "Shelf Config",
		B_UNTYPED_WINDOW, B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE
		| B_NOT_MINIMIZABLE | B_NOT_RESIZABLE | B_AVOID_FRONT | B_AVOID_FOCUS);

	BView *shelfView = new BView(fConfigWindow->Bounds(), "ShelfView", 
		B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS);
	shelfView->SetViewColor(216, 216, 216, 0);

	fConfigWindow->AddChild(shelfView);

	fShelfData.Seek(SEEK_SET, 0LL);
	fShelf = new BShelf(&fShelfData, shelfView);
	fShelf->SetDisplaysZombies(true);
	fShelfData.Seek(SEEK_SET, 0LL);

	// start the Looper
	fConfigWindow->Show();

	fConfigWindow->Lock();
	fConfigWindow->SendBehind(view->Window());
	fConfigWindow->Unlock();

	//"\nDrop replicants on me!"
} 
Example #10
0
MediaNodeControlApp::MediaNodeControlApp(
	const char* pAppSignature,
	media_node_id nodeID) :
	BApplication(pAppSignature) {

	BMediaRoster* r = BMediaRoster::Roster();
	
	// get the node	
	status_t err = r->GetNodeFor(nodeID, &m_node);
	if(err < B_OK) {
		char buffer[512];
		sprintf(buffer,
			"MediaNodeControlApp: couldn't find node (%ld):\n%s\n",
			nodeID, strerror(err));
		(new BAlert("error", buffer, "OK"))->Go();
		return;
	}
	
	// fetch info (name)
	live_node_info nInfo;
	err = r->GetLiveNodeInfo(m_node, &nInfo);
	if(err < B_OK) {
		char buffer[512];
		sprintf(buffer,
			"MediaNodeControlApp: couldn't get node info (%ld):\n%s\n",
			nodeID, strerror(err));
		(new BAlert("error", buffer, "OK"))->Go();
		return;
	}
	
	BString windowTitle;
	windowTitle << nInfo.name << '(' << nodeID << ") controls";		
	
	// get parameter web
	BParameterWeb* pWeb;
	err = r->GetParameterWebFor(m_node, &pWeb);
	if(err < B_OK) {
		char buffer[512];
		sprintf(buffer,
			"MediaNodeControlApp: no parameters for node (%ld):\n%s\n",
			nodeID, strerror(err));
		(new BAlert("error", buffer, "OK"))->Go();
		return;
	}
	
	// build & show control window
	BView* pView = BMediaTheme::ViewFor(pWeb);
	BWindow* pWnd = new PanelWindow();
	pWnd->AddChild(pView);
	pWnd->ResizeTo(pView->Bounds().Width(), pView->Bounds().Height());
	pWnd->SetTitle(windowTitle.String());
	pWnd->Show();
	
	// release the node
	//r->ReleaseNode(m_node);	
}
Example #11
0
/*********************************************************************
	main
	Args:	<none>
	Returns:	<none>
	This is the main line of the replicat program. All we do is make
	an application, make a window, and add a kitten to the window.
	We also patch the event queue to make sure the app quits
	properly.
*********************************************************************/
int main(void)
{
	BApplication app("application/x-vnd.Bastion-replicat");
	BRect theRect(0,0,199,199);
	BWindow* win = new BWindow(theRect,"Replicat",B_TITLED_WINDOW,0);
	win->AddChild(new VuKitten(theRect));
	win->AddCommonFilter(new BMessageFilter(B_QUIT_REQUESTED,f_quit));
	win->MoveTo(75,50);
	win->Show();
	app.Run();
	return 0;
}
CDPlayerApplication::CDPlayerApplication()
	: BApplication("application/x-vnd.Haiku-CDPlayer")
{
	BWindow *window = new CDPlayerWindow();
	CDPlayer *view = new CDPlayer(window->Bounds(), B_TRANSLATE("CD"));
	if (view->InitCheck()) {
		window->ResizeTo(view->Bounds().Width(), view->Bounds().Height());
		window->AddChild(view);
		window->Show();
	} else 
		PostMessage(B_QUIT_REQUESTED);
}
Example #13
0
void
ThemesApp::ReadyToRun()
{
	BScreen s;
	BRect frame(0, 0, 550, 300);
	frame.OffsetBySelf(s.Frame().Width()/2 - frame.Width()/2, 
						s.Frame().Height()/2 - frame.Height()/2);
	BWindow *w = new BWindow(frame, "Themes", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_QUIT_ON_WINDOW_CLOSE);
	ThemeInterfaceView *v = new ThemeInterfaceView(w->Bounds());
	w->AddChild(v);
	w->Show();
}
Example #14
0
	void MessageReceived(BMessage* message)
	{
		switch (message->what) {
			case 'BOOM':
				if (!fBoom) {
					fBoom = _MakeButton("BOOM");
					fLayout2->AddView(fBoom, fLeft, fTop,
						fRight, fBottom);
				} else {
					if (fBoom->IsHidden(fBoom))
						fBoom->Show();
					else
						fBoom->Hide();
				}
				break;
			case 'arcv': {
				BView* view = GetLayout()->View();
				BMessage archive;
				status_t err = view->Archive(&archive, true);
				BWindow* window = new BWindow(BRect(30, 30, 400, 400),
					"ALM Friend Test Clone", B_TITLED_WINDOW,
					B_QUIT_ON_WINDOW_CLOSE | B_AUTO_UPDATE_SIZE_LIMITS);
				window->SetLayout(new BGroupLayout(B_VERTICAL));
				BView* clone;
				if (err == B_OK)
					err = BUnarchiver::InstantiateObject(&archive, clone);
				if (err != B_OK)
					window->AddChild(new BStringView("", "An error occurred!"));
				else {
					window->AddChild(clone);
				}
				window->Show();

				break;
			}
			default:
				BWindow::MessageReceived(message);
		}
	}
Example #15
0
App::App() :
	BApplication("application/glyphaiii")
{
	BRect frame(0, 0, 640, 460);
	BWindow *win = new BWindow(frame, "Glypha III",
		B_TITLED_WINDOW, B_NOT_ZOOMABLE);
	
	BMenuBar *menuBar = new BMenuBar(BRect(0,0,0,0), NULL);
	BMenu *menu = new BMenu("File");
	BMenuItem *item = new BMenuItem("Quit", NULL, 'Q');
	menu->AddItem(item);
	menuBar->AddItem(menu);
	win->AddChild(menuBar);

	win->ResizeBy(0, menuBar->Frame().Height());
	
	GameGLView *glview = new GameGLView(BRect(0, menuBar->Frame().Height() + 1, 640, 480));
	win->AddChild(glview);
	
	win->CenterOnScreen();
	win->Show();
}
Example #16
0
FontDemo::FontDemo()
	: BApplication("application/x-vnd.Antares-FontDemo")
{
	// Create the demo window where we draw the string
	BWindow* demoWindow = new BWindow(BRect(80, 30, 490, 300), "FontDemo",
		B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);

	FontDemoView* demoView = new FontDemoView(demoWindow->Bounds());
	demoWindow->AddChild(demoView);

	BWindow* controlWindow = new BWindow(BRect(500, 30, 700, 402), "Controls",
		B_FLOATING_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL,
		B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS);

	ControlView* controlView = new ControlView(controlWindow->Bounds());
	controlWindow->AddChild(controlView);

	controlView->SetTarget(demoView);

	demoWindow->Show();	
	controlWindow->Show();
}
Example #17
0
int 
main(int argc, char **argv)
{
	BApplication app("application/x-vnd.haiku-view_transit");

	BWindow* window = new BWindow(BRect(100, 100, 400, 400),
		"ViewTransit-Test", B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);

	BRect frame = window->Bounds();
	frame.right /= 2;
	window->AddChild(new View(frame, "L ", B_FOLLOW_ALL, 255, 0, 0));
	frame.left = frame.right + 1;
	frame.right = window->Bounds().right;
	View* view = new View(frame, "R", B_FOLLOW_TOP_BOTTOM | B_FOLLOW_RIGHT,
		0, 255, 0);
	window->AddChild(view);
	view->SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);

	window->Show();

	app.Run();
	return 0;
}
Example #18
0
int
main(int argc, char *argv[])
{
	BApplication app("application/x-vnd.Antares-TruncateString");

	BRect frame(100, 200, 1200, 300);
	BWindow *window = new BWindow(frame, "TruncateString", B_TITLED_WINDOW,
		B_QUIT_ON_WINDOW_CLOSE);

	TruncateView *view = new TruncateView(frame.OffsetToSelf(0, 0));
	window->AddChild(view);

	window->Show();
	app.Run();
	return 0;
}
int
main(int argc, char **argv)
{
	BApplication app("application/x-vnd.haiku-ShakeFilterTest");

	BWindow* window = new BWindow(BRect(100, 100, 400, 400),
		"ShakeFilter-Test", B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);

	BRect frame = window->Bounds();

	window->AddChild(new View(frame, "L ", B_FOLLOW_ALL));
	window->Show();

	app.Run();
	return 0;
}
Example #20
0
int
main(int argc, char** argv)
{
	BApplication app(kAppSignature);

	BWindow* window = new BWindow(BRect(50.0, 50.0, 300.0, 250.0),
		"DrawString() with offsets", B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);

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

	window->Show();

	app.Run();
	return 0;
}
Example #21
0
	Application()
		: BApplication("application/x-vnd.stippi-async.drawing")
		, fDelay(true)
	{
		BWindow* window = new BWindow(BRect(50, 50, 350, 250),
			"Test Window", B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
			B_QUIT_ON_WINDOW_CLOSE);
		fView = new View(window->Bounds(), 255, 80, 155, 128);
		window->AddChild(fView);
		window->Show();

		window = new BWindow(BRect(150, 150, 450, 350),
			"Drag Window", B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
			B_QUIT_ON_WINDOW_CLOSE);
		window->Show();

		SetPulseRate(100000);
	}
Example #22
0
bool MainApp::MakeMainWindow(const entry_ref file)
{
	BWindow* win = new BWindow(BRect(30,30,400,200), "Drop Message",
							   B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
							   B_ASYNCHRONOUS_CONTROLS|B_QUIT_ON_WINDOW_CLOSE);
	if( !win ) return false;
	
	win->AddChild( new PrintView(win->Bounds(), "PrintView") );
	win->Show();
	mMainWin = BMessenger(win);
	
	win = new TipWindow();
	if( !win ) return false;
	
	mTipWin = BMessenger(win);
	
	return true;
}
Example #23
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, 60.0, 15.0);
	b.OffsetTo(5.0, view->Bounds().bottom - (b.Height() + 15.0));
	BButton* control = new BButton(b, "button", "Reset", new BMessage(MSG_RESET));
	view->AddChild(control);
	control->SetTarget(view);

	window->Show();
}
Example #24
0
// main
int
main(int argc, char** argv)
{
	BApplication app("application/x.vnd-Haiku.BitmapBounds");

	BRect frame(50.0, 50.0, 300.0, 250.0);
	BWindow* window = new BWindow(frame, "Bitmap Bounds", B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);

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

	window->Show();

	app.Run();

	return 0;
}
Example #25
0
/*!	Returns the current mouse position in screen coordinates.
	Since there is no method to retrieve this in the Be API without a view,
	this looks a bit more complicated.
*/
static BPoint
mouse_position()
{
	BWindow* window = new BWindow(BRect(-1000, -1000, -900, -900), "mouse",
		B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
		B_AVOID_FRONT | B_AVOID_FOCUS);
	BView* view = new BView(window->Bounds(), "mouse", B_FOLLOW_ALL, 0);
	window->AddChild(view);
	window->Run();

	window->Lock();

	BPoint position;
	uint32 buttons;
	view->GetMouse(&position, &buttons);
	view->ConvertToScreen(&position);

	window->Quit();

	return position;
}
Example #26
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);
}
Example #27
0
int main( int argc, char** argv )
{
	BApplication* pcApp = new BApplication( "application/x-vnd.KHS-desktop_manager" );

	#if 0
	if( getuid() == 0 )
	{
		const char* pzLoginName = NULL;

		if ( argc == 2 )
		{
			pzLoginName = argv[1];
		}
		authorize( pzLoginName );
	}
	#endif
	const char* pzBaseDir = getenv( "COSMOE_SYS" );
	if( pzBaseDir == NULL )
	{
		pzBaseDir = "/cosmoe";
	}
	char* pzPath = new char[ strlen(pzBaseDir) + 80 ];
	strcpy( pzPath, pzBaseDir );
	strcat( pzPath, "/backdrop.jpg" );
	g_pcBackDrop = load_jpeg( pzPath );
	delete[] pzPath;

	BWindow* pcBitmapWindow = new BWindow(  BRect( 0, 0, 1599, 1199 ), "",
											B_NO_BORDER_WINDOW_LOOK,
											B_NORMAL_WINDOW_FEEL,
											WND_BACKMOST,
											B_ALL_WORKSPACES );
	pcBitmapWindow->AddChild( new BitmapView( BRect( 0, 0, 1599, 1199 ), g_pcBackDrop ) );
	pcBitmapWindow->Show();

	pcApp->Run();

	return( 0 );
}
Example #28
0
/**
 * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
 */
static _EGLSurface *
haiku_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
	_EGLConfig *conf, void *native_window, const EGLint *attrib_list)
{
	struct haiku_egl_surface* surface;
	surface = (struct haiku_egl_surface*)calloc(1,sizeof (*surface));

	_eglInitSurface(&surface->surf, disp, EGL_WINDOW_BIT, conf, attrib_list);
	(&surface->surf)->SwapInterval = 1;

	_eglLog(_EGL_DEBUG, "Creating window");
	BWindow* win = (BWindow*)native_window;

	_eglLog(_EGL_DEBUG, "Creating GL view");
	surface->gl = new BGLView(win->Bounds(), "OpenGL", B_FOLLOW_ALL_SIDES, 0,
		BGL_RGB | BGL_DOUBLE | BGL_ALPHA);

	_eglLog(_EGL_DEBUG, "Adding GL");
	win->AddChild(surface->gl);

	_eglLog(_EGL_DEBUG, "Showing window");
	win->Show();
	return &surface->surf;
}
Example #29
0
AttribPolygon::AttribPolygon ()
: AttribView (BRect (0, 0, 148, 90), lstring (30, "Polygons"))
{
	SetViewColor (LightGrey);
	lSlid = new Slider (BRect (8, 8, 140, 26), 60, lstring (310, "Pen Size"), 1, 50, 1, new BMessage ('ALpc'));
	AddChild (lSlid);
	fPenSize = 1;
	fType = POLYGON_OUTFILL;
	BBox *type = new BBox (BRect (18, 32, 130, 82), "type");
	type->SetLabel (lstring (311, "Type"));
	AddChild (type);

	BPoint pointArray[] = {
		BPoint ( 2,  8),
		BPoint ( 9,  2),
		BPoint (27, 12),
		BPoint (19, 28),
		BPoint (14, 20),
		BPoint ( 9, 26)
		};
	BPolygon *poly = new BPolygon();
	poly->AddPoints(pointArray, 6);

	BWindow *picWindow = new BWindow (BRect (0, 0, 100, 100), "Temp Pic Window", B_BORDERED_WINDOW, uint32 (NULL), uint32 (NULL));
	BView *bg = new BView (BRect (0, 0, 100, 100), "Temp Pic View", uint32 (NULL), uint32 (NULL));
	picWindow->AddChild (bg);
	
	BPicture *p10;
	bg->BeginPicture (new BPicture);
	bg->SetLowColor (LightGrey);
	bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
	bg->SetLowColor (White);
	bg->FillPolygon (poly, B_SOLID_LOW);
	bg->StrokePolygon (poly);
	p10 = bg->EndPicture();
	
	BPicture *p20;
	bg->BeginPicture (new BPicture);
	bg->SetLowColor (LightGrey);
	bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
	bg->SetHighColor (Black);
	bg->SetLowColor (White);
	bg->FillPolygon (poly, B_SOLID_LOW);
	p20 = bg->EndPicture();
	
	BPicture *p30;
	bg->BeginPicture (new BPicture);
	bg->SetLowColor (LightGrey);
	bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
	bg->SetHighColor (Black);
	bg->SetLowColor (White);
	bg->StrokePolygon (poly);
	p30 = bg->EndPicture();

	BPicture *p11;
	bg->BeginPicture (new BPicture);
	bg->SetLowColor (DarkGrey);
	bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
	bg->SetHighColor (Black);
	bg->SetLowColor (White);
	bg->FillPolygon (poly, B_SOLID_LOW);
	bg->StrokePolygon (poly);
	p11 = bg->EndPicture();
	
	BPicture *p21;
	bg->BeginPicture (new BPicture);
	bg->SetLowColor (DarkGrey);
	bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
	bg->SetHighColor (Black);
	bg->SetLowColor (White);
	bg->FillPolygon (poly, B_SOLID_LOW);
	p21 = bg->EndPicture();
	
	BPicture *p31;
	bg->BeginPicture (new BPicture);
	bg->SetLowColor (DarkGrey);
	bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
	bg->SetHighColor (Black);
	bg->SetLowColor (White);
	bg->StrokePolygon (poly);
	p31 = bg->EndPicture();
	
	delete poly;
	delete picWindow;
	
	SetViewColor (LightGrey);
	
	pT1 = new BPictureButton (BRect (4, 15, 34, 45), "APVt1", p10, p11, new BMessage ('pvT1'), B_TWO_STATE_BUTTON);
	pT2 = new BPictureButton (BRect (40, 15, 70, 45), "APVt2", p20, p21, new BMessage ('pvT2'), B_TWO_STATE_BUTTON);
	pT3 = new BPictureButton (BRect (76, 15, 106, 45), "APVt3", p30, p31, new BMessage ('pvT3'), B_TWO_STATE_BUTTON);
	type->AddChild (pT1);
	type->AddChild (pT2);
	type->AddChild (pT3);
	pT1->SetValue (B_CONTROL_ON);
	fCurrentProperty = 0;
}
Example #30
0
AttribRect::AttribRect ()
    : AttribView (BRect (0, 0, 148, 90), lstring (31, "Rectangles"))
{
    SetViewColor (LightGrey);
    lSlid = new Slider (BRect (8, 8, 140, 26), 60, lstring (310, "Pen Size"), 1, 50, 1, new BMessage ('ALpc'));
    AddChild (lSlid);
    fType = RECT_OUTFILL;
    fPenSize = 1;
    BBox *type = new BBox (BRect (18, 32, 130, 82), "type");
    type->SetLabel (lstring (311, "Type"));
    AddChild (type);
    BRect shape = BRect (3, 5, 27, 25);

    BWindow *picWindow = new BWindow (BRect (0, 0, 100, 100), "Temp Pic Window", B_BORDERED_WINDOW, uint32 (NULL), uint32 (NULL));
    BView *bg = new BView (BRect (0, 0, 100, 100), "Temp Pic View", uint32 (NULL), uint32 (NULL));
    picWindow->AddChild (bg);

    BPicture *p10;
    bg->BeginPicture (new BPicture);
    bg->SetLowColor (LightGrey);
    bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
    bg->SetLowColor (White);
    bg->FillRect (shape, B_SOLID_LOW);
    bg->StrokeRect (shape);
    p10 = bg->EndPicture();

    BPicture *p20;
    bg->BeginPicture (new BPicture);
    bg->SetLowColor (LightGrey);
    bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
    bg->SetHighColor (Black);
    bg->SetLowColor (White);
    bg->FillRect (shape, B_SOLID_LOW);
    p20 = bg->EndPicture();

    BPicture *p30;
    bg->BeginPicture (new BPicture);
    bg->SetLowColor (LightGrey);
    bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
    bg->SetHighColor (Black);
    bg->SetLowColor (White);
    bg->StrokeRect (shape);
    p30 = bg->EndPicture();

    BPicture *p11;
    bg->BeginPicture (new BPicture);
    bg->SetLowColor (DarkGrey);
    bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
    bg->SetHighColor (Black);
    bg->SetLowColor (White);
    bg->FillRect (shape, B_SOLID_LOW);
    bg->StrokeRect (shape);
    p11 = bg->EndPicture();

    BPicture *p21;
    bg->BeginPicture (new BPicture);
    bg->SetLowColor (DarkGrey);
    bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
    bg->SetHighColor (Black);
    bg->SetLowColor (White);
    bg->FillRect (shape, B_SOLID_LOW);
    p21 = bg->EndPicture();

    BPicture *p31;
    bg->BeginPicture (new BPicture);
    bg->SetLowColor (DarkGrey);
    bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
    bg->SetHighColor (Black);
    bg->SetLowColor (White);
    bg->StrokeRect (shape);
    p31 = bg->EndPicture();

    SetViewColor (LightGrey);
    delete picWindow;

    pT1 = new BPictureButton (BRect (4, 15, 34, 45), "APVt1", p10, p11, new BMessage ('pvT1'), B_TWO_STATE_BUTTON);
    pT2 = new BPictureButton (BRect (40, 15, 70, 45), "APVt2", p20, p21, new BMessage ('pvT2'), B_TWO_STATE_BUTTON);
    pT3 = new BPictureButton (BRect (76, 15, 106, 45), "APVt3", p30, p31, new BMessage ('pvT3'), B_TWO_STATE_BUTTON);
    type->AddChild (pT1);
    type->AddChild (pT2);
    type->AddChild (pT3);
    pT1->SetValue (B_CONTROL_ON);
    fCurrentProperty = 0;
}