#include <gcu/application.h>
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 () |
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) |
Object * | CreateObject (const std::string &TypeName, Object *parent=NULL) |
bool | BuildObjectContextualMenu (Object *target, GtkUIManager *UIManager, Object *object, double x, double y) |
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) |
const std::string & | GetCreationLabel (const std::string &TypeName) |
void | AddMenuCallback (TypeId Id, BuildMenuCb cb) |
std::set< Document * > | GetDocs (void) |
unsigned | GetScreenResolution (void) const |
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) |
GtkRecentManager * | GetRecentManager (void) const |
Static Public Member Functions | |
static GOConfNode * | GetConfDir () |
static WindowState | GetDefaultWindowState () |
static Application * | GetDefaultApplication () |
Protected Member Functions | |
virtual void | NoMoreDocsEvent () |
Protected Attributes | |
std::map< std::string, GdkPixbufFormat * > | m_SupportedPixbufFormats |
std::set< Document * > | m_Docs |
Definition at line 72 of file gcu/application.h.
gcu::Application::Application | ( | std::string | name, | |
std::string | datadir = DATADIR , |
|||
char const * | help_name = NULL , |
|||
char const * | icon_name = NULL | |||
) |
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. |
virtual gcu::Application::~Application | ( | ) | [virtual] |
The destructor.
Reimplemented in gcp::Application.
void gcu::Application::AddMenuCallback | ( | TypeId | Id, | |
BuildMenuCb | cb | |||
) |
Id | the TypeId of the Object derived class | |
cb | the BuildMenuCb callback to call when building the menu. |
void gcu::Application::AddOptions | ( | GOptionContext * | context | ) |
context,: | a GOptionContext |
void gcu::Application::AddRule | ( | const std::string & | type1, | |
RuleId | rule, | |||
const std::string & | type2 | |||
) |
type1 | the name of the first class in the rule | |
rule | the new rule value | |
type2 | the name of the second class in the rule |
type1 | the TypeId of the first class in the rule | |
rule | the new rule value | |
type2 | the TypeId of the second class in the rule |
TypeId gcu::Application::AddType | ( | std::string | TypeName, | |
Object *(*)() | CreateFunc, | |||
TypeId | id = OtherType | |||
) |
TypeName | the name of the new type. | |
CreateFunc | a pointer to a function returning a pointer to a new object of the new type. | |
id | the Id of the type to create if a standard one or OtherType for a new type. In this last case, this parameter can be omitted. |
bool gcu::Application::BuildObjectContextualMenu | ( | Object * | target, | |
GtkUIManager * | UIManager, | |||
Object * | object, | |||
double | x, | |||
double | y | |||
) |
UIManager | the GtkUIManager to populate. | |
object | the Object on which occured the mouse click. | |
x | x coordinate of the mouse click. | |
y | y coordinate of the mouse click. |
virtual Document* gcu::Application::CreateNewDocument | ( | ) | [inline, virtual] |
Virtual method used to create documents. Default behavior does nothing and returns NULL.
Reimplemented in gcp::Application.
Definition at line 239 of file gcu/application.h.
TypeName | the name of the new type. | |
parent | the parent of the newly created object or NULL. if NULL, the parameter can be omitted. |
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] |
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. |
Definition at line 131 of file gcu/application.h.
static GOConfNode* gcu::Application::GetConfDir | ( | ) | [static] |
Method used to retrieve the base configuration node.
const std::string& gcu::Application::GetCreationLabel | ( | const std::string & | TypeName | ) |
TypeName | the name of a class |
const std::string& gcu::Application::GetCreationLabel | ( | TypeId | Id | ) |
Id | the TypeId of a class |
char const* gcu::Application::GetCurDir | ( | ) | [inline] |
static Application* gcu::Application::GetDefaultApplication | ( | ) | [static] |
static WindowState gcu::Application::GetDefaultWindowState | ( | ) | [inline, static] |
Definition at line 272 of file gcu/application.h.
gcu::Application::GetDocs | ( | void | ) | [inline] |
std::string const& gcu::Application::GetIconName | ( | ) | [inline] |
Retrieves the icon name that should be set to every window owned by the application.
Definition at line 251 of file gcu/application.h.
gcu::Application::GetImageHeight | ( | void | ) | const [inline] |
gcu::Application::GetImageResolution | ( | void | ) | const [inline] |
Definition at line 436 of file gcu/application.h.
GtkWidget* gcu::Application::GetImageResolutionWidget | ( | ) |
GtkWidget* gcu::Application::GetImageSizeWidget | ( | ) |
gcu::Application::GetImageWidth | ( | void | ) | const [inline] |
std::string& gcu::Application::GetName | ( | ) | [inline] |
Definition at line 111 of file gcu/application.h.
char const* gcu::Application::GetPixbufTypeName | ( | std::string & | filename, | |
char const * | mime_type | |||
) |
filename | the file name. | |
mime_type | the file mime type. |
gcu::Application::GetRecentManager | ( | void | ) | const [inline] |
Definition at line 480 of file gcu/application.h.
gcu::Application::GetRefImageHeight | ( | void | ) | [inline] |
Definition at line 464 of file gcu/application.h.
gcu::Application::GetRefImageResolution | ( | void | ) | [inline] |
Definition at line 436 of file gcu/application.h.
gcu::Application::GetRefImageWidth | ( | void | ) | [inline] |
Definition at line 450 of file gcu/application.h.
gcu::Application::GetRefTransparentBackground | ( | void | ) | [inline] |
Definition at line 476 of file gcu/application.h.
type | the name of a class | |
rule | a RuleId value |
type | the TypeId of a class | |
rule | a RuleId value |
gcu::Application::GetScreenResolution | ( | void | ) | const [inline] |
std::map<std::string, GdkPixbufFormat*>& gcu::Application::GetSupportedPixbufFormats | ( | ) | [inline] |
Definition at line 199 of file gcu/application.h.
References m_SupportedPixbufFormats.
gcu::Application::GetTransparentBackground | ( | void | ) | const [inline] |
Definition at line 476 of file gcu/application.h.
virtual GtkWindow* gcu::Application::GetWindow | ( | ) | [inline, virtual] |
Reimplemented in gcp::Application.
Definition at line 116 of file gcu/application.h.
bool gcu::Application::HasHelp | ( | ) |
ContentType gcu::Application::Load | ( | std::string const & | uri, | |
const gchar * | mime_type, | |||
Document * | Doc | |||
) |
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. |
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 388 of file gcu/application.h.
void gcu::Application::OnBug | ( | char const * | uri = PACKAGE_BUGREPORT |
) | [inline] |
uri | the uri to the package bugs database. Default value is PACKAGE_BUGREPORT. |
Definition at line 161 of file gcu/application.h.
References ShowURI().
void gcu::Application::OnHelp | ( | std::string | s = "" |
) |
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" |
) |
MailAddress | the mail adress to which a message will be sent. Defaults to the Gnome Chemistry Utils main list. |
void gcu::Application::OnWeb | ( | char const * | uri = "http://gchemutils.nongnu.org/" |
) | [inline] |
uri | the uri to the main web page of the program. Default value is "http://gchemutils.nongnu.org/". |
Definition at line 168 of file gcu/application.h.
References ShowURI().
void gcu::Application::RegisterOptions | ( | GOptionEntry const * | entries, | |
char const * | translation_domain = GETTEXT_PACKAGE | |||
) |
entries,: | the entries to register. | |
translation_domain,: | the entries to register. |
bool gcu::Application::Save | ( | std::string const & | uri, | |
const gchar * | mime_type, | |||
Document const * | Doc, | |||
ContentType | type | |||
) |
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). |
void gcu::Application::SetCreationLabel | ( | TypeId | Id, | |
std::string | Label | |||
) |
Id | the TypeId of a class | |
Label | the string to display in a contextual menu |
void gcu::Application::SetCurDir | ( | std::string const & | dir | ) |
dir | the path to the new current directory. |
void gcu::Application::SetCurDir | ( | char const * | dir | ) |
dir | the path to the new current directory. |
gcu::Application::SetImageHeight | ( | unsigned | Height | ) | [inline] |
Height | the new image height. |
Definition at line 464 of file gcu/application.h.
gcu::Application::SetImageResolution | ( | unsigned | ImageResolution | ) | [inline] |
ImageResolution | the new image resolution. |
Definition at line 436 of file gcu/application.h.
gcu::Application::SetImageWidth | ( | unsigned | Width | ) | [inline] |
Width | the new image width. |
Definition at line 450 of file gcu/application.h.
gcu::Application::SetTransparentBackground | ( | bool | transparent | ) | [inline] |
transparent | whether an export image should have a transparent background. |
Definition at line 476 of file gcu/application.h.
void gcu::Application::ShowURI | ( | std::string & | uri | ) |
gcu::Application::m_Docs [protected] |
The currently opened documents.
Definition at line 418 of file gcu/application.h.
Referenced by gcp::Application::GetDocsNumber().
std::map<std::string, GdkPixbufFormat*> gcu::Application::m_SupportedPixbufFormats [protected] |
std::map of the supported pixbuf formats. Keys are the mime type names.
Definition at line 410 of file gcu/application.h.
Referenced by GetSupportedPixbufFormats().