当前位置: 首页>>代码示例>>C++>>正文


C++ BScreen::GetMode方法代码示例

本文整理汇总了C++中BScreen::GetMode方法的典型用法代码示例。如果您正苦于以下问题:C++ BScreen::GetMode方法的具体用法?C++ BScreen::GetMode怎么用?C++ BScreen::GetMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BScreen的用法示例。


在下文中一共展示了BScreen::GetMode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Leave

status_t
GlutGameMode::Enter()
{
	display_mode* mode = _FindMatchingMode();
	if (!mode)
		return B_BAD_VALUE;

	BScreen screen;
	if (!fActive) {
		// First enter: remember this workspace original mode...
		fGameModeWorkspace = current_workspace();
		screen.GetMode(fGameModeWorkspace, &fOriginalMode);
	}

	// Don't make it new default mode for this workspace...
	status_t status = screen.SetMode(fGameModeWorkspace, mode, false);
	if (status != B_OK)
		return status;

	// Retrieve the new active display mode, which could be
	// a sligth different than the one we asked for...
	screen.GetMode(fGameModeWorkspace, &fCurrentMode);

	if (!fGameModeWindow) {
		// create a new window
		fPreviousWindow = glutGetWindow();
		fGameModeWindow = glutCreateWindow("glutGameMode");
		if (!fGameModeWindow)
			return Leave();
	} else
		// make sure it's the current window
		glutSetWindow(fGameModeWindow);

	BDirectWindow *directWindow
		= dynamic_cast<BDirectWindow*>(gState.currentWindow->Window());
	if (directWindow == NULL)
		// Hum?!
		return B_ERROR;

	// Give it some useless title, except for debugging (thread name).
	BString name;
	name << "Game Mode " << fCurrentMode.virtual_width
		<< "x" << fCurrentMode.virtual_height
		<< ":" << _GetModePixelDepth(&fCurrentMode)
		<< "@" << _GetModeRefreshRate(&fCurrentMode);

	// force the game mode window to fullscreen
	directWindow->Lock();
	directWindow->SetTitle(name.String());
	directWindow->SetFullScreen(true);
	directWindow->Unlock();

	fDisplayChanged = true;
	fActive = true;

	return B_OK;
}
开发者ID:looncraz,项目名称:haiku,代码行数:57,代码来源:glutGameMode.cpp

示例2: restoreWorkspaceResolution

void restoreWorkspaceResolution()
{
	BScreen screen;
	display_mode displayMode;

	if (screen.GetMode(&displayMode) == B_OK && memcmp(&displayMode,&gDisplayMode,sizeof(display_mode)))
		screen.SetMode(&gDisplayMode);
}
开发者ID:Yamakuzure,项目名称:PUAE,代码行数:8,代码来源:be-UAE.cpp

示例3: set_display

void set_display(Display* dpy) {
  static Depth dlist[1];
  static Visual vlist[1];
  static Screen slist[1];
  static char vstring[] = "libB11";
  Colormap cmap = 0;

  BRect rect;
  display_mode mode;
  BScreen screen;
  screen.GetMode(&mode);
  
  memset(slist, 0, sizeof(Screen));

  dlist[0].depth = mode.space;
  dlist[0].nvisuals = 1;
  dlist[0].visuals  = vlist;

  vlist[0].ext_data     = NULL;
  vlist[0].visualid     = 0;
  vlist[0].c_class       = TrueColor;
  vlist[0].bits_per_rgb = 24;
  vlist[0].map_entries  = 256;
  vlist[0].red_mask     = 255;
  vlist[0].green_mask   = 255 << 8;
  vlist[0].blue_mask    = 255 << 16;
  rect = screen.Frame();
  slist[0].width       = static_cast<int>(rect.right - rect.left);
  slist[0].height      = static_cast<int>(rect.bottom - rect.top);
  slist[0].mwidth      = 260;
  slist[0].mheight     = 190;
  slist[0].ndepths     = 1;
  slist[0].depths      = dlist;
  slist[0].root_depth  = mode.space;
  slist[0].root_visual = vlist;
  slist[0].default_gc  = NULL;
  slist[0].cmap        = cmap;
  slist[0].white_pixel = 0xFFFFFF;
  slist[0].black_pixel = 0;

  slist[0].display = dpy;

  dpy->ext_data            = NULL;
  dpy->fd                  = 0;
  dpy->proto_major_version = 11;
  dpy->proto_minor_version = 4;
  dpy->vendor              = vstring;
  dpy->display_name        = vstring;
  dpy->nscreens            = 1;
  dpy->screens             = slist;
  dpy->max_keycode         = 255;
  dpy->qlen                = 0;
  dpy->head = dpy->tail    = NULL;
  dpy->qfree               = NULL;

  dpy->free_funcs = (_XFreeFuncRec *)Xcalloc(1, sizeof(_XFreeFuncRec));
}
开发者ID:HaikuArchives,项目名称:XBeLib,代码行数:57,代码来源:Display.cpp

示例4: ReadyToRun

void UAE::ReadyToRun(void)
{
	{
		BScreen screen;
		screen.GetMode(&gDisplayMode);
	}

	// Start the emulation thread
	fEmulationThread = spawn_thread(EmulationThreadFunc, "UAE 68k", B_NORMAL_PRIORITY, this);
	resume_thread(fEmulationThread);
}
开发者ID:Yamakuzure,项目名称:PUAE,代码行数:11,代码来源:be-UAE.cpp

示例5: Show

void AboutWindow::Show() {
	BScreen *screen = new BScreen( this );
	display_mode mode;
	screen->GetMode( &mode );
	/* we center a window */
	int32 width = (int32)( ABOUTWINDOW_RECT.right - ABOUTWINDOW_RECT.left );
	int32 height = (int32)( ABOUTWINDOW_RECT.bottom - ABOUTWINDOW_RECT.top );
	/* calculating center of a screen /2 - 1/2 of window width */
	int32 x_wind = mode.timing.h_display/2 - ( width/2 );
	/* calculating center of a screen /2 - 1/2 of window height */
	int32 y_wind = mode.timing.v_display/2 - ( height/2 );
	MoveTo( x_wind, y_wind );
	BWindow::Show();
}
开发者ID:louisdem,项目名称:beos-begadu,代码行数:14,代码来源:About.cpp

示例6: BRect


//.........这里部分代码省略.........
		/* Panic! */
		exit(1);
	}
	colorControl->GetPreferredSize( &width, &height );
	colorControl->ResizeTo( width, height );
	colorControl->SetTarget( this );
	item = layout->AddView( colorControl, 0, 1, 3, 1 );
	if ( !item ) { /* Panic! */ exit(1); }
	item->SetExplicitAlignment( BAlignment( B_ALIGN_USE_FULL_WIDTH, B_ALIGN_TOP ) );

	// Construct last two buttons
	// Revert button
	toSend = new BMessage( kColorReverted );
	if ( !toSend ) { /* Panic! */ exit(1); }
	revertButton = new BButton( BRect( 0, 0, 1, 1),
								"Revert button",
								"Revert",
								toSend );
	if ( !revertButton ) { /* Panic! */ exit(1); }
	revertButton->ResizeToPreferred();
	
	// Ok button
	toSend = new BMessage( kColorSelected );
	if ( !toSend ) { /* Panic! */ exit(1); }
	okButton = new BButton( BRect( 0, 0, 1, 1),
						    "Ok button",
						    "Ok",
						    toSend,
						    B_FOLLOW_RIGHT | B_FOLLOW_TOP );
	if ( !okButton ) { /* Panic! */ exit(1); }
	okButton->ResizeToPreferred();
	
	// Attach the buttons to current layout
	item = layout->AddView( revertButton, 0, 2 );
	if ( ! item ) { /* Panic! */ exit(1); }
	item->SetExplicitAlignment( BAlignment( B_ALIGN_LEFT, B_ALIGN_MIDDLE ) );
		// Note I'm skipping one cell - this is for showing current color!
	item = layout->AddView( okButton, 2, 2 );
	if ( ! item ) { /* Panic! */ exit(1); }
	item->SetExplicitAlignment( BAlignment( B_ALIGN_RIGHT, B_ALIGN_MIDDLE ) );
	
	// Make "Ok" button the default
	okButton->MakeDefault( true );
	
	// Now, find the correct place for this window. 
	// We have one of the corners from constructor, we need to position the window
	// in such manner that it will be fully visible and keep one of the corners in
	// the specified point.
	layout->Relayout( true );
	layoutSize = layout->PreferredSize();
	this->ResizeTo( layoutSize.width, layoutSize.height );
	background->ResizeTo( layoutSize.width, layoutSize.height );
	
	float windowWidth = layoutSize.width, windowHeight = layoutSize.height;
	BScreen* mainScreen = new BScreen( currentScreen ); // Get access to current screen
	display_mode currentDisplayMode;
	mainScreen->GetMode( &currentDisplayMode );		// Obtain the width and height of screen
	
	// The following booleans uniquely define where the window be located regarding
	// given corner.
	bool leftFromCorner = false, upFromCorner = false;
	
	// Check where the window should span regarding to the corner
	if ( corner.x + windowWidth >= currentDisplayMode.virtual_width )
	{
		if ( corner.x - windowWidth < 0 )
		{
			corner.x = 0;
			leftFromCorner = false;
		}
		else
		{
			leftFromCorner = true;
		}
	}
	
	if ( corner.y + windowHeight >= currentDisplayMode.virtual_height )
	{
		if ( corner.y - windowHeight < 0 )
		{
			corner.y = 0;
			upFromCorner = false;
		}
		else
		{
			upFromCorner = true;
		}	
	}
	
	// Calculate new top-left corner of the window
	if ( leftFromCorner ) 	{ corner.x -= windowWidth; }
	if ( upFromCorner )		{ corner.y -= windowHeight; }
	
	// Move the window to calculated position
	this->MoveTo( corner );
	
	// Show the window
	this->Show();
	colorControl->Invoke();
}	// <-- end of constructor for ColorUpdateWindow
开发者ID:BackupTheBerlios,项目名称:haiku-pim-svn,代码行数:101,代码来源:CategoryItem.cpp

示例7: MessageReceived

void BeGadu::MessageReceived( BMessage *aMessage ) {
	switch( aMessage->what ) {
		/* sending mesgs from libgadu to network */
		case GOT_MESSAGE:
		case ADD_HANDLER:
		case DEL_HANDLER:
			BMessenger( iWindow->GetNetwork() ).SendMessage( aMessage );
			break;
		case ADD_MESSENGER:
			DEBUG_TRACE( "BeGadu::MessageReceived( ADD_MESSENGER )\n" );
			aMessage->FindMessenger( "messenger", &iMessenger );
			if( iWindow ) {
				iWindow->SetMessenger( iMessenger );
				BMessenger( iMessenger ).SendMessage( PROFILE_SELECTED );
			}
			break;
		case SET_AVAIL:
		case SET_BRB:
		case SET_INVIS:
		case SET_NOT_AVAIL:
		case SET_DESCRIPTION:
		case BEGG_ABOUT:
		case SHOW_MAIN_WINDOW:
		case CHANGE_DESCRIPTION:
		case PREFERENCES_SWITCH:
			if( iWindow )
				BMessenger( iWindow ).SendMessage( aMessage );
			break;
		case OPEN_PROFILE_WIZARD:
			{
			DEBUG_TRACE( "BeGadu::MessageReceived( OPEN_PROFILE_WIZARD )\n" );
//			if( iProfileSelector )
//				iProfileSelector = NULL;
			if( iWindow ) {
				BMessenger( iWindow ).SendMessage( new BMessage( CLOSE_MAIN_WINDOW ) );
				if( iWindow->Lock() )
					iWindow->Quit();
				iWindow = NULL;
			}
			ProfileWizard *pw = new ProfileWizard();
			pw->Show();
			break;
			}
		case CONFIG_OK:
			{
			DEBUG_TRACE( "BeGadu::MessageReceived( CONFIG_OK )\n" );
			iReadyToRun = true;
			AddDeskbarIcon();
			Profile *profile = new Profile();
			int ret = profile->Load( iLastProfile );
			if( ret != 0 ) {
				delete profile;
				BMessenger( be_app ).SendMessage( new BMessage( PROFILE_SELECT ) );
				break;
			}
			if( strcmp( profile->GetProfilePassword(), "" ) != 0 ) {
				BResources res;
				BRoster roster;
				entry_ref ref;
				BFile resfile;
				roster.FindApp( APP_MIME, &ref );
				resfile.SetTo( &ref, B_READ_ONLY );
				res.SetTo( &resfile );
				BScreen *screen = new BScreen( B_MAIN_SCREEN_ID );
				display_mode mode;
				screen->GetMode( &mode );
//				int32 width = 250;
//				int32 height = 110; // 70
//				int32 x_wind = mode.timing.h_display / 2 - ( width / 2);
//				int32 y_wind = mode.timing.v_display / 2 - ( height / 2 );
//				int32 new_width = x_wind + width;	// x 2
//				int32 new_height = y_wind + height;		// x 2
				BMessenger( iMessenger ).SendMessage( new BMessage( PROFILE_NOT_SELECTED ) );
//				iProfileSelector = new ProfileSelector( iLastProfile, BRect( x_wind, y_wind, new_width, new_height ), &res );
//				if( iProfileSelector->LockLooper() ) {
//					iProfileSelector->Show();
//					iProfileSelector->UnlockLooper();
//				}
			} else {
				BMessenger( iMessenger ).SendMessage( new BMessage( PROFILE_SELECTED ) );
				iWindow = new MainWindow( iLastProfile );
				if( !iHideAtStart ) {
					if( iWindow->LockLooper() ) {
						iWindow->Show();
						iWindow->UnlockLooper();
					}
				} else {
					if( iWindow->LockLooper() ) {
						iWindow->Show();
						iWindow->Hide();
						iWindow->UnlockLooper();
					}
				}
			}
			break;
			}
		case PROFILE_CREATED:
			DEBUG_TRACE( "BeGadu::MessageReceived( PROFILE_CREATED )\n" );
			iReadyToRun = true;
			AddDeskbarIcon();
//.........这里部分代码省略.........
开发者ID:louisdem,项目名称:beos-begadu,代码行数:101,代码来源:BeGadu.cpp

示例8: BMessage

Preferences::Preferences( Profile* aProfile, MainWindow* aWindow, BRect aRect, BResources* aRes ) : BWindow( aRect, PREFERENCES_NAME, B_FLOATING_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS )
	{

	BScreen *screen = new BScreen( this );
	display_mode mode;
	screen->GetMode( &mode );
	int32 width = 500;
	int32 height = 420;
	int32 x_wind = mode.timing.h_display / 2 - ( width / 2);
	int32 y_wind = mode.timing.v_display / 2 - ( height / 2 );
	delete screen;

	MoveTo(x_wind,y_wind);
	ResizeTo(width,height);
	SetTitle(_T(PREFERENCES_NAME));

	iProfile = aProfile;
	iWindow = aWindow;
	iResources = aRes;
	BRect r = Bounds();

	iLogoView = new BitmapView( BRect( r.left , r.top,
									   r.left + 600, r.top + 150 ),
									   "logo", aRes );
	AddChild( iLogoView );
	
	r.left = 20;
	r.top = 100;
	r.right = r.left + 250;
	r.bottom = r.top + 25;
	iNumberControl = new BTextControl( r, "iNumberControl", "Numer GG:", "0", NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE );
	AddChild( iNumberControl );
	r.left = 20;
	r.right = r.left + 250;
	r.top = 130;
	r.bottom = r.top + 25;
	iPasswordControl = new BTextControl( r, "iPasswordControl", "Haslo:", "", NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE );
	AddChild( iPasswordControl );
	r = Bounds();
	BButton *przycisk;
    przycisk = new BButton( BRect( r.left + 360, r.bottom - 30,
    							   r.left + 440, r.bottom - 5),
    							   "przycisk ok", "Ok",
    							   new BMessage( PREFERENCES_OK ) );
    przycisk->MakeDefault(true);
    AddChild(przycisk);
    
    przycisk = new BButton( BRect( r.left + 270, r.bottom - 30,
    							   r.left + 350, r.bottom - 5),
    							   "przycisk anuluj", "Anuluj",
    							   new BMessage( PREFERENCES_CANCEL ) );
    AddChild(przycisk);

	/* pobieramy aktualna konfiguracje */

    if( iNumberControl->LockLooper() )
    	{
		BString a;
		a << (int32) iProfile->GetUIN();
        iNumberControl->SetText( a.String() );
        iPasswordControl->SetText( iProfile->GetPassword() );
		fprintf( stderr, "numer: %s\nhaslo: %s\n", a.String(), iProfile->GetPassword() );
        iNumberControl->UnlockLooper();
    	}
	}
开发者ID:louisdem,项目名称:beos-begadu,代码行数:65,代码来源:Preferences.cpp

示例9: if

Description::Description( MainWindow* aWindow, BRect aRect, BResources* aRes )
	: BWindow( aRect,
			   "",
			   B_FLOATING_WINDOW,
			   B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS )
	{
	BScreen *screen = new BScreen( this );
	display_mode mode;
	screen->GetMode( &mode );
	delete screen;

	int32 width = 250;
	int32 height = 140;
	int32 x_wind = mode.timing.h_display / 2 - ( width / 2);
	int32 y_wind = mode.timing.v_display / 2 - ( height / 2 );
	MoveTo(x_wind,y_wind);
	ResizeTo(width,height);

	SetTitle( _T( DESCRIPTION_NAME ) );
	iWindow = aWindow;
	iResources = aRes;

	BRect r = Bounds();
	r.left = 5;
	r.right = r.right - 5;
	r.top = 5;
	r.bottom = r.bottom - 40;
	iBox = new BBox( r, "Description box" );

	r = iBox->Bounds();
	r.left = 3;
	r.right = r.left + 25;
	r.top = 3;
	r.bottom = r.bottom - 3;
	iIconsView = new IconsView( r, iResources );
	iBox->AddChild( iIconsView );
	AddChild( iBox );

	r = iBox->Bounds();
	r.left = r.left + 30;
	r.right = r.left + 15;
	r.top = 7;
	r.bottom = r.top + 12;
	iAvail = new BRadioButton( r, "AvailDesc", "", new BMessage( SET_AVAIL ) );
	iBox->AddChild( iAvail );

	r = iBox->Bounds();
	r.left = r.left + 30;
	r.right = r.left + 15;
	r.top = 27;
	r.bottom = r.top + 12;
	iBusy = new BRadioButton( r, "BusyDesc", "", new BMessage( SET_BRB ) );
	iBox->AddChild( iBusy );

	r = iBox->Bounds();
	r.left = r.left + 30;
	r.right = r.left + 15;
	r.top = 47;
	r.bottom = r.top + 12;
	iInvisible = new BRadioButton( r, "InvisibleDesc", "", new BMessage( SET_INVIS ) );
	iBox->AddChild( iInvisible );

	r = iBox->Bounds();
	r.left = r.left + 30;
	r.right = r.left + 15;
	r.top = 67;
	r.bottom = r.top + 12;
	iNotAvail = new BRadioButton( r, "NotAvailDesc", "", new BMessage( SET_NOT_AVAIL ) );
	iBox->AddChild( iNotAvail );

	r = iBox->Bounds();
	r.left = r.left + 50;
	r.right = r.right - 3;
	r.top = r.top + 3;
	r.bottom = r.bottom - 3;
	BRect t = iBox->Bounds();
	t.right = t.right - 60;
	iDescription = new BTextView( r, "DescriptionTextView", t, B_FOLLOW_ALL, B_WILL_DRAW );
	iDescription->SetMaxBytes( 160 );
	iBox->AddChild( iDescription );

	r = Bounds();
	r.left = r.right - 140;
	r.right = r.right - 75;
	r.top = r.bottom - 30;
	r.bottom = -5;
	BButton *button;
    button = new BButton( r, "change button", _T("Change"), new BMessage( DESCRIPTION_OK ) );
    button->MakeDefault( true );
    AddChild( button );

    r = Bounds();
	r.left = r.right - 65;
	r.right = r.right -5;
	r.top = r.bottom - 30;
	r.bottom = -5;

    button = new BButton( r, "cancel button", _T("Cancel"), new BMessage( DESCRIPTION_CANCEL ) );
    AddChild( button );

//.........这里部分代码省略.........
开发者ID:louisdem,项目名称:beos-begadu,代码行数:101,代码来源:Description.cpp


注:本文中的BScreen::GetMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。