JX Application Framework
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
JProgressDisplay Class Referenceabstract

#include <JProgressDisplay.h>

Inheritance diagram for JProgressDisplay:
[legend]

Public Types

enum  ProcessType {
  kNoRunningProcess ,
  kFixedLengthProcess ,
  kVariableLengthProcess
}
 

Public Member Functions

 JProgressDisplay ()
 
virtual ~JProgressDisplay ()
 
void FixedLengthProcessBeginning (const JSize stepCount, const JString &message, const bool allowCancel, const bool modal)
 
void VariableLengthProcessBeginning (const JString &message, const bool allowCancel, const bool modal)
 
virtual bool IncrementProgress (const JString &message=JString::empty)=0
 
virtual bool IncrementProgress (const JSize delta)=0
 
virtual bool IncrementProgress (const JString &message, const JSize delta)=0
 
virtual bool ProcessContinuing ()
 
virtual void ProcessFinished ()
 
bool ProcessRunning () const
 
ProcessType GetCurrentProcessType () const
 
JSize GetCurrentStepCount () const
 
virtual void DisplayBusyCursor ()=0
 

Protected Member Functions

virtual void ProcessBeginning (const ProcessType processType, const JSize stepCount, const JString &message, const bool allowCancel, const bool modal)
 
virtual bool CheckForCancel ()=0
 
bool AllowCancel () const
 
bool IsModal () const
 
JSize GetMaxStepCount () const
 
void IncrementStepCount (const JSize delta=1)
 

Detailed Description

Interface for the JProgressDisplay class.

Abstract base class for displaying the progress of a long process.

It provides the framework for letting the user:
    1)  cancel the process
    2)  continue doing other things while the process is running
        (this is only relevant on systems with cooperative multitasking)

It can handle both fixed length and variable length processes.  In both
cases, you only have to keep calling IncrementProgress().  (For a fixed
length process, you must also specify how many steps there will be.)

ProcessContinuing should be used when the time between IncrementProgress()
calls is longer than about 1/2 second.  By calling ProcessContinuing at
various points in your loop, you give other processes (like the foreground
process) a larger share of the time.  (This is obviously not of much
concern if your process is neither backgroundable nor cancellable.)

Even if a process is cancelled, you must call ProcessFinished.
This forces you to write a cleaner loop.

Derived classes must override:

    ProcessBeginning
        Create some sort of display to represent the progress.
        Remember to call JProgressDisplay::ProcessBeginning().

    IncrementProgress(const JString* message)
        Increment the step count by 1 and update the display to show that
        progress is being made.  If the message is not nullptr, it should
        be displayed.  Return false if process was cancelled by user.

    IncrementProgress(const JSize delta)
        Increment the step count by delta and update the display to show
        that progress is being made.  Return false if process was
        cancelled by user.

    ProcessFinished
        Clean up the display that was created.
        Remember to call JProgressDisplay::ProcessFinished().

    CheckForCancel
        Return true if the user wishes to cancel the operation.

    DisplayBusyCursor
        Change the mouse cursor to indicate that the program is busy.
        (can be used if process is not in the background)

They should also override:

    ProcessContinuing
        Give the OS some background time if AllowBackground() and the
        system is cooperatively multitasked.  Do not increment the step
        count or update the display.  Return the result of
        JProgressDisplay::ProcessContinuing().

Member Enumeration Documentation

◆ ProcessType

Enumerator
kNoRunningProcess 
kFixedLengthProcess 
kVariableLengthProcess 

Constructor & Destructor Documentation

◆ JProgressDisplay()

JProgressDisplay::JProgressDisplay ( )

◆ ~JProgressDisplay()

JProgressDisplay::~JProgressDisplay ( )
virtual

Member Function Documentation

◆ AllowCancel()

bool JProgressDisplay::AllowCancel ( ) const
inlineprotected

◆ CheckForCancel()

virtual bool JProgressDisplay::CheckForCancel ( )
protectedpure virtual

◆ DisplayBusyCursor()

virtual void JProgressDisplay::DisplayBusyCursor ( )
pure virtual

◆ FixedLengthProcessBeginning()

void JProgressDisplay::FixedLengthProcessBeginning ( const JSize  stepCount,
const JString message,
const bool  allowCancel,
const bool  modal 
)
inline

◆ GetCurrentProcessType()

JProgressDisplay::ProcessType JProgressDisplay::GetCurrentProcessType ( ) const
inline

◆ GetCurrentStepCount()

JSize JProgressDisplay::GetCurrentStepCount ( ) const
inline

◆ GetMaxStepCount()

JSize JProgressDisplay::GetMaxStepCount ( ) const
inlineprotected

◆ IncrementProgress() [1/3]

virtual bool JProgressDisplay::IncrementProgress ( const JSize  delta)
pure virtual

◆ IncrementProgress() [2/3]

virtual bool JProgressDisplay::IncrementProgress ( const JString message,
const JSize  delta 
)
pure virtual

◆ IncrementProgress() [3/3]

virtual bool JProgressDisplay::IncrementProgress ( const JString message = JString::empty)
pure virtual

◆ IncrementStepCount()

void JProgressDisplay::IncrementStepCount ( const JSize  delta = 1)
protected

◆ IsModal()

bool JProgressDisplay::IsModal ( ) const
inlineprotected

◆ ProcessBeginning()

void JProgressDisplay::ProcessBeginning ( const ProcessType  processType,
const JSize  stepCount,
const JString message,
const bool  allowCancel,
const bool  modal 
)
protectedvirtual

Initialize the data members. Derived classes should create some sort of display to represent the progress.

Reimplemented in JLatentPG, JTextProgressDisplay, JXProgressDisplay, and JXStandAlonePG.

◆ ProcessContinuing()

bool JProgressDisplay::ProcessContinuing ( )
virtual

Derived classes should give the system some background time (system dependent) without updating the progress display.

Returns false if process was cancelled by user.

Reimplemented in JLatentPG, JXProgressDisplay, and JXStandAlonePG.

◆ ProcessFinished()

void JProgressDisplay::ProcessFinished ( )
virtual

Derived classes must call this and then clean up the display they created.

Reimplemented in JLatentPG, JTextProgressDisplay, JXProgressDisplay, and JXStandAlonePG.

◆ ProcessRunning()

bool JProgressDisplay::ProcessRunning ( ) const
inline

◆ VariableLengthProcessBeginning()

void JProgressDisplay::VariableLengthProcessBeginning ( const JString message,
const bool  allowCancel,
const bool  modal 
)
inline

The documentation for this class was generated from the following files: