windowobservers.h

Go to the documentation of this file.
00001 /*
00002  Copyright (C) 2001-2006, William Joseph.
00003  All Rights Reserved.
00004 
00005  This file is part of GtkRadiant.
00006 
00007  GtkRadiant is free software; you can redistribute it and/or modify
00008  it under the terms of the GNU General Public License as published by
00009  the Free Software Foundation; either version 2 of the License, or
00010  (at your option) any later version.
00011 
00012  GtkRadiant is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU General Public License for more details.
00016 
00017  You should have received a copy of the GNU General Public License
00018  along with GtkRadiant; if not, write to the Free Software
00019  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020  */
00021 
00022 #if !defined(INCLUDED_WINDOWOBSERVERS_H)
00023 #define INCLUDED_WINDOWOBSERVERS_H
00024 
00025 #include "windowobserver.h"
00026 
00027 #include <gdk/gdktypes.h>
00028 
00029 #include "math/Vector3.h"
00030 #include "stream/textstream.h"
00031 #include "stream/textfilestream.h"
00032 
00033 class WindowObserver;
00034 void GlobalWindowObservers_add (WindowObserver* observer);
00035 typedef struct _GtkWidget GtkWidget;
00036 typedef struct _GtkWindow GtkWindow;
00037 void GlobalWindowObservers_connectWidget (GtkWidget* widget);
00038 void GlobalWindowObservers_connectTopLevel (GtkWindow* window);
00039 
00040 /* greebo: This translates the button information from an GDKEvent event->button
00041  * into the constants defined in include/windowobserver.h */
00042 inline ButtonIdentifier button_for_button (unsigned int button)
00043 {
00044     switch (button) {
00045     case 1:
00046         return c_buttonLeft;
00047     case 2:
00048         return c_buttonMiddle;
00049     case 3:
00050         return c_buttonRight;
00051     default:
00052         // no button ID has matched, this button is "unknown", inform the user about the ID
00053         globalOutputStream() << "Unknown mouse button pressed: ID=" << button << "\n";
00054         return c_buttonInvalid;
00055     }
00056 }
00057 
00058 /* greebo: This translates the modifier information from an GDKEvent event->state
00059  * into the constants defined in include/windowobserver.h */
00060 inline ModifierFlags modifiers_for_state (unsigned int state)
00061 {
00062     ModifierFlags modifiers = c_modifierNone;
00063     if (state & GDK_SHIFT_MASK)
00064         modifiers |= c_modifierShift;
00065     if (state & GDK_CONTROL_MASK)
00066         modifiers |= c_modifierControl;
00067     if (state & GDK_MOD1_MASK)
00068         modifiers |= c_modifierAlt;
00069     return modifiers;
00070 }
00071 
00072 inline WindowVector WindowVector_forDouble (double x, double y)
00073 {
00074     return WindowVector(static_cast<float> (x), static_cast<float> (y));
00075 }
00076 
00077 #endif

Generated by  doxygen 1.6.2