home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************
- * TASK.CXX
- * (c) 1992-1994 STAR DIVISION
- *******************************************************************/
-
- #include <sv.hxx>
-
- // --- class MyApp -------------------------------------------------
-
- class MyApp : public Application
- {
- public:
- virtual void Main( int, char*[] );
- };
-
- // --- class TaskWindow --------------------------------------------
-
- class TaskWindow : public WorkWindow
- {
- private:
- PushButton aStartButton;
- PushButton aStopButton;
- BOOL bEnd;
-
- public:
- TaskWindow();
-
- void Start( Button* );
- void Stop( Button* );
-
- void DrawNumber();
- };
-
- // --- TaskWindow::TaskWindow() ------------------------------------
-
- TaskWindow::TaskWindow() :
- WorkWindow( NULL, WB_APP | WB_STDWORK ),
- aStartButton( this ),
- aStopButton( this )
- {
- aStartButton.ChangePosPixel( Point( 10, 15 ) );
- aStartButton.ChangeSizePixel( Size( 40, 20 ) );
- aStartButton.SetText( "Start" );
- aStartButton.ChangeClickHdl( LINK( this, TaskWindow, Start ) );
- aStartButton.Show();
-
- aStopButton.ChangePosPixel( Point( 60, 15 ) );
- aStopButton.ChangeSizePixel( Size( 40, 20 ) );
- aStopButton.SetText( "Stop" );
- aStopButton.Disable();
- aStopButton.ChangeClickHdl( LINK( this, TaskWindow, Stop ) );
- aStopButton.Show();
-
- SetText( "Reschedule-Demo" );
- Show();
- }
-
- // --- TaskWindow::Start() -----------------------------------------
-
- void TaskWindow::Start( Button* )
- {
- DrawNumber();
- }
-
- // --- TaskWindow::Stop() ------------------------------------------
-
- void TaskWindow::Stop( Button* )
- {
- bEnd = TRUE;
- }
-
- // --- TaskWindow::DrawNumber() ------------------------------------
-
- void TaskWindow::DrawNumber()
- {
- Invalidate();
- Update();
-
- aStartButton.Disable();
- aStopButton.Enable();
- bEnd = FALSE;
-
- USHORT i = 0;
- while ( i <= 9999 && !bEnd )
- {
- DrawText( Point( 45, 60 ), i );
- pApp->Reschedule();
- i++;
- }
-
- aStopButton.Disable();
- aStartButton.Enable();
- }
-
- // --- MyApp::Main() -----------------------------------------------
-
- void MyApp::Main( int, char*[] )
- {
- TaskWindow aWindow;
- Execute();
- }
-
- // --- aMyApp ------------------------------------------------------
-
- MyApp aMyApp;
-