Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core7/src/libraries/core/WindowEventListener.cc @ 10547

Last change on this file since 10547 was 10362, checked in by landauf, 10 years ago

use static identifier initializer to store the inheritance definition of abstract classes. this prevents that identifiers are used (via Class(Name)) before they are properly initialized.

  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Reto Grieder
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "WindowEventListener.h"
30#include "CoreIncludes.h"
31
32namespace orxonox
33{
34    unsigned int WindowEventListener::windowWidth_s  = 0;
35    unsigned int WindowEventListener::windowHeight_s = 0;
36
37    RegisterAbstractClass(WindowEventListener).inheritsFrom<Listable>();
38
39    WindowEventListener::WindowEventListener()
40    {
41        RegisterObject(WindowEventListener);
42    }
43
44    //! Calls all registered objects
45    /*static*/ void WindowEventListener::moveWindow()
46    {
47        for (ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)
48            it->windowMoved();
49    }
50
51    //! Calls all registered objects and sets the static variables
52    /*static*/ void WindowEventListener::resizeWindow(unsigned int newWidth, unsigned int newHeight)
53    {
54        windowWidth_s = newWidth;
55        windowHeight_s = newHeight;
56        for (ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)
57            it->windowResized(newWidth, newHeight);
58    }
59
60    //! Calls all registered objects
61    /*static*/ void WindowEventListener::changeWindowFocus(bool bFocus)
62    {
63        for (ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)
64            it->windowFocusChanged(bFocus);
65    }
66}
Note: See TracBrowser for help on using the repository browser.