PortableGUI

SourceForge Logo
Hosted by SourceForge
Project page

HelloWorld

Code for HelloWorld app with PortableGUI

#include <portablegui.h> // Import all PortableGUI include files

class MyWindowListener : public PGWindowListener {

    virtual void windowClosing(PGWindow* wnd);
};

void MyWindowListener::windowClosing(PGWindow* wnd) {
    getPGApplication()->exit(0); // Exit the application
}

PGMAINPROC { // Mainproc is different for Windows and GTK
    PGApplication app;

    PGINIT(app); // Initialize the app using Mainproc args

    PGFrame frame("PortableGUI - HelloWorld"); // Create new frame window

    MyWindowListener* wl = new MyWindowListener(); // Create window listener for frame
    frame.addWindowListener(wl); // Add window listener to frame

    frame.pack(); // Use layout manager
    frame.setVisible(TRUE); // Show the frame

    return app.run(); // Main event loop
}

Screenshots

WinHelloWorld BeOSHelloWorld
GTKHelloWorld  
 

How to run

Download and unzip the tarbal in a directory of your choice
If you run into problems, take a look at the FAQ or mail me.

Gnome/GTK version (on Linux/Unix)

This should be easy :O)
bash$ tar -xvzf PortableGUI-x.xx.tar.gz
bash$ cd pg/demo/helloworld/GTKHelloWorld
bash$ make
bash$ ./helloworld
You can clean up the object files with 'make clean'.
If your compiler complains about carriage returns, you are probably using Windows sources. Take a look here.

Windows version

You can use tar/gzip from CygWin or WinZip to unzip the archive
C:\DOWNLOAD\tar -xvzf PortableGUI-x.xx.tar.gz should do the job Back to PortableGUI