windowobservers.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00041
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
00053 globalOutputStream() << "Unknown mouse button pressed: ID=" << button << "\n";
00054 return c_buttonInvalid;
00055 }
00056 }
00057
00058
00059
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