The Gnome Chemistry Utils  0.14.0
Public Types | Public Member Functions | Protected Attributes | List of all members
gcu::CmdContext Class Reference

error output channel. More...

#include <gcu/cmd-context.h>

Inheritance diagram for gcu::CmdContext:
gcugtk::CmdContextGtk

Public Types

enum  Response {
  ResponseDefault, ResponseOK = 1 << 0, ResponseCancel = 1 << 1, ResponseYes = 1 << 2,
  ResponseNo = 1 << 3, ResponseClose = 1 << 4
}
 Responses which might be proposed to the user. More...
enum  Severity { SeverityMessage, SeverityWarning, SeverityError }
 Error severity. More...

Public Member Functions

 CmdContext (Application *App)
virtual ~CmdContext ()
virtual Response GetResponse (char const *message, int responses)=0
virtual void Message (char const *message, Severity severity, bool modal)=0
GOIOContext * GetNewGOIOContext ()
GOCmdContext * GetGOCmdContext (void)
ApplicationGetApp (void)

Protected Attributes

GOCmdContext * m_GOCmdContext
Applicationm_App

Detailed Description

error output channel.

This class is used to display errors. It uses a GOCmdContext from Goffice internally. This class is actually a virtual base class.

Definition at line 42 of file cmd-context.h.

Member Enumeration Documentation

Responses which might be proposed to the user.

gcu/cmd-context.h This enum list the various answers that might be proposed to the user in case an error occured.

Enumerator:
ResponseDefault 

The default response if none of the others applies.

ResponseOK 

Answer to the question is 'OK'.

ResponseCancel 

Answer to the question is 'Cancel'.

ResponseYes 

Answer to the question is 'Yes'.

ResponseNo 

Answer to the question is 'No'.

ResponseClose 

Close the message and don't do anything else.

Definition at line 63 of file cmd-context.h.

Error severity.

gcu/cmd-context.h This enum list the severity of the errors that might occur.

Enumerator:
SeverityMessage 

A simple information.

SeverityWarning 

A warning: something wrong occured but the program can proceed anyway.

SeverityError 

An error: the program can't do what was requested.

Definition at line 95 of file cmd-context.h.

Constructor & Destructor Documentation

gcu::CmdContext::CmdContext ( Application App)
Parameters
Appthe application for which the CmdContext is created.

Initializes a CmdContext and attach it to App.

virtual gcu::CmdContext::~CmdContext ( )
virtual

The destructor.

Member Function Documentation

gcu::CmdContext::GetApp ( void  )
inline
Returns
a pointer to the Application instance associated with the CmdContext.

Definition at line 152 of file cmd-context.h.

gcu::CmdContext::GetGOCmdContext ( void  )
inline
Returns
the associated GOCmdContext.

Definition at line 144 of file cmd-context.h.

GOIOContext* gcu::CmdContext::GetNewGOIOContext ( )

Just calls go_io_context_new().

Returns
a new GOIOContext associated with the internal GOCmdContext.
virtual Response gcu::CmdContext::GetResponse ( char const *  message,
int  responses 
)
pure virtual
Parameters
messagethe message string.
responsesthe responses that are meaningful such as 'ResponseYes | ResponseNo'.

Ask a question to the user about what should be done.

Returns
the response chosen by the user. ResponseDefault means that the message was aborted without choosing one of the proposed answers. This method is pure virtual and must be implemented in derived classes.

Implemented in gcugtk::CmdContextGtk.

virtual void gcu::CmdContext::Message ( char const *  message,
Severity  severity,
bool  modal 
)
pure virtual
Parameters
messagethe message string.
severitythe Severity of the situation.
modalwhether the message should block the program execution or not.

Inform the user of an abnormal situation. This method is pure virtual and must be implemented in derived classes.

Implemented in gcugtk::CmdContextGtk.

Member Data Documentation

gcu::CmdContext::m_App
protected

The Application instance associated with the CmdContext.

Definition at line 152 of file cmd-context.h.

gcu::CmdContext::m_GOCmdContext
protected

The associated GOCmdContext.

Definition at line 144 of file cmd-context.h.


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