SOL9 2.0 Sample: ProgressBar

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * ProgressBar.cpp 
 * Copyright (c) 2009 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// SOL++2000
// 2000.02.18


#include <sol\ApplicationView.h>
#include <sol\PaintDC.h>
#include <sol\ProgressBar.h>

namespace SOL {

class AppView :public ApplicationView {
private:
    ProgressBar    progress;

public:
    /**
     * Constructor
     */
    AppView(Application& applet, const TCHAR* label, Args& args)
    :ApplicationView(applet, label, args)
    {  
        Args ar;
        ar.set(XmNx, 10);
        ar.set(XmNy, 10);
        ar.set(XmNwidth, 200);
        ar.set(XmNheight, 20);
        progress.create(this, NULL, ar);
        progress.setRange(0, 20);
        progress.setStep(1);

        setTimer(10, 100, NULL);
        addEventHandler(WM_TIMER, this, 
            (Handler)&AppView::timer, NULL);
        addEventHandler(WM_CLOSE, this, 
            (Handler)&AppView::close, NULL);
    }

private:
    long timer(Event& event) 
    {
        progress.stepIt();
        return 0;
    }
private:
    long close(Event& event) 
    {
        showMessageDialog(_T("Confirmation"), _T("Are you sure to close this window! "));
        killTimer(10);
        destroyWindow();
        return 0;
    }
};

}

//
void    Main(int argc, TCHAR** argv)
{
    const TCHAR* name = _T("ProgressBar");
    try {
        Application applet(name, argc, argv);

        Args args;
        args.set(XmNwidth, 300);
        args.set(XmNheight, 120);
        AppView appview(applet, name, args);
        appview.realize();

        applet.run();
    } catch (...) {

    }
}


Last modified: 11 Nov 2009

Copyright (c) 2009 Antillia.com ALL RIGHTS RESERVED.