JX Application Framework
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
JXModalDialogDirector Class Reference

#include <JXModalDialogDirector.h>

Inheritance diagram for JXModalDialogDirector:
[legend]

Public Member Functions

 JXModalDialogDirector (const bool allowResizing=false)
 
 ~JXModalDialogDirector () override
 
JXButtonGetOKButton () const
 
JXButtonGetCancelButton () const
 
void SetButtons (JXButton *okButton, JXButton *cancelButton)
 
bool DoDialog ()
 
void EndDialog (const bool success)
 
void Activate () override
 
bool Deactivate () override
 
bool Close () override
 
- Public Member Functions inherited from JXWindowDirector
 JXWindowDirector (JXDirector *supervisor)
 
 ~JXWindowDirector () override
 
void Activate () override
 
bool Deactivate () override
 
void Suspend () override
 
void Resume () override
 
JXWindowGetWindow () const
 
JXDisplayGetDisplay () const
 
virtual const JStringGetName () const
 
virtual bool GetMenuIcon (const JXImage **icon) const
 
virtual bool NeedsSave () const
 
- Public Member Functions inherited from JXDirector
 JXDirector (JXDirector *supervisor)
 
 ~JXDirector () override
 
bool IsClosing () const
 
bool IsActive () const
 
bool IsSuspended () const
 
bool HasSubdirectors () const
 
bool GetSubdirectors (const JPtrArray< JXDirector > **list) const
 
- Public Member Functions inherited from JBroadcaster
 JBroadcaster ()
 
virtual ~JBroadcaster ()
 
JBroadcasteroperator= (const JBroadcaster &source)
 
bool HasSenders () const
 
JSize GetSenderCount () const
 
bool HasRecipients () const
 
JSize GetRecipientCount () const
 
virtual JString ToString () const
 
template<class T >
void ListenTo (const JBroadcaster *sender, const std::function< void(const T &)> &f)
 

Protected Member Functions

bool OKToDeactivate () override
 
bool Cancelled () const
 
void Receive (JBroadcaster *sender, const Message &message) override
 
- Protected Member Functions inherited from JXDirector
JXDirectorGetSupervisor () const
 
bool CloseAllSubdirectors ()
 
virtual void DirectorClosed (JXDirector *theDirector)
 
- Protected Member Functions inherited from JBroadcaster
 JBroadcaster (const JBroadcaster &source)
 
void ListenTo (const JBroadcaster *sender)
 
void StopListening (const JBroadcaster *sender)
 
void ClearWhenGoingAway (const JBroadcaster *sender, void *pointerToMember)
 
void StopListening (const JBroadcaster *sender, const std::type_info &messageType)
 
template<class T >
void Send (JBroadcaster *recipient, const T &message)
 
template<class T >
void Broadcast (const T &message)
 
void SendWithFeedback (JBroadcaster *recipient, Message *message)
 
void BroadcastWithFeedback (Message *message)
 
virtual void ReceiveWithFeedback (JBroadcaster *sender, Message *message)
 
virtual void ReceiveGoingAway (JBroadcaster *sender)
 

Detailed Description

Maintains a modal dialog window.  Call DoDialog() to show the window.
We suspend all other windows while active.  If DoDialog() returns true,
the client can extract the information.  We Close() automatically.

Modeless dialog windows that are supposed to simply hide themselves
instead of closing must be implemented as JXWindowDirectors intead of
JXModalDialogDirectors.

If the client wants actions other than OK and Cancel, it merely has to
add extra buttons and ListenTo() each one.  If part of the action should
be to close the dialog, the client can call EndDialog().

Derived classes that implement modal windows are required to call
SetButtons() with at least an okButton.

Derived classes can also implement extra validation (e.g. one input field
greater than another) by overriding OKToDeactivate().  One should only
perform such checks if Cancelled() returns false, however, because
nothing should be checked if the user cancels the dialog.

Constructor & Destructor Documentation

◆ JXModalDialogDirector()

JXModalDialogDirector::JXModalDialogDirector ( const bool  allowResizing = false)

◆ ~JXModalDialogDirector()

JXModalDialogDirector::~JXModalDialogDirector ( )
override

Member Function Documentation

◆ Activate()

void JXModalDialogDirector::Activate ( )
overridevirtual

We do not propagate the Activate message to subdirectors because each derived class must decide whether or not this is appropriate.

Reimplemented from JXDirector.

Reimplemented in JXSaveFileDialog.

◆ Cancelled()

bool JXModalDialogDirector::Cancelled ( ) const
inlineprotected

◆ Close()

bool JXModalDialogDirector::Close ( )
overridevirtual

Close all sub-directors and delete ourselves.

Reimplemented from JXDirector.

◆ Deactivate()

bool JXModalDialogDirector::Deactivate ( )
overridevirtual

Reimplemented from JXDirector.

◆ DoDialog()

bool JXModalDialogDirector::DoDialog ( )

Returns true if the dialog is ok'd.

◆ EndDialog()

void JXModalDialogDirector::EndDialog ( const bool  success)

If success is true, we close ourselves with success. Otherwise, we close as if cancelled.

We don't bother to return the result of Deactivate() because, if it is successful, kJXDialogDeactivated will be broadcast.

◆ GetCancelButton()

JXButton * JXModalDialogDirector::GetCancelButton ( ) const
inline

◆ GetOKButton()

JXButton * JXModalDialogDirector::GetOKButton ( ) const
inline

◆ OKToDeactivate()

bool JXModalDialogDirector::OKToDeactivate ( )
overrideprotectedvirtual

Check that the active object is willing to unfocus.

Reimplemented from JXWindowDirector.

Reimplemented in JXOpenDisplayDialog, JXPSPrintSetupDialog, JXPTPrintSetupDialog, and JXSaveFileDialog.

◆ Receive()

void JXModalDialogDirector::Receive ( JBroadcaster sender,
const Message message 
)
overrideprotectedvirtual

Listen for pushed ok and cancel buttons.

Reimplemented from JBroadcaster.

Reimplemented in JXPSPrintSetupDialog, JXPTPageSetupDialog, JXPTPrintSetupDialog, and JXSaveFileDialog.

◆ SetButtons()

void JXModalDialogDirector::SetButtons ( JXButton okButton,
JXButton cancelButton 
)

If the window is not modal, okButton and cancelButton can be nullptr. If the window is modal, okButton must not be nullptr.


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