libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
GtkCRN::App Class Reference

Base class to create an application. More...

#include <GtkCRNApp.h>

+ Inheritance diagram for GtkCRN::App:
+ Collaboration diagram for GtkCRN::App:

Public Member Functions

 App ()
 Constructor. Creates Actions and adds them to UI manager. More...
 
virtual ~App ()
 Destructor. More...
 

Static Public Member Functions

static Gtk::Window * get_main_window ()
 Gets a pointer to the main window. More...
 
static void set_main_window (Gtk::Window *win)
 Sets the main window of the application to be used as parent for dialogs and messages. More...
 
static void show_message (const Glib::ustring &message, Gtk::MessageType mtype)
 Displays a message. More...
 
static void show_exception (crn::Exception &ex, bool kill_app=true)
 Displays an exception. More...
 
static void show_exception (std::exception &ex, bool kill_app=true)
 Displays an exception. More...
 
static void show_exception (bool kill_app=true)
 Displays an exception. More...
 

Protected Member Functions

virtual bool ask_for_quit (GdkEventAny *event)
 Callback for application quit event (overloadable) More...
 
virtual void help ()
 Displays help (overloadable) More...
 
virtual void about ()
 Displays credits (overloadable) More...
 
Glib::ustring ask_for_string (const Glib::ustring &msg, const Glib::ustring &defval="")
 Shows a dialog asking for a single string. More...
 

Static Protected Member Functions

static Gtk::Window *& internal_main_window ()
 

Protected Attributes

Glib::RefPtr< Gtk::UIManager > ui_manager
 
Glib::RefPtr< Gtk::ActionGroup > actions
 

Detailed Description

Base class to create an application.

Definition at line 35 of file GtkCRNApp.h.

Constructor & Destructor Documentation

App::App ( )

Constructor. Creates Actions and adds them to UI manager.

Available actions are:

  • app-file-menu
  • app-quit
  • app-help-menu
  • app-help (overload virtual void help() to customize)
  • app-about (overload virtual void about() to customize)

Constructor. Creates Actions and adds them to UI manager.

Definition at line 55 of file GtkCRNApp.cpp.

virtual GtkCRN::App::~App ( )
inlinevirtual

Destructor.

Definition at line 54 of file GtkCRNApp.h.

Member Function Documentation

virtual void GtkCRN::App::about ( )
inlineprotectedvirtual

Displays credits (overloadable)

Definition at line 76 of file GtkCRNApp.h.

bool App::ask_for_quit ( GdkEventAny *  event)
protectedvirtual

Callback for application quit event (overloadable)

Callback for application quit event (overloadable)

Parameters
[in]eventonly valid if the callback was called by the window manager
Returns
true to continue app, false after call to Gtk::Main::Quit

Definition at line 76 of file GtkCRNApp.cpp.

Glib::ustring App::ask_for_string ( const Glib::ustring &  msg,
const Glib::ustring &  defval = "" 
)
protected

Shows a dialog asking for a single string.

Shows a dialog asking for a single string

Parameters
[in]msgthe message to display in the dialog
[in]defvalthe default value of the entry
Returns
the entered string or empty string if the dialog was canceled

Definition at line 96 of file GtkCRNApp.cpp.

static Gtk::Window* GtkCRN::App::get_main_window ( )
inlinestatic

Gets a pointer to the main window.

Definition at line 57 of file GtkCRNApp.h.

virtual void GtkCRN::App::help ( )
inlineprotectedvirtual

Displays help (overloadable)

Definition at line 74 of file GtkCRNApp.h.

Gtk::Window *& App::internal_main_window ( )
staticprotected

Definition at line 36 of file GtkCRNApp.cpp.

static void GtkCRN::App::set_main_window ( Gtk::Window *  win)
inlinestatic

Sets the main window of the application to be used as parent for dialogs and messages.

Definition at line 59 of file GtkCRNApp.h.

void App::show_exception ( crn::Exception ex,
bool  kill_app = true 
)
static

Displays an exception.

Displays an unknown exception

Parameters
[in]exthe exception to display
[in]kill_appshall the application be killed after the exceptions was displayed?

Definition at line 207 of file GtkCRNApp.cpp.

void App::show_exception ( std::exception &  ex,
bool  kill_app = true 
)
static

Displays an exception.

Displays an unknown exception

Parameters
[in]exthe exception to display
[in]kill_appshall the application be killed after the exceptions was displayed?

Definition at line 220 of file GtkCRNApp.cpp.

void App::show_exception ( bool  kill_app = true)
static

Displays an exception.

Displays an unknown exception

Parameters
[in]kill_appshall the application be killed after the exceptions was displayed?

Definition at line 195 of file GtkCRNApp.cpp.

void App::show_message ( const Glib::ustring &  message,
Gtk::MessageType  mtype 
)
static

Displays a message.

Displays a message

Parameters
[in]messagethe message to display
[in]mtypethe icon to display next to the text

Definition at line 149 of file GtkCRNApp.cpp.

Member Data Documentation

Glib::RefPtr<Gtk::ActionGroup> GtkCRN::App::actions
protected

default actions

Definition at line 84 of file GtkCRNApp.h.

Glib::RefPtr<Gtk::UIManager> GtkCRN::App::ui_manager
protected

add your action groups to the ui manager to easily create menus and toolbars

Definition at line 83 of file GtkCRNApp.h.


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