news download themes documentation links










EventManager.hh

00001 // EventManager.hh
00002 // Copyright (c) 2002 Henrik Kinnunen (fluxgen at linuxmail.org)
00003 //
00004 // Permission is hereby granted, free of charge, to any person obtaining a
00005 // copy of this software and associated documentation files (the "Software"),
00006 // to deal in the Software without restriction, including without limitation
00007 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008 // and/or sell copies of the Software, and to permit persons to whom the
00009 // Software is furnished to do so, subject to the following conditions:
00010 //
00011 // The above copyright notice and this permission notice shall be included in
00012 // all copies or substantial portions of the Software.
00013 //
00014 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.    IN NO EVENT SHALL
00017 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00019 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00020 // DEALINGS IN THE SOFTWARE.
00021 
00022 // $Id: EventManager.hh,v 1.7 2003/12/16 17:06:49 fluxgen Exp $
00023 
00024 #include "EventHandler.hh"
00025 #include <map>
00026 
00027 namespace FbTk {
00028 
00029 class FbWindow;
00030 
00034 class EventManager {
00035 public: 
00036     static EventManager *instance();
00037     
00038     void handleEvent(XEvent &ev);
00039     // adds a parent to listen to the childrens events
00040     void addParent(EventHandler &ev, const FbWindow &parent);
00041     void add(EventHandler &ev, const FbWindow &win);
00042     void remove(const FbWindow &win);
00043     void add(EventHandler &ev, Window win) { registerEventHandler(ev, win); }
00044     void remove(Window win) { unregisterEventHandler(win); }
00045 
00046     // Some events have the parent window as the xany.window
00047     // This function always returns the actual window member of the event structure
00048     static Window getEventWindow(XEvent &ev);
00049 
00050     void registerEventHandler(EventHandler &ev, Window win);
00051     void unregisterEventHandler(Window win);
00052 private:
00053     EventManager() { }
00054     ~EventManager();
00055     void dispatch(Window win, XEvent &event, bool parent = false);
00056     std::map<Window, EventHandler *> m_eventhandlers;
00057     std::map<Window, EventHandler *> m_parent;
00058 };
00059 
00060 } //end namespace FbTk

Fluxbox CVS-Jan-2003




      



Got comments about the page? Send them to webmaster.
If you have general Fluxbox related questions ask them on our irc channel or mailing lists.

Show Source








Designed by aLEczapKA