gcu::Application Class Reference
#include <gcu/application.h>
List of all members.
Public Member Functions |
| Application (std::string name, std::string datadir=DATADIR, char const *help_name=NULL, char const *icon_name=NULL) |
virtual | ~Application () |
void | OnHelp (std::string s="") |
bool | HasHelp () |
std::string & | GetName () |
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) |
void | ShowURI (std::string &uri) |
void | OnBug (char const *uri=PACKAGE_BUGREPORT) |
void | OnWeb (char const *uri="http://gchemutils.nongnu.org/") |
void | OnMail (char const *MailAddress="mailto:gchemutils-main@nongnu.org") |
void | OnLiveAssistance () |
GtkWidget * | GetImageResolutionWidget () |
GtkWidget * | GetImageSizeWidget () |
std::map< std::string,
GdkPixbufFormat * > & | GetSupportedPixbufFormats () |
char const * | GetPixbufTypeName (std::string &filename, char const *mime_type) |
ContentType | Load (std::string const &uri, const gchar *mime_type, Document *Doc) |
bool | Save (std::string const &uri, const gchar *mime_type, Document const *Doc, ContentType type) |
virtual Document * | CreateNewDocument () |
void | RegisterOptions (GOptionEntry const *entries, char const *translation_domain=GETTEXT_PACKAGE) |
void | AddOptions (GOptionContext *context) |
Static Public Member Functions |
static GOConfNode * | GetConfDir () |
Protected Member Functions |
virtual void | NoMoreDocsEvent () |
Protected Attributes |
std::map< std::string,
GdkPixbufFormat * > | m_SupportedPixbufFormats |
Detailed Description
This class is a base class for applications. It provides some basic services.
Definition at line 55 of file gcu/application.h.
Constructor & Destructor Documentation
gcu::Application::Application |
( |
std::string |
name, |
|
|
std::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".
virtual gcu::Application::~Application |
( |
|
) |
[virtual] |
Member Function Documentation
void gcu::Application::AddOptions |
( |
GOptionContext * |
context |
) |
|
- Parameters:
-
| context,: | a GOptionContext |
Adds all registered options to the context. This should be called once just after creating the application and before parsing options.
virtual Document* gcu::Application::CreateNewDocument |
( |
|
) |
[inline, virtual] |
Virtual method used to create documents. Default behavior does nothing and returns NULL.
- Returns:
- the newly created document or NULL.
Reimplemented in gcp::Application.
Definition at line 221 of file gcu/application.h.
virtual bool gcu::Application::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 | |
|
) |
| | [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 113 of file gcu/application.h.
static GOConfNode* gcu::Application::GetConfDir |
( |
|
) |
[static] |
Method used to retrieve the base configuration node.
- Returns:
- the base configuration node.
char const* gcu::Application::GetCurDir |
( |
|
) |
[inline] |
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.
std::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 93 of file gcu/application.h.
char const* gcu::Application::GetPixbufTypeName |
( |
std::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.
std::map<std::string, GdkPixbufFormat*>& gcu::Application::GetSupportedPixbufFormats |
( |
|
) |
[inline] |
virtual GtkWindow* gcu::Application::GetWindow |
( |
|
) |
[inline, virtual] |
bool gcu::Application::HasHelp |
( |
|
) |
|
- Returns:
- true if both a help browser and a help file are available, false otherwise.
ContentType gcu::Application::Load |
( |
std::string const & |
uri, |
|
|
const gchar * |
mime_type, |
|
|
Document * |
Doc | |
|
) |
| | |
- Parameters:
-
| uri | the uri of the document to load. |
| mime_type | the mime type of the document. |
| Doc | the document instance which will contain the loaded data. |
This method loads a document using the appropriate gcu::Loader class instance.
- Returns:
- true if no error occurred.
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 257 of file gcu/application.h.
void gcu::Application::OnBug |
( |
char const * |
uri = 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 143 of file gcu/application.h.
References ShowURI().
void gcu::Application::OnHelp |
( |
std::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. |
void gcu::Application::OnLiveAssistance |
( |
|
) |
|
Attempts to open the #gchemutils channel at irc.gimp.net.
void gcu::Application::OnMail |
( |
char const * |
MailAddress = "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.
void gcu::Application::OnWeb |
( |
char const * |
uri = "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 150 of file gcu/application.h.
References ShowURI().
void gcu::Application::RegisterOptions |
( |
GOptionEntry const * |
entries, |
|
|
char const * |
translation_domain = GETTEXT_PACKAGE | |
|
) |
| | |
- Parameters:
-
| entries,: | the entries to register. |
| translation_domain,: | the entries to register. |
Adds new command line options. Typically called from a plugin. The new options are added to the main group.
bool gcu::Application::Save |
( |
std::string const & |
uri, |
|
|
const gchar * |
mime_type, |
|
|
Document const * |
Doc, |
|
|
ContentType |
type | |
|
) |
| | |
- Parameters:
-
| uri | the uri to which the document should be saved. |
| mime_type | the mime type of the document. |
| Doc | the document instance which contains the data to be saved. |
| type | the type of the data to be saved (see gcu::ContentType). |
This method saves the document using the appropriate gcu::Loader class instance.
- Returns:
- true if no error occurred.
void gcu::Application::SetCurDir |
( |
std::string const & |
dir |
) |
|
- Parameters:
-
| dir | the path to the new current directory. |
void gcu::Application::SetCurDir |
( |
char const * |
dir |
) |
|
- Parameters:
-
| dir | the path to the new current directory. |
void gcu::Application::ShowURI |
( |
std::string & |
uri |
) |
|
- Parameters:
-
Displays uri in the default web browser if any.
Referenced by OnBug(), and OnWeb().
Member Data Documentation
The documentation for this class was generated from the following file: