Beispiel #1
0
AboutWindow::AboutWindow(const Rect & r)
	:Window(r, "AboutAlbert", MSG_ABOUTWND_TITLE,
//	WND_NO_CLOSE_BUT | WND_NO_ZOOM_BUT | WND_NO_DEPTH_BUT |
//	WND_NO_BORDER | WND_NO_TITLE |
	WND_NOT_RESIZABLE,
	CURRENT_DESKTOP)
{
	os::Resources cRes(get_image_id());
	os::ResStream* pcStream = cRes.GetResourceStream("Calculator.png");
	if(pcStream == NULL)
		throw(os::errno_exception("Can't find resource Calculator.png!"));

	m_pcImage = new BitmapImage( pcStream );
	BitmapView* imv = new BitmapView( m_pcImage->GetBounds(), "bitmap", m_pcImage );
	AddChild(imv);

	Rect	frame = m_pcImage->GetBounds();
	Desktop	desktop;
	Point offset(desktop.GetResolution());

	offset.x = offset.x/2 - frame.Width()/2;
	offset.y = offset.y/2 - frame.Height()/2;

	SetFrame(frame + offset);
	
	delete pcStream;
}
Beispiel #2
0
BitmapImage* MainWindow::LoadImageFromResource( String zResource )
{
	BitmapImage *pcImage = new BitmapImage();
	Resources cRes( get_image_id() );
	ResStream *pcStream = cRes.GetResourceStream( zResource );
	pcImage->Load( pcStream );
	delete ( pcStream );
	return pcImage;
}
Beispiel #3
0
// vector multiplication: matrix A, vector x:  r = Ax
XVECTOR XSQUARE_MATRIX::operator * (const XVECTOR &i_cRHO) const
{
	XVECTOR	cRes(i_cRHO.m_uiN);

	if (i_cRHO.m_lpdValues && m_lpdValues && m_uiN == i_cRHO.m_uiN)
	{
		for (unsigned int uiRow = 0; uiRow < m_uiN; uiRow++)
		{
			cRes.m_lpdValues[uiRow] = 0.0;
			for (unsigned int uiCol = 0; uiCol < m_uiN; uiCol++)
			{
				cRes.m_lpdValues[uiRow] += 
					m_lpdValues[uiRow * m_uiN + uiCol] * 
						i_cRHO.m_lpdValues[uiCol];
			}
		}
	}
	return cRes;
}
Beispiel #4
0
SettingsWindow::SettingsWindow( const Rect &cFrame, const String cTitle, Handler *pcParent, WebSettings *pcWebSettings, Settings *pcSettings, Settings *pcGuiSettings ) : Window( cFrame, "whisper_settings", cTitle )
{
	m_pcParent = pcParent;

	m_pcWebSettings = pcWebSettings;
	m_pcSettings = pcSettings;
	m_pcGuiSettings = pcGuiSettings;

	SetSizeLimits( Point( 500, 400 ), Point( 4096, 4096 ) );

	Rect cBounds = GetBounds();

	Rect cIconListFrame( 10, 10, 140, cBounds.Height() - 45 );
	m_pcIconList = new IconList( cIconListFrame, CF_FOLLOW_TOP | CF_FOLLOW_BOTTOM, this );
	AddChild( m_pcIconList );

	/* The selected panel is displayed inside this FrameView */
	Rect cFrameViewFrame( 150, 10, cBounds.Width() - 10, cBounds.Height() - 45 );
	m_pcFrameView = new FrameView( cFrameViewFrame, "settings_window_frame", "Settings", CF_FOLLOW_ALL );
	AddChild( m_pcFrameView );

	/* Add panel icons & associated views */
	BitmapImage *pcImage;
	ResStream *pcStream;
	Resources cRes( get_image_id() );		

	SettingsView *pcView;
	Rect cViewFrame( 10, 20, cFrameViewFrame.Width() - 10, cFrameViewFrame.Height() - 10 );

	/* General */
	pcImage = new BitmapImage();
	pcStream = cRes.GetResourceStream( "general.png" );
	pcImage->Load( pcStream );
	m_pcIconList->AddIcon( pcImage, "General" );
	delete( pcStream );

	pcView = new GeneralView( cViewFrame, m_pcSettings, m_pcWebSettings, m_pcParent );
	m_vViews.push_back( pcView );

	/* Proxies */
	pcImage = new BitmapImage();
	pcStream = cRes.GetResourceStream( "proxy.png" );
	pcImage->Load( pcStream );
	m_pcIconList->AddIcon( pcImage, "Proxies" );
	delete( pcStream );

	pcView = new ProxyView( cViewFrame, m_pcSettings, m_pcWebSettings, m_pcParent );
	m_vViews.push_back( pcView );

	/* The Apply/Save/Cancel buttons live in a layoutview of their own */
	Rect cButtonFrame = cBounds;
	cButtonFrame.top = cButtonFrame.bottom - 25;

	m_pcLayoutView = new LayoutView( cButtonFrame, "settings_window" );

	VLayoutNode *pcNode = new VLayoutNode( "settings_window_root" );
	pcNode->SetBorders( Rect( 5, 4, 5, 4 ) );
	pcNode->AddChild( new VLayoutSpacer( "settings_window_v_spacer", 1.0f ) );

	HLayoutNode *pcButtons = new HLayoutNode( "settings_window_buttons" );
	pcButtons->AddChild( new HLayoutSpacer( "settings_window_h_spacer" ) );
	Button *pcOkButton = new Button( Rect(), "settings_window_save", "Save", new Message( ID_SETTINGS_SAVE ) );
	pcButtons->AddChild( pcOkButton, 0.0f );
	pcButtons->AddChild( new HLayoutSpacer( "settings_window_h_spacer", 0.5f, 0.5f, pcButtons, 0.1f ) );
	pcButtons->AddChild( new Button( Rect(), "settings_window_apply", "Apply", new Message( ID_SETTINGS_APPLY ) ), 0.0f );
	pcButtons->AddChild( new HLayoutSpacer( "settings_window_h_spacer", 0.5f, 0.5f, pcButtons, 0.1f ) );
	pcButtons->AddChild( new Button( Rect(), "settings_window_cancel", "Cancel", new Message( ID_SETTINGS_CANCEL ) ), 0.0f );

	pcNode->AddChild( pcButtons );

	m_pcLayoutView->SetRoot( pcNode );
	AddChild( m_pcLayoutView );

	/* Focus the controls */
	/* XXXKV: The default button always swallows Enter, which is no use if we have a
	   multiline TextView (E.g. the signature text).
	SetDefaultButton( pcOkButton );
	*/

	/* Select first view by default */
	m_pcSelected = NULL;
	m_pcIconList->Select( 0, true );
}