wiki:pjwin_idea

Version 2 (modified by bennylp, 10 years ago) (diff)

--

PJWIN - Portable Mobile Windowing Toolkit

Objective

Develop a simple, small-footprint GUI toolkit to build simple applications that are portable across platforms, especially mobile platforms.

The exact same GUI source code should be portable across these platforms:

  • Windows
  • Windows Mobile Professional/PocketPC platform (i.e. with touch interface)
  • Windows Mobile Standard/Smartphone? platform (i.e. without touch)
  • Symbian/S60 3rd edition
  • (optional) console application
  • (optional) Qt application

Basic idea

The basic idea is to use XUL-like interface (see XUL, and XUL tutorial), but much more simplified.

Sample interactions

  1. Describe the window using XUL-like syntax (the code below is all over the place but hopefully you get the idea):
    const char *xml = 
       "<?xml version="1.0"?>
        <window id="mainwnd"
                title="Hello world">
          <label value="Press the button to exit"/>
          <cmdbar>
            <menuitem id="about" value="About.."/>
            <menuitem id="quit" value="Quit"/>
          </cmdbar>
        </window>";
    
  2. Create the window using the XUL XML description:
    window *wnd = create_window(xml);
    
  3. For modal dialog, start the dialog, giving it callback function to receive events from the window:
    do_modal(wnd, &event_handler);
    
  4. Do some code in the event handler:
    void event_handler(window *wnd, event *event)
    {
       if (event->type==COMMAND && pj_strcmp2(&event->element, "quit")==0)
          end_dialog(wnd);
       else if (event->type==COMMAND && pj_strcmp2(&event->element, "about")==0)
          msgbox("hello world");
    }
    
  5. And that's it!

Screenshots

TBD.

Basically, on Smartphone and S60, the command bar will be implemented as menu, while on Win32 it will be as buttons, while on PPC it may be implemented as menu or buttons.

The GUI elements

Supported elements:

  • window
  • hbox and vbox
  • spacer
  • label (static text)
  • command bar (will be translated into buttons or menu on interface with touch capability, or into menu on the rest)
  • edit/input control
  • combo box control (advanced)
  • list control (advanced)

Unsupported elements:

  • button (it's only most usable with touch interface)