/usr/include/Nux-4.0/Nux/BaseWindow.h is in libnux-4.0-dev 4.0.8+16.04.20160209-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | /*
* Copyright 2010 Inalogic® Inc.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License, as
* published by the Free Software Foundation; either version 2.1 or 3.0
* of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the applicable version of the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of both the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Authored by: Jay Taoko <jaytaoko@inalogic.com>
*
*/
#ifndef BASEWINDOW_H
#define BASEWINDOW_H
#include <boost/scoped_ptr.hpp>
#include "ScrollView.h"
#include "NuxGraphics/Events.h"
#if defined(USE_X11)
# include "NuxGraphics/XInputWindow.h"
#endif
#include "InputArea.h"
#include "PaintLayer.h"
namespace nux
{
class BaseWindow;
typedef BaseWindow ViewWindow;
class HLayout;
class PopUpWindow;
#ifdef NUX_GESTURES_SUPPORT
class GestureEvent;
#endif
//typedef TopView BaseWindow;
/*!
A user provided callback to assert the size and position of a floating area.
The callback receives a proposed size and position for the floating area. Inside the callback,
the size and position of the floating area can be modified.
@param int The width of the window.
@param int The height of the window.
@param Geometry& The tentative size of the window.
*/
typedef void(*ConfigureNotifyCallback) (int, int, Geometry &, void *);
/*!
A floating area on top of the main window.
A BaseWindow is referenced by the WindowCompositor who calls Reference on the BaseWindow during registration.
*/
class BaseWindow: public View
{
NUX_DECLARE_OBJECT_TYPE(BaseWindow, View);
public:
BaseWindow(const char *WindowName = "", NUX_FILE_LINE_PROTO);
virtual ~BaseWindow();
nux::Property<bool> premultiply;
virtual Area* FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type);
virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw);
virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw);
virtual Layout* GetLayout();
virtual bool SetLayout(Layout *layout);
//! Push the view one level up the ViewWindow stack.
/*!
Push this view one level up the ViewWindow stack. Does it even if the view is hidden.
*/
void PushHigher(BaseWindow* floating_view);
//! Push the view one level down the ViewWindow stack.
/*!
Push this view one level down the ViewWindow stack. Does it even if the view is hidden.
*/
void PushLower(BaseWindow* floating_view);
//! Push the view to the front of the ViewWindow stack.
/*!
Push this view to the top of the ViewWindow stack. Does it even if the view is hidden.
If a valid ViewWindow has been forced at the top of the stack with a call to WindowCompositor::SetAlwaysOnFrontWindow(),
then this view will be positioned one level below that view.
\sa SetAlwaysOnFrontWindow();
*/
void PushToFront();
//! Push the view to the back of the ViewWindow stack.
/*!
Push this view to the back of the ViewWindow stack. Does it even if the view is hidden.
*/
void PushToBack();
//! Set the window size to respect the layout container.
/*!
Set the window size to be such that the container layout size remains the same after ComputeSizeLayout2 is
called on the layout. The window elements(title bar, minimize and close buttons) are positioned accordingly.
The size grip is not responding anymore.
@param b If b is true, the window size respect the size the layout container.
*/
virtual void SetWindowSizeMatchLayout(bool b)
{
_size_match_layout = b;
}
//! Check if the window size is constrained to the layout container size.
/*!
Check if the window size is constrained to the layout container size.
@return If the return value is true, the window size is constrained by the size the layout container.
*/
bool IsSizeMatchContent() const
{
return _size_match_layout;
}
virtual void ShowWindow(bool b, bool StartModal = false);
void StopModal();
bool IsModal() const;
bool IsVisible() const;
virtual void SetGeometry(const Geometry &geo);
/*!
Call this function to set a callback function that is called when this object is need to be resized or re-positioned.
@param Callback Function to be called to set the this object size and position.
@param Data The callback data.
*/
void SetConfigureNotifyCallback(ConfigureNotifyCallback Callback, void *Data);
void SetBackgroundLayer(AbstractPaintLayer *layer);
void SetBackgroundColor(const Color &color);
void SetOpacity(float opacity);
float GetOpacity();
#if defined(NUX_OS_LINUX)
void EnableInputWindow(bool b,
const char* title = "nux input window",
bool take_focus = False,
bool override_redirect = False);
bool InputWindowEnabled();
void InputWindowEnableStruts(bool enable);
bool InputWindowStrutsEnabled();
void InputWindowEnableOverlayStruts(bool enable);
bool InputWindowOverlayStrutsEnabled();
void SetInputFocus();
Window GetInputWindowId();
#endif
//! Set an InputArea to receive the keyboard focus when the BaseWIndow receives the NUX_WINDOW_ENTER_FOCUS event.
/*!
\sa _enter_focus_input_area.
@param input_area An InputArea pointer object. Must be a child of this BaseWindow.
*/
void SetEnterFocusInputArea(InputArea *input_area);
//! Get the backup texture data of this BaseWindow,
void* GetBackupTextureData(int &width, int &height, int &format);
//! Emit a signal when the BaseWindow becomes visible.
sigc::signal<void, BaseWindow*> sigVisible;
//! Emit a signal when the BaseWindow becomes hidden.
sigc::signal<void, BaseWindow*> sigHidden;
std::string GetWindowName()
{
return _name;
}
void PresentInEmbeddedModeOnThisFrame(bool force = false);
void MarkPresentedInEmbeddedMode();
bool AllowPresentationInEmbeddedMode() const;
nux::Geometry const& LastPresentedGeometryInEmbeddedMode() const;
void PrepareParentRedirectedView();
#ifdef NUX_GESTURES_SUPPORT
virtual Area* GetInputAreaHitByGesture(const nux::GestureEvent &event);
#endif
protected:
void SetAcceptKeyNavFocus(bool accept);
bool accept_key_nav_focus_;
virtual bool AcceptKeyNavFocus();
//! Callback function to set the window position and size.
ConfigureNotifyCallback m_configure_notify_callback;
//! Callback data for ConfigureNotifyCallback.
void *m_configure_notify_callback_data;
//sigc::signal< bool, unsigned int, unsigned int, Geometry & > sigRequestConfigure;
Layout *m_layout;
friend class ComboBox_Logic_WindowView;
virtual void PreLayoutManagement();
virtual long PostLayoutManagement(long LayoutResult);
virtual void ComputeContentPosition(float offsetX, float offsetY);
//! Layout the window elements.
/*!
Layout elements such as button on the title bar, and the resize widget according to the current
geometry of the window. Also initiate the computation of the child layout if there is one.
*/
virtual void LayoutWindowElements();
/*!
Floating Area need to be informed when the main window has been resized.
@param Width New width of the window.
@param Height New height of the window.
*/
virtual void NotifyConfigurationChange(int Width, int Height);
int GetBorder() const;
int GetTopBorder() const;
void SetBorder(int border);
void SetTopBorder(int border);
int m_TopBorder;
int m_Border;
boost::scoped_ptr<AbstractPaintLayer> _paint_layer;
bool _entering_visible_state; //!< the window is about to be made visible during event processing
bool _entering_hidden_state; //!< the window is about to be made hidden during event processing
bool ChildNeedsRedraw();
#if defined(USE_X11)
bool m_input_window_enabled;
XInputWindow *m_input_window;
#endif
private:
//! Contains the background of the texture. Can be used to blur. It is set by the window compositor.
ObjectPtr<BaseTexture> _background_texture;
std::string _name;
bool _size_match_layout;
bool _is_visible;
bool _is_modal;
InputArea *_enter_focus_input_area; //!< An input Area to set the keyboad focus on in response to NUX_WINDOW_ENTER_FOCUS.
std::list<View *> m_InterfaceObject;
bool _child_need_redraw; //!<True is there is a child of the BaseWindow that needs to be redrawn;
float _opacity;
bool _present_in_embedded_mode; //!<True if we should draw this window's
// backing texture to the screen on the
// next frame
nux::Geometry _last_presented_geometry_in_embedded_mode;
bool _contents_ready_for_presentation; //!<True if this window's contents has just been
// redrawn and it is awaiting presentation
friend class PopUpWindow;
friend class WindowThread;
friend class WindowCompositor;
};
}
#endif // BASEWINDOW_H
|