Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# main.h File Reference

Initialization and main processing loop interface. More...

`#include <gtk/gtkmain.h>`
`#include <inti/slot.h>`
`#include <inti/connection.h>`
`#include <inti/pointer.h>`
`#include <vector>`

Go to the source code of this file.

## Namespaces

- namespace Inti
- namespace Inti::Gdk
- namespace Inti::Gtk
- namespace Inti::Main

## Defines

- #define INTI_MAIN(MainWidget)
    INTI_MAIN is a convenience macro that writes a simple main function.

## Detailed Description

Initialization and main processing loop interface.

Inti wraps the GTK+ initialization functions and events into the Main namespace rather than a static class. Before using Inti, you need to initialize it. Initialization connects to the window system display, and parses some standard command line arguments. The init() function initializes Inti. init() exits the application if errors occur; to avoid this, use init_check(). init_check() allows you to recover from a failed Inti initialization - you might start up your application in text mode instead.

Like all GUI toolkits, Inti uses an event-driven programming model. When the user is doing nothing, Inti sits in the main loop and waits for input. If the user performs some action - say, a mouse click - then the main loop "wakes up" and delivers an event to Inti. Inti forwards the event to one or more widgets.

When widgets receive an event, they frequently emit one or more signals. Signals notify your program that "something interesting happened" by invoking slots you've connected to the signal with the signal's connect() method. Slots are callable objects that can be connected to signals. Slots can be used to connect static functions, class methods and function objects to a signal. When your slot is called it invokes your function or method.

When your methods are invoked, you would typically take some action - for example, when an Open button is clicked you might display a Gtk::FileSelectionDialog. After a callback finishes, Inti will return to the main loop and await more user input.
Main Page - Footer