The Gnome Chemistry Utils  0.14.0
Public Member Functions | Protected Attributes | List of all members
gcr::Application Class Reference

GCrystal application base class. More...

#include <gcr/application.h>

Inheritance diagram for gcr::Application:
gcugtk::Application gcu::Application gcu::DialogOwner

Public Member Functions

 Application ()
virtual ~Application ()
virtual gcr::DocumentOnFileNew ()=0
void OnFileOpen ()
void OnFileSave ()
void OnFileSaveAs ()
bool OnFileClose ()
void OnSaveAsImage ()
bool OnQuit ()
void SetActiveDocument (Document *doc)
virtual WindowCreateNewWindow (Document *doc)
bool FileProcess (const gchar *filename, const gchar *mime_type, bool bSave, GtkWindow *window, gcu::Document *pDoc=NULL)
char const * GetFirstSupportedMimeType (std::list< std::string >::iterator &it)
char const * GetNextSupportedMimeType (std::list< std::string >::iterator &it)
DocumentGetDocument (const char *filename)
bool IsEmpty ()
void SetOpening ()
GOConfNode * GetConfNode (void) const
- Public Member Functions inherited from gcugtk::Application
 Application (std::string name, std::string datadir=DATADIR, char const *help_name=NULL, char const *icon_name=NULL, CmdContextGtk *cc=NULL)
GtkWidget * GetImageResolutionWidget ()
GtkWidget * GetImageSizeWidget ()
virtual void ReceiveTargets (G_GNUC_UNUSED GtkClipboard *clipboard, G_GNUC_UNUSED GtkSelectionData *selection_data)
void ShowURI (GdkScreen *screen, std::string &uri)
void OnBug (GdkScreen *screen, char const *uri=PACKAGE_BUGREPORT)
void OnWeb (GdkScreen *screen, char const *uri="http://gchemutils.nongnu.org/")
void OnMail (GdkScreen *screen, char const *MailAddress="mailto:gchemutils-main@nongnu.org")
void OnLiveAssistance (GdkScreen *screen)
GtkRecentManager * GetRecentManager (void) const
- Public Member Functions inherited from gcu::Application
 Application (std::string name, std::string datadir=DATADIR, char const *help_name=NULL, char const *icon_name=NULL, CmdContext *cc=NULL)
void OnHelp (std::string s="")
bool HasHelp ()
std::string const & GetName () const
virtual GtkWindow * GetWindow ()
virtual bool FileProcess (G_GNUC_UNUSED const gchar *filename, G_GNUC_UNUSED const gchar *mime_type, G_GNUC_UNUSED bool bSave, G_GNUC_UNUSED GtkWindow *window, G_GNUC_UNUSED Document *pDoc=NULL)
char const * GetCurDir ()
void SetCurDir (char const *dir)
void SetCurDir (std::string const &dir)
std::map< std::string,
GdkPixbufFormat * > & 
GetSupportedPixbufFormats ()
char const * GetPixbufTypeName (std::string &filename, char const *mime_type)
ContentType Load (std::string const &uri, const char *mime_type, Document *Doc, const char *options=NULL)
ContentType Load (GsfInput *input, const char *mime_type, Document *Doc, const char *options=NULL)
bool Save (std::string const &uri, const char *mime_type, Object const *Obj, ContentType type, const char *options=NULL)
bool Save (GsfOutput *output, const char *mime_type, Object const *Obj, ContentType type, const char *options=NULL)
virtual DocumentCreateNewDocument ()
std::string const & GetIconName ()
void RegisterOptions (GOptionEntry const *entries, char const *translation_domain=GETTEXT_PACKAGE)
void AddOptions (GOptionContext *context)
TypeId AddType (std::string TypeName, Object *(*CreateFunc)(), TypeId id=OtherType)
ObjectCreateObject (const std::string &TypeName, Object *parent=NULL)
void AddRule (TypeId type1, RuleId rule, TypeId type2)
void AddRule (const std::string &type1, RuleId rule, const std::string &type2)
const std::set< TypeId > & GetRules (TypeId type, RuleId rule)
const std::set< TypeId > & GetRules (const std::string &type, RuleId rule)
void SetCreationLabel (TypeId Id, std::string Label)
const std::string & GetCreationLabel (TypeId Id)
bool BuildObjectContextualMenu (Object *target, UIManager *uim, Object *object, double x, double y)
void AddMenuCallback (TypeId Id, BuildMenuCb cb)
const std::string & GetCreationLabel (const std::string &TypeName)
CmdContextGetCmdContext ()
char * ConvertToCML (std::string const &uri, const char *mime_type, const char *options=NULL)
char * ConvertToCML (GsfInput *input, const char *mime_type, const char *options=NULL)
void ConvertFromCML (const char *cml, std::string const &uri, const char *mime_type, const char *options=NULL)
void ConvertFromCML (const char *cml, GsfOutput *output, const char *mime_type, const char *options=NULL)
std::list< Database > const & GetDatabases (char const *classname)
std::set< Document * > GetDocs (void)
unsigned GetScreenResolution (void)
void SetImageResolution (unsigned val)
unsigned GetImageResolution (void) const
unsigned & GetRefImageResolution (void)
void SetImageWidth (unsigned val)
unsigned GetImageWidth (void) const
unsigned & GetRefImageWidth (void)
void SetImageHeight (unsigned val)
unsigned GetImageHeight (void) const
unsigned & GetRefImageHeight (void)
void SetTransparentBackground (bool val)
bool GetTransparentBackground (void) const
bool & GetRefTransparentBackground (void)
- Public Member Functions inherited from gcu::DialogOwner
 DialogOwner ()
virtual ~DialogOwner ()
DialogGetDialog (std::string name) const
void ClearDialogs ()

Protected Attributes

Documentm_pActiveDoc

Additional Inherited Members

- Static Public Member Functions inherited from gcugtk::Application
static WindowState GetDefaultWindowState ()
static void OnReceiveTargets (GtkClipboard *clipboard, GtkSelectionData *selection_data, Application *App)
- Protected Member Functions inherited from gcugtk::Application
virtual void NoMoreDocsEvent ()
void CreateDefaultCmdContext ()
bool LoopRunning ()

Detailed Description

GCrystal application base class.

This class is used to represent a GCrystal application. It is a virtual class since at least one method is pure virtual (gcp::Application::OnFileNew)

Definition at line 50 of file gcr/application.h.

Constructor & Destructor Documentation

gcr::Application::Application ( )

The default constructor.

virtual gcr::Application::~Application ( )
virtual

The destructor.

Reimplemented from gcugtk::Application.

Member Function Documentation

virtual Window* gcr::Application::CreateNewWindow ( Document doc)
virtual
Parameters
doca document.

Creates a new window for the document.

Returns
the newly allocated window.
bool gcr::Application::FileProcess ( const gchar *  filename,
const gchar *  mime_type,
bool  bSave,
GtkWindow *  window,
gcu::Document pDoc = NULL 
)
Parameters
filenamethe uri of the file.
mime_typethe mime type of the file if known.
bSavetrue if saving, and false if loading.
windowthe current top level window.
pDocan optional document.

Called by the FileChooser when a file name has been selected. This method loads a new file or saves pDoc according to bSave. When loading, a new document is created unless pDoc is not NULL and is empty.

Returns
true if no error occured.
gcr::Application::GetConfNode ( void  ) const
inline
Returns
the GOConfNode used for the default configuration.

Definition at line 184 of file gcr/application.h.

Document* gcr::Application::GetDocument ( const char *  filename)
Parameters
filenamea file name
Returns
the document associated with filename if opened or NULL.
char const* gcr::Application::GetFirstSupportedMimeType ( std::list< std::string >::iterator &  it)
Parameters
ita mime type iterator.

Initializes the iterator and returns the first registered mime type.

Returns
the first registered mime type.
char const* gcr::Application::GetNextSupportedMimeType ( std::list< std::string >::iterator &  it)
Parameters
ita mime type iterator initialized during GetFirstSupportedMimeType() call.
Returns
the next registered mime type.
bool gcr::Application::IsEmpty ( )
inline
Returns
whether there is no opened view.

Definition at line 156 of file gcr/application.h.

bool gcr::Application::OnFileClose ( )

Closes the current document. If the document has been modified, the user will be asked if he wants to save the modifications or ignore them.

virtual gcr::Document* gcr::Application::OnFileNew ( )
pure virtual

Creates a new document. This method is pure virtual and must be implemented in derived classes.

void gcr::Application::OnFileOpen ( )

Open the file open dialog to select documents to open.

void gcr::Application::OnFileSave ( )

Saves the current document. If it has no file name, the file save as dialog will pop up.

void gcr::Application::OnFileSaveAs ( )

Open the file save as dialog to save the current document with a new name.

bool gcr::Application::OnQuit ( )

Quits the application. If a document has been modified, the user will be asked if he wants to save the modifications or ignore them.

void gcr::Application::OnSaveAsImage ( )

Open the file save as dialog to save the current view as an image.

void gcr::Application::SetActiveDocument ( Document doc)
inline
Parameters
docthe document becoming active.

Sets the new active document.

Definition at line 105 of file gcr/application.h.

References m_pActiveDoc.

void gcr::Application::SetOpening ( )
inline

Tells the application that a document is loading.

Definition at line 161 of file gcr/application.h.

Member Data Documentation

Document* gcr::Application::m_pActiveDoc
protected

The active document.

Definition at line 170 of file gcr/application.h.

Referenced by SetActiveDocument().


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