gcu::Application Class Reference

#include <gcu/application.h>

Inheritance diagram for gcu::Application:

gcu::DialogOwner List of all members.

Public Member Functions

 Application (string name, string datadir=DATADIR, char const *help_name=NULL, char const *icon_name=NULL)
void OnHelp (string s="")
bool HasHelp ()
string & GetName ()
virtual GtkWindow * GetWindow ()
virtual bool FileProcess (const gchar *filename, const gchar *mime_type, bool bSave, GtkWindow *window, Document *pDoc=NULL)
char const * GetCurDir ()
void SetCurDir (char const *dir)
void ShowURI (string &uri)
void OnBug (char *uri=(char *) PACKAGE_BUGREPORT)
void OnWeb (char *uri=(char *)"http://gchemutils.nongnu.org/")
void OnMail (char *MailAddress=(char *)"mailto:gchemutils-main@nongnu.org")
bool HasMailAgent ()
bool HasWebBrowser ()
GtkWidget * GetImageResolutionWidget ()
GtkWidget * GetImageSizeWidget ()
map< string, GdkPixbufFormat * > & GetSupportedPixbufFormats ()
char const * GetPixbufTypeName (string &filename, char const *mime_type)
set< Document * > GetDocs (void)
unsigned GetScreenResolution (void)
void SetImageResolution (unsigned val)
unsigned GetImageResolution (void)
unsigned & GetRefImageResolution (void)
void SetImageWidth (unsigned val)
unsigned GetImageWidth (void)
unsigned & GetRefImageWidth (void)
void SetImageHeight (unsigned val)
unsigned GetImageHeight (void)
unsigned & GetRefImageHeight (void)
GtkRecentManager * GetRecentManager (void)

Protected Member Functions

virtual void NoMoreDocsEvent ()

Protected Attributes

map< string, GdkPixbufFormat * > m_SupportedPixbufFormats
set< Document * > m_Docs

Detailed Description

This class is a base class for applications. It provides some basic services.

Definition at line 47 of file application.h.


Constructor & Destructor Documentation

gcu::Application::Application ( string  name,
string  datadir = DATADIR,
char const *  help_name = NULL,
char const *  icon_name = NULL 
)

Parameters:
name the name of the application.
datadir where data for the application are stored.
help_name the name to use for the help file (with .xml extension). If NULL, the name parameter is used.
icon_name the name to use for the default icon of all windows. If NULL, the help_name or name parameters will be used.
The datadir variable is used to build the full path to the help file: "file://"+datadir+"/gnome/help/"+name+"/"+LANG+"/"+name".xml".


Member Function Documentation

void gcu::Application::OnHelp ( string  s = ""  ) 

Parameters:
s an optional tag in the help file. Displays the help file using the file browser retrieved from GConf using the "/desktop/gnome/applications/help_viewer/exec" key. If a tag is given, it will be added to the help uri. For an application named "myapp" and a tag "mytag", the uri will be: helpfilename#myapp-mytag.

bool gcu::Application::HasHelp (  ) 

Returns:
true if both a help browser and a help file are available, false otherwise.

string& gcu::Application::GetName (  )  [inline]

Returns:
the name of the application. Mostly useful to set the icon name of a new window.

Definition at line 82 of file application.h.

virtual GtkWindow* gcu::Application::GetWindow (  )  [inline, virtual]

Returns:
a GtkWindow if any. Should be overloaded by children classes.

Definition at line 87 of file application.h.

virtual bool gcu::Application::FileProcess ( const gchar *  filename,
const gchar *  mime_type,
bool  bSave,
GtkWindow *  window,
Document pDoc = NULL 
) [inline, virtual]

Parameters:
filename the uri of the file.
mime_type the mime type of the file if known.
bSave true if saving, and false if loading.
window the current top level window.
pDoc an optional document.
Called by the FileChooser when a file name has been selected. This method does nothing in the parent class and must be implemented in children classes if they use the FileChooser.

Returns:
true if no error occured.

Definition at line 102 of file application.h.

char const* gcu::Application::GetCurDir (  )  [inline]

Returns:
the path to the current directory.

Definition at line 108 of file application.h.

void gcu::Application::SetCurDir ( char const *  dir  ) 

Parameters:
dir the path to the new current directory.

void gcu::Application::ShowURI ( string &  uri  ) 

Parameters:
uri the uri to display.
Displays uri in the default web browser if any.

Referenced by OnBug(), and OnWeb().

void gcu::Application::OnBug ( char *  uri = (char*) PACKAGE_BUGREPORT  )  [inline]

Parameters:
uri the uri to the package bugs database. Default value is PACKAGE_BUGREPORT.
Opens the bugs web page in the default browser if any.

Definition at line 127 of file application.h.

References ShowURI().

void gcu::Application::OnWeb ( char *  uri = (char*) "http://gchemutils.nongnu.org/"  )  [inline]

Parameters:
uri the uri to the main web page of the program. Default value is "http://gchemutils.nongnu.org/".

Definition at line 134 of file application.h.

References ShowURI().

void gcu::Application::OnMail ( char *  MailAddress = (char *)"mailto:gchemutils-main@nongnu.org"  ) 

Parameters:
MailAddress the mail adress to which a message will be sent. Defaults to the Gnome Chemistry Utils main list.
Creates a new empty message using the default mail if any.

bool gcu::Application::HasMailAgent (  )  [inline]

Returns:
true if the default mail agent is known, false otherwise.

Definition at line 148 of file application.h.

bool gcu::Application::HasWebBrowser (  )  [inline]

Returns:
true if the default web browser is known, false otherwise.

Definition at line 153 of file application.h.

GtkWidget* gcu::Application::GetImageResolutionWidget (  ) 

Returns:
a GtkWidget for managing pixmap resolution when saving as image. This widget is intended to be added to a GtkFileChooserDialog.

GtkWidget* gcu::Application::GetImageSizeWidget (  ) 

Returns:
a GtkWidget for managing pixmap width and height when saving as image. This widget is intended to be added to a GtkFileChooserDialog.

map<string, GdkPixbufFormat*>& gcu::Application::GetSupportedPixbufFormats (  )  [inline]

Returns:
a std::map of the supported pixbuf formats. Keys are the mime type names.

Definition at line 170 of file application.h.

References m_SupportedPixbufFormats.

char const* gcu::Application::GetPixbufTypeName ( string &  filename,
char const *  mime_type 
)

Parameters:
filename the file name.
mime_type the file mime type.
A default extension is appended to filename if none is detected.

Returns:
the GdkPixbuf name associated to mime_type or NULL if the file type is not supported by GdkPixbuf.

virtual void gcu::Application::NoMoreDocsEvent (  )  [inline, protected, virtual]

This method is called by the framework when all the documents have been removed from the set of opened documents. The default behavior is to call gtk_main_quit and exit the program. Derived class might overide this method to change this.

Definition at line 190 of file application.h.

gcu::Application::GetDocs ( void   )  [inline]

Returns:
the set of currently opened documents.

Definition at line 217 of file application.h.

gcu::Application::GetScreenResolution ( void   )  [inline]

Returns:
the current screen resolution.

Definition at line 221 of file application.h.

gcu::Application::SetImageResolution ( unsigned  ImageResolution  )  [inline]

Parameters:
ImageResolution the new image resolution. Sets the image resolution used when exporting a pixmap. Applications can use either the image resolution or the width and height to select an exported image size, but not both.

Definition at line 234 of file application.h.

gcu::Application::GetImageResolution ( void   )  [inline]

Returns:
the current image resolution used on export.

Definition at line 234 of file application.h.

gcu::Application::GetRefImageResolution ( void   )  [inline]

Returns:
the current image resolution used on export as a reference.

Definition at line 234 of file application.h.

gcu::Application::SetImageWidth ( unsigned  Width  )  [inline]

Parameters:
Width the new image width. Sets the image width used when exporting a pixmap. Applications can use either the image resolution or the width and height to select an exported image size, but not both.

Definition at line 247 of file application.h.

gcu::Application::GetImageWidth ( void   )  [inline]

Returns:
the current image width used on export.

Definition at line 247 of file application.h.

gcu::Application::GetRefImageWidth ( void   )  [inline]

Returns:
the current image width used on export as a reference.

Definition at line 247 of file application.h.

gcu::Application::SetImageHeight ( unsigned  Height  )  [inline]

Parameters:
Height the new image height. Sets the image height used when exporting a pixmap. Applications can use either the image resolution or the width and height to select an exported image size, but not both.

Definition at line 260 of file application.h.

gcu::Application::GetImageHeight ( void   )  [inline]

Returns:
the current image height used on export.

Definition at line 260 of file application.h.

gcu::Application::GetRefImageHeight ( void   )  [inline]

Returns:
the current image height used on export as a reference.

Definition at line 260 of file application.h.

gcu::Application::GetRecentManager ( void   )  [inline]

Returns:
the GtkRecentFileManager attached to the application.

Definition at line 264 of file application.h.


Member Data Documentation

map<string, GdkPixbufFormat*> gcu::Application::m_SupportedPixbufFormats [protected]

std::map of the supported pixbuf formats. Keys are the mime type names.

Definition at line 209 of file application.h.

Referenced by GetSupportedPixbufFormats().

gcu::Application::m_Docs [protected]

The currently opened documents.

Definition at line 217 of file application.h.


The documentation for this class was generated from the following file:
Generated on Thu Jul 26 18:05:01 2007 for The Gnome Chemistry Utils by  doxygen 1.5.2