예제 #1
0
void CInternalSettingsView::AttachedToWindow()
{
	BView::AttachedToWindow();

	SetViewColor(CColor::BeBackgroundGray);
	FrameResized(Bounds().Width(), Bounds().Height());
}
예제 #2
0
파일: ViewObject.cpp 프로젝트: mariuz/haiku
/*	FUNCTION:		ViewObject :: ViewObject
	ARGUMENTS:		frame
	RETURN:			n/a
	DESCRIPTION:	Constructor
*/
ViewObject :: ViewObject(BRect frame)
	: BGLView(frame, (char *) "3Dmov_view", B_FOLLOW_ALL_SIDES, 0, BGL_RGB | BGL_DOUBLE | BGL_DEPTH)
{
	sCountViewObjects++;
		
	FrameResized(frame.Width(), frame.Height());
}
예제 #3
0
void
CStatusBar::AttachedToWindow()
{
	D_HOOK(("CStatusBar::AttachedToWindow()\n"));

	FrameResized(Bounds().Width(), Bounds().Height());
}
예제 #4
0
vdesignview::vdesignview(BRect rect, char *name, uint32 resizingMode, uint32 flags)
	   	   : BView(rect, name, resizingMode, flags)
{
	//define objects
	vwMain = new BView(BRect(0,0,rect.Width()-B_V_SCROLL_BAR_WIDTH,rect.Height()-B_H_SCROLL_BAR_HEIGHT),  "vwMain", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
	scrDes = new BScrollView("scrDes", vwMain, 0, B_FOLLOW_ALL_SIDES, true, true, B_NO_BORDER);
	vwDes = new designview(BRect(0,0,470,580),  "vwDes", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
	strStatus = new BStringView(BRect(4,rect.Height()-B_H_SCROLL_BAR_HEIGHT+1,120,rect.Height()), "strStatus", "", B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW);

	// set objects
	vwMain->SetViewColor(bright);
	vwDes->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	scrDes->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	scrDes->ScrollBar(B_HORIZONTAL)->ResizeBy(-125,0);
	scrDes->ScrollBar(B_HORIZONTAL)->MoveBy(125,0);

	//add objects
	AddChild(scrDes);
	vwMain->AddChild(vwDes);
	scrDes->AddChild(strStatus);

	//hack to resize our scrollers
	FrameResized(Bounds().right, Bounds().bottom);
		
}
예제 #5
0
void
MimeTypeListView::ShowIcons(bool showIcons)
{
	if (showIcons == fShowIcons)
		return;

	fShowIcons = showIcons;

	if (Window() == NULL)
		return;

	// update items

	BFont font;
	GetFont(&font);

	for (int32 i = FullListCountItems(); i-- > 0;) {
		MimeTypeItem* item = dynamic_cast<MimeTypeItem*>(FullListItemAt(i));
		if (item == NULL)
			continue;

		if (!item->IsSupertypeOnly())
			item->ShowIcon(showIcons);

		item->Update(this, &font);
	}

	FrameResized(Bounds().Width(), Bounds().Height());
		// update scroller

	Invalidate();
}
예제 #6
0
void CounterView::Animate (void)
{
  m_CurrentCount++;
  if (m_CurrentCount >= m_StringResizeNeededCount)
  {
    m_StringResizeNeededCount *= 10;
    FrameResized (m_BndRect.right - m_BndRect.left,
      m_BndRect.bottom - m_BndRect.top);
  }

  // Move the dot around the edge of the window, counterclockwise.
  
  if (m_MovingDotPoint.x  <= m_BndRect.left) // Moving along left side.
  {
    m_MovingDotPoint.x  = m_BndRect.left;
    if (m_MovingDotPoint.y + m_MovingDotSize >= m_BndRect.bottom)
    {
      m_MovingDotPoint.y = m_BndRect.bottom - m_MovingDotSize;
      m_MovingDotPoint.x = m_BndRect.left + m_MoveSpeed;
    }
    else
      m_MovingDotPoint.y += m_MoveSpeed;
  }
  else if (m_MovingDotPoint.y <= m_BndRect.top) // Moving along top side.
  {
    m_MovingDotPoint.y = m_BndRect.top;
    if (m_MovingDotPoint.x <= m_BndRect.left)
    {
      m_MovingDotPoint.y = m_BndRect.top + m_MoveSpeed;
      m_MovingDotPoint.x = m_BndRect.left;
    }
    else
      m_MovingDotPoint.x -= m_MoveSpeed;
  }
  else if (m_MovingDotPoint.y + m_MovingDotSize >= m_BndRect.bottom) // Moving along bottom side.
  {
    m_MovingDotPoint.y = m_BndRect.bottom - m_MovingDotSize;
    if (m_MovingDotPoint.x + m_MovingDotSize >= m_BndRect.right)
    {
      m_MovingDotPoint.y = m_BndRect.bottom - m_MovingDotSize - m_MoveSpeed;
      m_MovingDotPoint.x = m_BndRect.right - m_MovingDotSize;
    }
    else
      m_MovingDotPoint.x += m_MoveSpeed;
  }
  else // Moving along right side.
  {
    m_MovingDotPoint.x = m_BndRect.right - m_MovingDotSize;
    if (m_MovingDotPoint.y <= m_BndRect.top)
    {
      m_MovingDotPoint.y = m_BndRect.top;
      m_MovingDotPoint.x = m_BndRect.right - m_MovingDotSize - m_MoveSpeed;
    }
    else
      m_MovingDotPoint.y -= m_MoveSpeed;
  }

  Invalidate ();
}
예제 #7
0
// constructor
ColorField::ColorField(BPoint offsetPoint, SelectedColorMode mode,
	float fixedValue, orientation orient, border_style border)
	: BControl(BRect(0.0, 0.0, MAX_X + 4.0, MAX_Y + 4.0)
			.OffsetToCopy(offsetPoint),
		"ColorField", "", new BMessage(MSG_COLOR_FIELD),
		B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS)
{
	_Init(mode, fixedValue, orient, border);
	FrameResized(Bounds().Width(), Bounds().Height());
}
예제 #8
0
파일: Group.cpp 프로젝트: AmirAbrams/haiku
void
Group::SetSpacing(float insetFromBorder, float childSpacing)
{
	if (fSpacing == childSpacing && fInset == insetFromBorder)
		return;

	fInset = insetFromBorder;
	fSpacing = childSpacing;
	// trigger a layout
	FrameResized(Bounds().Width(), Bounds().Height());
}
예제 #9
0
/*****************************************************************************
 * VideoWindow::SetCorrectAspectRatio
 *****************************************************************************/
void
VideoWindow::SetCorrectAspectRatio(bool doIt)
{
    if (CorrectAspectRatio() != doIt)
    {
        if (doIt)
            fSettings->AddFlags(VideoSettings::FLAG_CORRECT_RATIO);
        else
            fSettings->ClearFlags(VideoSettings::FLAG_CORRECT_RATIO);
        FrameResized(Bounds().Width(), Bounds().Height());
    }
}
예제 #10
0
void
ActivityView::AttachedToWindow()
{
	Looper()->AddHandler(fSystemInfoHandler);
	fSystemInfoHandler->StartWatching();

	fRefreshSem = create_sem(0, "refresh sem");
	fRefreshThread = spawn_thread(&_RefreshThread, "source refresh",
		B_URGENT_DISPLAY_PRIORITY, this);
	resume_thread(fRefreshThread);

	FrameResized(Bounds().Width(), Bounds().Height());
}
예제 #11
0
/***********************************************************
 *	CLASS:		GlutWindow
 *
 *	FUNCTION:	Draw
 *
 *	DESCRIPTION:  handles reshape and display events
 ***********************************************************/
void GlutWindow::Draw(BRect updateRect)
{
	BGLView::Draw(updateRect);
	BRect frame = Frame();
	if (m_width != (frame.Width()+1) || m_height != (frame.Height()+1)) {
		FrameResized(frame.Width(), frame.Height());
	}
	Window()->Lock();
	if (visible) {
		anyevents = displayEvent = true;
		gBlock.NewEvent();
	}
	Window()->Unlock();
}
예제 #12
0
void
MainWin::ToggleKeepAspectRatio()
{
	printf("ToggleKeepAspectRatio enter\n");
	fKeepAspectRatio = !fKeepAspectRatio;

	fFrameResizedTriggeredAutomatically = true;
	FrameResized(Bounds().Width(), Bounds().Height());
//	if (fIsFullscreen) {
//		AdjustFullscreenRenderer();
//	} else {
//		AdjustWindowedRenderer(false);
//	}
	printf("ToggleKeepAspectRatio leave\n");
}
예제 #13
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();
}
예제 #14
0
void
ActivityView::AttachedToWindow()
{
	if (Parent() && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0)
		_LoadBackgroundInfo(true);

	Looper()->AddHandler(fSystemInfoHandler);
	fSystemInfoHandler->StartWatching();

	fRefreshSem = create_sem(0, "refresh sem");
	fRefreshThread = spawn_thread(&_RefreshThread, "source refresh",
		B_URGENT_DISPLAY_PRIORITY, this);
	resume_thread(fRefreshThread);

	FrameResized(Bounds().Width(), Bounds().Height());
}
예제 #15
0
 CounterView (BRect FrameSize) : BView (FrameSize, "CounterView", B_FOLLOW_ALL_SIDES,
  B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED),
   m_MovingDotPoint (10, 20),
   m_BackingView (FrameSize, "BackingView", B_FOLLOW_ALL_SIDES, B_FULL_UPDATE_ON_RESIZE)
 {
   m_CurrentCount = 0;
   m_StringResizeNeededCount = 10;
   m_BackingBitmap = NULL;
   SetViewColor (B_TRANSPARENT_COLOR);
   FrameResized (FrameSize.right, FrameSize.bottom); // Set m_TextStartPoint.
   ViewPulseThreadID = spawn_thread (ViewPulserCode,
     "CounterViewPulser", 80 /* Priority */, this); // Creates but doesn't start.
   m_InputDeviceMousePntr = find_input_device ("VNC Fake Mouse");
   m_InputDeviceKeyboardPntr = find_input_device ("VNC Fake Keyboard");
   m_EventTriggerCounter = 0;
 };
예제 #16
0
파일: AlphaSlider.cpp 프로젝트: DonCN/haiku
// constructor
AlphaSlider::AlphaSlider(orientation dir, BMessage* message)
	: BControl(dir == B_HORIZONTAL ? BRect(0, 0, 255 + 4, 7 + 4)
								   : BRect(0, 0, 7 + 4, 255 + 4),
			   "alpha slider", NULL, message,
								   
			   B_FOLLOW_NONE,
			   B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE),

	  fBitmap(NULL),
	  fColor(kBlack),
	  fDragging(false),
	  fOrientation(dir)
{
	FrameResized(Bounds().Width(), Bounds().Height());

	SetViewColor(B_TRANSPARENT_32_BIT);
	SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	SetValue(255);
}
예제 #17
0
void CMassView::AttachedToWindow()													//	called when added to window
{
	GLfloat light_position[] = {0.0, 3.0, 4.0, 0.0};								// position of light source (at infinity)			
	GLfloat light_colour[] = {1.0, 1.0, 1.0, 0.0};									//	colour of light source

	GLfloat torus_colour[] = {1.0, 1.0, 1.0, 0.0};									// set the torus to green								
//	GLfloat torus_specular_colour[] = {1.0, 1.0, 1.0, 0.0};							// and set shininess up a little bit
	BGLView::AttachedToWindow();													//	call inherited attachment function
	LockGL();																		//	make sure this is thread-safe

	glMatrixMode(GL_PROJECTION);													//	first set up matrix for the viewing volume	
	glOrtho(-240.0, 240.0, -200.0, 200.0, -1000.0, 1000.0);							//	set the perspective									
 	glMatrixMode(GL_MODELVIEW);														// switch to matrix for basis vectors at eye		
	glLoadIdentity();																//	load the identity matrix
	glTranslatef(0, 0, -600.0);														//	translate the model matrix									
//	glRotatef(30.0, 0.0, 1.0, 0.0);													//	rotate the torus
	torusPickListID = glGenLists(2);												//	set up a total of 1 display list					
	glNewList(torusPickListID, GL_COMPILE);											//	tell it to save the following calls			
	CreateTorus(100.0, 50.0, GL_SELECT);											//	set up a list for rendering
	glEndList();																	// close the list											
	glShadeModel(GL_SMOOTH);														// use smooth lighting										
	glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, torus_colour);					// set the colour of the torus						
	glLightfv(GL_LIGHT0, GL_POSITION, light_position);								// specify the position of the light				
	glLightfv(GL_LIGHT0, GL_DIFFUSE, light_colour);									//	and the colour
	glEnable(GL_LIGHTING);															// switch lighting on									
	glEnable(GL_LIGHT0);															// switch light #0 on									
	glEnable(GL_DEPTH_TEST);														//	make sure depth buffer is switched on			
	glEnable(GL_TEXTURE_2D);														//	enable 2D textures
	glPixelStorei(GL_UNPACK_ALIGNMENT, 1);											//	set the pixel alignment
	glGenTextures(1, &texName);														//	create the GL texture "name"
	glBindTexture(GL_TEXTURE_2D, texName);											//	mark it as 2D
	
	torusDisplayListID = torusPickListID + 1;										//	we know this name is available
	glNewList(torusDisplayListID, GL_COMPILE);										//	tell it to save the following calls				
	CreateTorus(100.0, 50.0, GL_RENDER);											//	set up a list for rendering
	glEndList();																	// close the list											
	UnlockGL();																		//	unlock GL

	FrameResized(Bounds().Width(), Bounds().Height());
	
} // end of AttachedToWindow()
예제 #18
0
파일: CalcView.cpp 프로젝트: ysei/haiku
void
CalcView::AttachedToWindow()
{
	if (be_control_look == NULL)
		SetFont(be_bold_font);

	BRect frame(Frame());
	FrameResized(frame.Width(), frame.Height());

	bool addKeypadModeMenuItems = true;
	if (Parent() && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0) {
		// don't add these items if we are a replicant on the desktop
		addKeypadModeMenuItems = false;
	}

	// create and attach the pop-up menu
	_CreatePopUpMenu(addKeypadModeMenuItems);

	if (addKeypadModeMenuItems)
		SetKeypadMode(fOptions->keypad_mode);
}
예제 #19
0
void
DataView::SetFontSize(float point)
{
	bool fit = (point == 0.0f);
	if (fit) {
		if (!fFitFontSize)
			SendNotices(kDataViewPreferredSize);
		fFitFontSize = fit;

		FrameResized(Bounds().Width(), Bounds().Height());
		return;
	}

	fFitFontSize = false;

	BFont font = be_fixed_font;
	font.SetSize(point);

	SetFont(&font);
	UpdateScroller();
	Invalidate();

	SendNotices(kDataViewPreferredSize);
}
예제 #20
0
/*****************************************************************************
 * PlayListWindow::PlayListWindow
 *****************************************************************************/
PlayListWindow::PlayListWindow( BRect frame, const char* name,
                                InterfaceWindow* mainWindow,
                                intf_thread_t *p_interface )
    :   BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
                 B_WILL_ACCEPT_FIRST_CLICK | B_ASYNCHRONOUS_CONTROLS ),
        fMainWindow( mainWindow )
{
    char psz_tmp[1024];
#define ADD_ELLIPSIS( a ) \
    memset( psz_tmp, 0, 1024 ); \
    snprintf( psz_tmp, 1024, "%s%s", a, B_UTF8_ELLIPSIS );

    p_intf = p_interface;
 
    SetName( _("playlist") );

    // set up the main menu bar
    fMenuBar = new BMenuBar( BRect(0.0, 0.0, frame.Width(), 15.0), "main menu",
                             B_FOLLOW_NONE, B_ITEMS_IN_ROW, false );

    AddChild( fMenuBar );

    // Add the File menu
    BMenu *fileMenu = new BMenu( _("File") );
    fMenuBar->AddItem( fileMenu );
    ADD_ELLIPSIS( _("Open File") );
    BMenuItem* item = new BMenuItem( psz_tmp, new BMessage( OPEN_FILE ), 'O' );
    item->SetTarget( fMainWindow );
    fileMenu->AddItem( item );

    CDMenu* cd_menu = new CDMenu( _("Open Disc") );
    fileMenu->AddItem( cd_menu );

    fileMenu->AddSeparatorItem();
    item = new BMenuItem( _("Close"),
                          new BMessage( B_QUIT_REQUESTED ), 'W' );
    fileMenu->AddItem( item );

    // Add the Edit menu
    BMenu *editMenu = new BMenu( _("Edit") );
    fMenuBar->AddItem( editMenu );
    fSelectAllMI = new BMenuItem( _("Select All"),
                                  new BMessage( MSG_SELECT_ALL ), 'A' );
    editMenu->AddItem( fSelectAllMI );
    fSelectNoneMI = new BMenuItem( _("Select None"),
                                   new BMessage( MSG_SELECT_NONE ), 'A', B_SHIFT_KEY );
    editMenu->AddItem( fSelectNoneMI );

    editMenu->AddSeparatorItem();
    fSortReverseMI = new BMenuItem( _("Sort Reverse"),
                                 new BMessage( MSG_SORT_REVERSE ), 'F' );
    editMenu->AddItem( fSortReverseMI );
    fSortNameMI = new BMenuItem( _("Sort by Name"),
                                 new BMessage( MSG_SORT_NAME ), 'N' );
fSortNameMI->SetEnabled( false );
    editMenu->AddItem( fSortNameMI );
    fSortPathMI = new BMenuItem( _("Sort by Path"),
                                 new BMessage( MSG_SORT_PATH ), 'P' );
fSortPathMI->SetEnabled( false );
    editMenu->AddItem( fSortPathMI );
    fRandomizeMI = new BMenuItem( _("Randomize"),
                                  new BMessage( MSG_RANDOMIZE ), 'R' );
fRandomizeMI->SetEnabled( false );
    editMenu->AddItem( fRandomizeMI );
    editMenu->AddSeparatorItem();
    fRemoveMI = new BMenuItem( _("Remove"),
                          new BMessage( MSG_REMOVE ) );
    editMenu->AddItem( fRemoveMI );
    fRemoveAllMI = new BMenuItem( _("Remove All"),
                                  new BMessage( MSG_REMOVE_ALL ) );
    editMenu->AddItem( fRemoveAllMI );

    // Add View menu
    fViewMenu = new BMenu( _("View") );
    fMenuBar->AddItem( fViewMenu );

    fViewMenu->SetRadioMode( true );
    BMessage* message = new BMessage( MSG_SET_DISPLAY );
    message->AddInt32( "mode", DISPLAY_PATH );
    item = new BMenuItem( _("Path"), message );
    item->SetMarked( true );
    fViewMenu->AddItem( item );

    message = new BMessage( MSG_SET_DISPLAY );
    message->AddInt32( "mode", DISPLAY_NAME );
    item = new BMenuItem( _("Name"), message );
    fViewMenu->AddItem( item );

    // make menu bar resize to correct height
    float menuWidth, menuHeight;
    fMenuBar->GetPreferredSize( &menuWidth, &menuHeight );
    // don't change next line! it's a workarround!
    fMenuBar->ResizeTo( frame.Width(), menuHeight );

    frame = Bounds();
    frame.top += fMenuBar->Bounds().IntegerHeight() + 1;
    frame.right -= B_V_SCROLL_BAR_WIDTH;

    fListView = new PlaylistView( p_intf, frame, fMainWindow,
                                  new BMessage( MSG_SELECTION_CHANGED ) );
    fBackgroundView = new BScrollView( "playlist scrollview",
                                       fListView, B_FOLLOW_ALL_SIDES,
                                       0, false, true,
                                       B_NO_BORDER );

    AddChild( fBackgroundView );

    // be up to date
    UpdatePlaylist();
    FrameResized( Bounds().Width(), Bounds().Height() );
    SetSizeLimits( menuWidth * 1.5, menuWidth * 8.0,
                   menuHeight * 5.0, menuHeight * 50.0 );

    UpdatePlaylist( true );
    // start window thread in hidden state
    Hide();
    Show();
}
예제 #21
0
파일: CalcView.cpp 프로젝트: ysei/haiku
void
CalcView::ResizeTo(float width, float height)
{
	BView::ResizeTo(width, height);
	FrameResized(width, height);
}
예제 #22
0
파일: Group.cpp 프로젝트: AmirAbrams/haiku
// AttachedToWindow
void
Group::AttachedToWindow()
{
	// trigger a layout
	FrameResized(Bounds().Width(), Bounds().Height());
}
// ==============================================================================
GlSpectrumAnalyzerWindow::GlSpectrumAnalyzerWindow(SoundPlayController *ctrl)
	: BDirectGLWindow(
//		BRect(200,100,199+640,99+480),
//		BRect(200,100,199+640,99+480),
		BRect( 100.0, 100.0, 739.0, 579.0 ),	// 640x480
		"OpenGL"B_UTF8_REGISTERED" Spectrum Analyzer",
		B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS/*|B_NOT_RESIZABLE|B_NOT_ZOOMABLE*/),
	name(NULL),
	xrot(10.0),
	yrot(35.0),
	zrot(0.0),
	needResize(false),
	opengl_device(BGL_DEVICE_SOFTWARE)
{
	controller=ctrl;
	controller->AddWindow(this);	// let SoundPlay handle some hotkeys for this window

	bView=new BView(Bounds(),"view",B_FOLLOW_ALL_SIDES, 0);
	bView->SetViewColor(0.0, 0.0, 0.0);
	bView->SetFontSize(20);
	AddChild(bView);

	for(int x=0;x<20;x++)
	{
		peak[x]=0;
		lastpeak[x]=0;
		peakdelay[x]=0;
	}

	// Add a shortcut so Alt-F will toggle fullscreen.
	AddShortcut( 'f', 0, new BMessage( GO_FULLSCREEN ) );

	// Initialize OpenGL
	//
	// In theory you can also use single-buffering, s/DOUBLE/SINGLE/ in
	// these two.
	EnumerateDevices( BGL_MONITOR_PRIMARY, BGL_ANY | BGL_DOUBLE, BGL_ANY, BGL_NONE, BGL_NONE );
	InitializeGL( opengl_device, BGL_ANY | BGL_DOUBLE, BGL_ANY, BGL_NONE, BGL_NONE );

	keeprunning=true;
	// Magically, the window will now appear on-screen.
	Show();
	Sync();	// <- should prevent the thread from racing the window
	
	//gInit
	MakeCurrent();
	// Clear to black
	glClearColor( 0.0, 0.0, 0.0, 0.0 );
	
	// Set up the depth buffer
	glClearDepth( 1.0 );
	// The type of depth test
	glDepthFunc( GL_LEQUAL );
//	glDepthFunc( GL_LESS );
	// Enable depth testing
	glEnable( GL_DEPTH_TEST );
	
	// Set up perspective view

	// Enable smooth shading
	glShadeModel( GL_SMOOTH );

	// Really nice perspective calculations
	glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
	
	// Back face is solid, front face is outlined
	glPolygonMode( GL_BACK, GL_FILL );
	glPolygonMode( GL_FRONT, GL_LINE );

//	glMatrixMode( GL_PROJECTION );
	
#if 0
	float local_view[] = {0.0,0.0};
	float position[] = {0.0, 3.0, 3.0, 0.0};
	glLightfv(GL_LIGHT0, GL_POSITION, position);
	glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view);

	float white[3] = {1.0,1.0,1.0};
	float dimWhite[3] = {0.25,0.25,0.25};

	glEnable(GL_LIGHT0);
	glLightfv(GL_LIGHT0, GL_SPECULAR, dimWhite);
	glLightfv(GL_LIGHT0, GL_DIFFUSE,white);
	glLightfv(GL_LIGHT0, GL_AMBIENT,white);

	glFrontFace(GL_CW);
	glEnable(GL_LIGHTING);
	glEnable(GL_AUTO_NORMAL);
	glEnable(GL_NORMALIZE);
	glMaterialf(GL_FRONT, GL_SHININESS, 0.6*128.0);

	glColor3f(1.0, 1.0, 1.0);

	glMatrixMode(GL_PROJECTION);
#endif

	glLoadIdentity();
	ReleaseCurrent();

	FrameResized(float(Bounds().IntegerWidth() + 1), float(Bounds().IntegerHeight() + 1));
}