windowobserver.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_WINDOWOBSERVER_H)
00023 #define INCLUDED_WINDOWOBSERVER_H
00024 
00025 template<typename Enumeration> class BitFieldValue;
00026 struct ModifierEnumeration;
00027 typedef BitFieldValue<ModifierEnumeration> ModifierFlags;
00028 
00029 template<typename Enumeration> class EnumeratedValue;
00030 struct ButtonEnumeration;
00031 typedef EnumeratedValue<ButtonEnumeration> ButtonIdentifier;
00032 
00033 #include <algorithm>
00034 #include "math/Vector2.h"
00035 #include "generic/bitfield.h"
00036 
00037 struct ModifierEnumeration {
00038     enum Value {
00039         SHIFT = 0,
00040         CONTROL = 1,
00041         ALT = 2
00042     };
00043 };
00044 
00045 typedef BitFieldValue<ModifierEnumeration> ModifierFlags;
00046 
00047 const ModifierFlags c_modifierNone;
00048 const ModifierFlags c_modifierShift(ModifierEnumeration::SHIFT);
00049 const ModifierFlags c_modifierControl(ModifierEnumeration::CONTROL);
00050 const ModifierFlags c_modifierAlt(ModifierEnumeration::ALT);
00051 
00052 #include "generic/enumeration.h"
00053 
00054 struct ButtonEnumeration {
00055     enum Value {
00056         INVALID = 0,
00057         LEFT = 1,
00058         MIDDLE = 3,
00059         RIGHT = 2
00060     };
00061 };
00062 
00063 typedef EnumeratedValue<ButtonEnumeration> ButtonIdentifier;
00064 
00065 const ButtonIdentifier c_buttonInvalid(ButtonEnumeration::INVALID);
00066 const ButtonIdentifier c_buttonLeft(ButtonEnumeration::LEFT);
00067 const ButtonIdentifier c_buttonMiddle(ButtonEnumeration::MIDDLE);
00068 const ButtonIdentifier c_buttonRight(ButtonEnumeration::RIGHT);
00069 
00070 
00071 template<typename Element>
00072 class BasicVector2;
00073 typedef BasicVector2<float> Vector2;
00074 typedef Vector2 WindowVector;
00075 
00076 class WindowObserver {
00077 public:
00078     virtual ~WindowObserver() {}
00079     virtual void onSizeChanged(int width, int height) = 0;
00080     virtual void onMouseDown(const WindowVector& position, ButtonIdentifier button, ModifierFlags modifiers) = 0;
00081     virtual void onMouseUp(const WindowVector& position, ButtonIdentifier button, ModifierFlags modifiers) = 0;
00082     virtual void onMouseMotion(const WindowVector& position, ModifierFlags modifiers) = 0;
00083     virtual void onModifierDown(ModifierFlags modifier) = 0;
00084     virtual void onModifierUp(ModifierFlags modifier) = 0;
00085 };
00086 
00087 #endif

Generated by  doxygen 1.6.2