Exemplo n.º 1
0
bool WrapWindow::QuitRequested() {
        
    app->Lock();
    app->Quit();
    app->Unlock();
    return true;
}
Exemplo n.º 2
0
BOOST_OBJECT_INSTALL

#include <boost/object/detail/defs/thread.hpp>

////////////////////////////////////////////////////////////////////////////////

BOOST_OBJECT_TEST_CASE(quit_application)
{
    BApplication app;
    app.quit(123);
    BOOST_CHECK(app.exec()==123);
}
Exemplo n.º 3
0
// main
int
main(int argc, char** argv)
{
	BApplication* app = new BApplication(kAppSignature);

	BRect frame(50.0, 50.0, 300.0, 250.0);
	show_window(frame, "BView Archiving Test");

	app->Run();

	delete app;
	return 0;
}
Exemplo n.º 4
0
// main
int
main(int argc, char** argv)
{
	BApplication* app = new BApplication("application/x.vnd-Haiku.CopyBits");

	BRect frame(50.0, 50.0, 300.0, 250.0);
	show_window(frame, "CopyBits Test");

	app->Run();

	delete app;
	return 0;
}
Exemplo n.º 5
0
int
main(int argc, char* argv[])
{
	BApplication	*app = new BApplication(kPrefSignature);

	PreferencesWindow<freq_preferences> *window;
	window = new PreferencesWindow<freq_preferences>(
		B_TRANSLATE_SYSTEM_NAME("CPUFrequency"), kPreferencesFileName,
		kDefaultPreferences);
	CPUFrequencyView* prefView
		= new CPUFrequencyView(BRect(0, 0, 400, 350), window);
	window->SetPreferencesView(prefView);
	window->Show();
	app->Run();

	delete app;
	return 0;
}
Exemplo n.º 6
0
/*
class QSlotStorage : public QObject {
public:
    QSlotStorage() { }
    void onClick() {
	printf("QSlotStorage::onClicked()\n");
	fflush(stdout);
    }
};
*/
int main() {
    BApplication *app = new BApplication("application/x.vnd-Lemon-Nirvana");
    TestWindow *test = new TestWindow( BRect(30,30,700,500), "test1" );
    QWidget *widget = test->RootWidget();
    QCheckBox *check = new QCheckBox( widget ); 
    check->resize(100,200);
    QSlotStorage *storage = new QSlotStorage();

    QObject::connect(check, SIGNAL(clicked()), new QSlot(storage, SLOT(onClick())));
    KWQSignal *signal = check->findSignal(SIGNAL(clicked()));
    //printf("%s\n",signal->_name);
    signal->call();

    check->setText("Label sd fsd fsd fsd fsd fsd fsd fsd fsd fsd fsd fsd fs dfs df sd fsd fs fd");
    check->move(100,100);

    test->Show();
    app->Run();
    return 0;
}
Exemplo n.º 7
0
int32 haiku_thread(void* data) {

    BRect b_rect;
    BApplication* app;
    WrapWindow* win;
    
    b_rect.left = 50;
    b_rect.top = 50;
    b_rect.right = 800;
    b_rect.bottom = 600;
    
    app = new BApplication("application/japp");
    win = new WrapWindow(b_rect, app);
    
    app->Run();
    
    delete app;
    global_halt = true;
    
    return B_OK;
}
Exemplo n.º 8
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 );
}
Exemplo n.º 9
0
int32 appthread(void *) {
	BApplication *fApp = new BApplication("application/x-vnd.beosgames.quake3");
	fApp->Run();
}
Exemplo n.º 10
0
// main
int
main(int argc, char** argv)
{
	BApplication* app = new BApplication(
		"application/x.vnd-Antares.ClippingRegion");

	BRect frame(50.0, 50.0, 300.0, 250.0);
	BWindow* window;
	BView* view;
	
//	window = new BWindow(frame, "Test1", B_TITLED_WINDOW,
//		B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);
//
//	view = new TestView1(window->Bounds(), "test1", B_FOLLOW_ALL,
//		B_WILL_DRAW);
//	window->AddChild(view);
//	window->Show();
//
//	frame.OffsetBy(20, 20);
//	window = new BWindow(frame, "Test2", B_TITLED_WINDOW,
//		B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);
//
//	view = new TestView2(window->Bounds(), "test2", B_FOLLOW_ALL,
//		B_WILL_DRAW);
//	window->AddChild(view);
//	window->Show();
//
//	frame.OffsetBy(20, 20);
//	window = new BWindow(frame, "Test3", B_TITLED_WINDOW,
//		B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);
//
//	view = new TestView3(window->Bounds(), "test3", B_FOLLOW_ALL,
//		B_WILL_DRAW);
//	window->AddChild(view);
//	window->Show();
//
//	frame.OffsetBy(20, 20);
//	window = new BWindow(frame, "Test4", B_TITLED_WINDOW,
//		B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);
//
//	view = new TestView4(window->Bounds(), "test4", B_FOLLOW_ALL,
//		B_WILL_DRAW);
//	window->AddChild(view);
//	window->Show();


	frame.OffsetBy(20, 20);
	window = new BWindow(frame, "Test5", B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);

	view = new TestView5(window->Bounds(), "test5", B_FOLLOW_ALL,
		B_WILL_DRAW);
	window->AddChild(view);
	window->Show();

	frame.OffsetBy(20, 20);
	window = new BWindow(frame, "Test6", B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);

	view = new TestView6(window->Bounds(), "test6", B_FOLLOW_ALL,
		B_WILL_DRAW);
	window->AddChild(view);
	window->Show();

	app->Run();

	delete app;
	return 0;
}
Exemplo n.º 11
0
status_t
DWindowHWInterface::SetMode(const display_mode& mode)
{
	AutoWriteLocker _(this);

	status_t ret = B_OK;
	// prevent from doing the unnecessary
	if (fFrontBuffer
		&& fDisplayMode.virtual_width == mode.virtual_width
		&& fDisplayMode.virtual_height == mode.virtual_height
		&& fDisplayMode.space == mode.space)
		return ret;

	// check if we support the mode

	display_mode *modes;
	uint32 modeCount, i;
	if (GetModeList(&modes, &modeCount) != B_OK)
		return B_NO_MEMORY;

	for (i = 0; i < modeCount; i++) {
		// we only care for the bare minimum
		if (modes[i].virtual_width == mode.virtual_width
			&& modes[i].virtual_height == mode.virtual_height
			&& modes[i].space == mode.space) {
			// take over settings
			fDisplayMode = modes[i];
			break;
		}
	}

	delete[] modes;

	if (i == modeCount)
		return B_BAD_VALUE;

	BRect frame(0.0, 0.0,
				fDisplayMode.virtual_width - 1,
				fDisplayMode.virtual_height - 1);

	// create the window if we don't have one already
	if (!fWindow) {
		// if the window has not been created yet, the BApplication
		// has not been created either, but we need one to display
		// a real BWindow in the test environment.
		// be_app->Run() needs to be called in another thread
		BApplication* app = new BApplication("application/x-vnd.antares-app-server");
		app->Unlock();

		thread_id appThread = spawn_thread(run_app_thread, "app thread",
										   B_NORMAL_PRIORITY, app);
		if (appThread >= B_OK)
			ret = resume_thread(appThread);
		else
			ret = appThread;

		if (ret < B_OK)
			return ret;

		fWindow = new DWindow(frame.OffsetByCopy(fXOffset, fYOffset), this,
			fFrontBuffer);

		// fire up the window thread but don't show it on screen yet
		fWindow->Hide();
		fWindow->Show();
	}

	if (fWindow->Lock()) {
		// free and reallocate the bitmaps while the window is locked,
		// so that the view does not accidentally draw a freed bitmap

		if (ret >= B_OK) {
			// change the window size and update the bitmap used for drawing
			fWindow->ResizeTo(frame.Width(), frame.Height());
		}

		// window is hidden when this function is called the first time
		if (fWindow->IsHidden())
			fWindow->Show();

		fWindow->Unlock();
	} else {
		ret = B_ERROR;
	}

	_UpdateFrameBufferConfig();
	_NotifyFrameBufferChanged();

	return ret;
}