Main Page - Header
Author: The Inti Development Team

Reference Manual

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

# main.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002 The Inti Development Team.
    00003  *
    00004  *  This program is free software; you can redistribute it and/or modify
    00005  *  it under the terms of the GNU General Public License as published by
    00006  *  the Free Software Foundation; either version 2 of the License, or
    00007  *  (at your option) any later version.
    00008  *
    00009  *  This program is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012  *  GNU Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Library General Public License
    00015  *  along with this program; if not, write to the Free Software
    00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00017  */
    00018
    00045
    00046 #ifndef INTI_MAIN_H
    00047 #define INTI_MAIN_H
    00048
    00049 #ifndef __GTK_MAIN_H__
    00050 #include <gtk/gtkmain.h>
    00051 #endif
    00052
    00053 #ifndef INTI_SLOT_H
    00054 #include <inti/slot.h>
    00055 #endif
    00056
    00057 #ifndef INTI_CONNECTION_H
    00058 #include <inti/connection.h>
    00059 #endif
    00060
    00061 #ifndef INTI_POINTER_H
    00062 #include <inti/pointer.h>
    00063 #endif
    00064
    00065 #ifndef _CPP_VECTOR
    00066 #include <vector>
    00067 #endif
    00068
    00069 namespace Inti {
    00070
    00071 namespace Gdk {
    00072 class Event;
    00073 class EventKey;
    00074 }
    00075
    00076 namespace Gtk {
    00077 class Widget;
    00078 }
    00079
    00080 namespace Main {
    00081
    00082 class SlotNode;
    00083
    00086
    00087         void init(int *argc, char ***argv);
    00098
    00099         bool init_check(int *argc, char ***argv);
    00109
    00110         void init_add(const Slot0<int> *callback);
    00115
    00119
    00120         PangoLanguage* default_language();
    00127
    00128         bool events_pending();
    00144
    00145         Pointer<Gtk::Widget> event_widget(Gdk::Event& event);
    00154
    00158
    00159         void run();
    00163
    00164         int level();
    00169
    00170         void quit();
    00172
    00173         bool iterate(bool blocking = true);
    00181
    00182         void grab_add(Gtk::Widget& widget);
    00188
    00189         Pointer<Gtk::Widget> grab_get_current();
    00192
    00193         void grab_remove(Gtk::Widget& widget);
    00197
    00201
    00204         class QuitSignal
    00205         {
    00206         public:
    00207                 typedef Slot0<bool> SlotType;
    00209
    00210                 Connection connect(const SlotType *slot, unsigned int main_level = 0);
    00218         };
    00219
    00222         extern QuitSignal quit_signal;
    00223
    00226         class TimeoutSignal
    00227         {
    00228         public:
    00229                 typedef Slot0<bool> SlotType;
    00231
    00232                 Connection connect(const SlotType *slot, unsigned int interval);
    00243         };
    00244
    00246         extern TimeoutSignal timeout_signal;
    00247
    00250         class IdleSignal
    00251         {
    00252         public:
    00253                 typedef Slot0<bool> SlotType;
    00255
    00256                 Connection connect(const SlotType *slot, int priority = G_PRIORITY_DEFAULT_IDLE);
    00266         };
    00267
    00270         extern IdleSignal idle_signal;
    00271
    00274         class KeySnooperSignal
    00275         {
    00276                 std::vector<SlotNode*> connection_list;
    00277
    00278         public:
    00279                 typedef Slot2<bool, Gtk::Widget&, const Gdk::EventKey&> SlotType;
    00281
    00282                 ~KeySnooperSignal();
    00284
    00285                 Connection connect(const SlotType *slot);
    00294         };
    00295
    00298         extern KeySnooperSignal key_snooper_signal;
    00299
    00302         class InputSignal
    00303         {
    00304         public:
    00305                 typedef Slot2<void, int, GdkInputCondition> SlotType;
    00307
    00308                 Connection connect(const SlotType *slot, int source, GdkInputCondition condition);
    00318         };
    00319
    00322         extern InputSignal input_signal;
    00323
    00325
    00326 } // namespace Main
    00327
    00328 } // namespace Inti
    00329
    00331
    00332 #define INTI_MAIN(MainWidget)\
    00333         int main (int argc, char *argv[])\
    00334         {\
    00335                 Inti::Main::init(&argc, &argv);\
    00336                 MainWidget main_widget;\
    00337                 main_widget.sig_destroy().connect(slot(&Inti::Main::quit));\
    00338                 main_widget.show();\
    00339                 Inti::Main::run();\
    00340                 return 0;\
    00341         }
    00342
    00343 #endif // INTI_MAIN_H
    00344

Main Page - Footer