nux-0.9.48

NuxGraphics/XInputWindow.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2010 Inalogic® Inc.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License, as
00006  * published by the  Free Software Foundation; either version 2.1 or 3.0
00007  * of the License.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranties of
00011  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00012  * PURPOSE.  See the applicable version of the GNU Lesser General Public
00013  * License for more details.
00014  *
00015  * You should have received a copy of both the GNU Lesser General Public
00016  * License along with this program. If not, see <http://www.gnu.org/licenses/>
00017  *
00018  * Authored by: Jay Taoko <jay.taoko_AT_gmail_DOT_com>
00019  *
00020  */
00021 
00022 #ifndef XINPUTWINDOW_H
00023 #define XINPUTWINDOW_H
00024 
00025 /* Xlib.h is the default header that is included and has the core functionallity */
00026 #include <X11/Xlib.h>
00027 /* Xatom.h includes functionallity for creating new protocol messages */
00028 #include <X11/Xatom.h>
00029 /* keysym.h contains keysymbols which we use to resolv what keys that are being pressed */
00030 #include <X11/keysym.h>
00031 
00032 #include <X11/extensions/xf86vmode.h>
00033 
00034 #include "NuxCore/NuxCore.h"
00035 #include "NuxCore/Rect.h"
00036 
00037 namespace nux
00038 {
00039 
00040   class XInputWindow
00041   {
00042   public:
00043     XInputWindow(const char* title,
00044                  bool        take_focus = False,
00045                  int         override_redirect = 0);
00046     ~XInputWindow();
00047     
00048     static std::list<Window> NativeHandleList();
00049     
00050     void EnableStruts(bool enable);
00051     bool StrutsEnabled();
00052     
00053     void EnsureInputs();
00054 
00055     void EnableTakeFocus ();
00056 
00058     void SetGeometry(const Rect& geo);
00059 
00061     void SetGeometry(int x, int y, int width, int height);
00062     
00064     Rect GetGeometry() const;
00065     
00067     Window GetWindow ();
00068 
00069     void SetInputFocus ();
00070     
00071     void Hide ();
00072     void Show ();
00073 
00074   private:
00075   
00076     void SetStruts ();
00077     void UnsetStruts ();
00078     
00079     void EnableDnd ();
00080     void DisableDnd ();
00081   
00082     static std::list<Window> _native_windows;
00083   
00084     bool _strutsEnabled;
00085     Window _window;
00086     Display *_display;
00087     int _x;
00088     int _y;
00089     int _width;
00090     int _height;
00091     bool _shown;
00092     bool _mapped;
00093     
00094   };
00095 }
00096 
00097 #endif // XINPUTWINDOW_H
00098