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

#include <gcugtk/application.h>

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

Public Member Functions

 Application (std::string name, std::string datadir=DATADIR, char const *help_name=NULL, char const *icon_name=NULL, CmdContextGtk *cc=NULL)
virtual ~Application ()
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 ()

Static Public Member Functions

static WindowState GetDefaultWindowState ()
static void OnReceiveTargets (GtkClipboard *clipboard, GtkSelectionData *selection_data, Application *App)
- Static Public Member Functions inherited from gcu::Application
static GOConfNode * GetConfDir ()
static ApplicationGetDefaultApplication ()
static ApplicationGetApplication (char const *name)
static ApplicationGetApplication (std::string &name)

Protected Member Functions

virtual void NoMoreDocsEvent ()
void CreateDefaultCmdContext ()
bool LoopRunning ()
- Protected Member Functions inherited from gcu::Application
void RegisterBabelType (const char *mime_type, const char *type)

Additional Inherited Members

- Protected Attributes inherited from gcu::Application
std::map< std::string,
GdkPixbufFormat * > 
m_SupportedPixbufFormats
CmdContextm_CmdContext
std::set< Document * > m_Docs

Detailed Description

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

Definition at line 86 of file gcugtk/application.h.

Constructor & Destructor Documentation

gcugtk::Application::Application ( std::string  name,
std::string  datadir = DATADIR,
char const *  help_name = NULL,
char const *  icon_name = NULL,
CmdContextGtk cc = NULL 
)
Parameters
namethe name of the application.
datadirwhere data for the application are stored.
help_namethe name to use for the help file (with .xml extension). If NULL, the name parameter is used.
icon_namethe name to use for the default icon of all windows. If NULL, the help_name or name parameters will be used.
ccthe associated CmdContextGtk.

The datadir variable is used to build the full path to the help file: "file://"+datadir+"/gnome/help/"+name+"/"+LANG+"/"+name".xml".

virtual gcugtk::Application::~Application ( )
virtual

The destructor.

Reimplemented from gcu::Application.

Reimplemented in gcp::Application, and gcr::Application.

Member Function Documentation

void gcugtk::Application::CreateDefaultCmdContext ( )
protectedvirtual

Creates a default GtkCmdContext instance for the application.

Reimplemented from gcu::Application.

static WindowState gcugtk::Application::GetDefaultWindowState ( )
inlinestatic
Returns
the default WindowState for the application. New window should use this setting.

Definition at line 111 of file gcugtk/application.h.

GtkWidget* gcugtk::Application::GetImageResolutionWidget ( )
Returns
a GtkWidget for managing pixmap resolution when saving as image. This widget is intended to be added to a GtkFileChooserDialog.
GtkWidget* gcugtk::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.
gcugtk::Application::GetRecentManager ( void  ) const
inline
Returns
the GtkRecentFileManager attached to the application.

Definition at line 213 of file gcugtk/application.h.

bool gcugtk::Application::LoopRunning ( )
inlineprotectedvirtual
Returns
true if the main loop is running.

Reimplemented from gcu::Application.

Definition at line 205 of file gcugtk/application.h.

virtual void gcugtk::Application::NoMoreDocsEvent ( )
inlineprotectedvirtual
     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.

Reimplemented from gcu::Application.

Definition at line 195 of file gcugtk/application.h.

void gcugtk::Application::OnBug ( GdkScreen *  screen,
char const *  uri = PACKAGE_BUGREPORT 
)
inline
Parameters
screenthe screen where the uri should be displayed.
urithe 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 162 of file gcugtk/application.h.

References ShowURI().

void gcugtk::Application::OnLiveAssistance ( GdkScreen *  screen)
Parameters
screenthe screen where the IRC window should be displayed. Attempts to open the #gchemutils channel at irc.gimp.net.
void gcugtk::Application::OnMail ( GdkScreen *  screen,
char const *  MailAddress = "mailto:gchemutils-main@nongnu.org" 
)
Parameters
screenthe screen where the uri should be displayed.
MailAddressthe 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.

static void gcugtk::Application::OnReceiveTargets ( GtkClipboard *  clipboard,
GtkSelectionData *  selection_data,
Application App 
)
inlinestatic
Parameters
clipboarda GtkClipboard
selection_datathe current GtkSelectionData
Appthe Application target

Static callback to pass as third argument to gtk_clipboard_request_contents(). App must be used as fourth argument (user_data).

Definition at line 143 of file gcugtk/application.h.

References ReceiveTargets().

void gcugtk::Application::OnWeb ( GdkScreen *  screen,
char const *  uri = "http://gchemutils.nongnu.org/" 
)
inline
Parameters
screenthe screen where the uri should be displayed.
urithe uri to the main web page of the program. Default value is "http://gchemutils.nongnu.org/".

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

References ShowURI().

virtual void gcugtk::Application::ReceiveTargets ( G_GNUC_UNUSED GtkClipboard *  clipboard,
G_GNUC_UNUSED GtkSelectionData *  selection_data 
)
inlinevirtual
Parameters
clipboarda GtkClipboard
selection_datathe current GtkSelectionData

The virtual member called by OnReceiveTargets(). The defaullt implementation does nothing. This method should be overriden for derived classes supporting clipboard operations.

Definition at line 133 of file gcugtk/application.h.

Referenced by OnReceiveTargets().

void gcugtk::Application::ShowURI ( GdkScreen *  screen,
std::string &  uri 
)
Parameters
screenthe screen wher the uri should be displayed.
urithe uri to display.

Displays uri in the default web browser if any.

Referenced by OnBug(), and OnWeb().


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