/usr/include/Nux-4.0/Nux/View.h is in libnux-4.0-dev 4.0.8+17.10.20170922-0ubuntu1.
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 | /*
* 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 ABSTRACTOBJECTBASE_H
#define ABSTRACTOBJECTBASE_H
#include "Nux.h"
#include "NuxCore/Property.h"
#define NeedRedraw QueueDraw
namespace nux
{
class Layout;
#ifdef NUX_GESTURES_SUPPORT
class GestureEvent;
#endif
class View: public InputArea
{
NUX_DECLARE_OBJECT_TYPE(View, InputArea);
public:
View(NUX_FILE_LINE_DECL);
virtual ~View();
public:
/*
If ComputeContentSize is called while outside of the layout process (\sa IsInsideLayoutCycle) then the parents of
this object maybe added to the layout queue if this view size changes. \sa Area::ReconfigureParentLayout.
*/
virtual long ComputeContentSize();
virtual void ComputeContentPosition(float offsetX, float offsetY);
//! Enable a View.
/*!
Enable the view. The view cannot receive events. As for the rendering, each view handle
its own rendering while is enabled state.
*/
virtual void EnableView();
//! Disable a View.
/*!
Disable the view. The view cannot receive input events(keyboard, mouse, touch). As for the rendering, each view handle
its own rendering while is disabled state.
*/
virtual void DisableView();
//! Set the enable state of the view.
/*!
Set the enable state of the view.
@param enable. The state of the view to be set.
*/
virtual void SetEnableView(bool enable);
//! Gets the enable state of the View.
/*!
@return True if the view is active.
*/
bool IsViewEnabled() const;
public:
virtual void ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw);
//! Causes a redraw. The widget parameter draw_cmd_queued_ is set to true. The widget Draw() and DrawContent() are called.
/*!
Emits the signal \i queue_draw.
*/
virtual void QueueDraw();
//! Causes a soft redraw. The widget parameter draw_cmd_queued_ is set to false. The widget DrawContent() is called.
virtual void NeedSoftRedraw();
virtual bool IsRedrawNeeded();
virtual void DoneRedraw();
virtual void OverlayDrawing(GraphicsEngine & /* graphics_engine */) {}
//Layout Bridge
bool SearchInAllSubNodes(Area *bo);
bool SearchInFirstSubNodes(Area *bo);
/* void SetGeometry(int x, int y, int w, int h);*/
//! Set Geometry
/*
Set the Geometry of the View and the geometry of the Default Background Area.
For simple interface control UI classes(RGBValuator...), this is enough.
For others, they have to overwrite the function and do the appropriate computations
for their component.
*/
virtual void SetGeometry(const Geometry &geo);
//! Return true if this object can break the layout.
/*
Return true if this object can break the layout, meaning, the layout can be done on the composition layout only without
recomputing the whole window layout.
*/
virtual bool CanBreakLayout()
{
return false;
}
virtual void SetTextColor(const Color &color);
virtual Color GetTextColor() const;
//! Get the default layout of this view.
/*!
Get the default layout of this view.
@return The default layout of this view.
*/
virtual Layout* GetLayout();
//! Set the default layout for this view.
/*!
Set the default layout for this view. Assigns a scale factor of 1 to the layout.
@param layout A Layout object.
*/
virtual bool SetLayout(Layout *layout);
sigc::signal<void, View*, Layout*> LayoutAdded;
sigc::signal<void, View*, Layout*> LayoutRemoved;
void SetFont(ObjectPtr<FontTexture> font);
ObjectPtr<FontTexture> GetFont();
sigc::signal<void, View*> queue_draw; //!< Signal emitted when a view is scheduled for a draw.
sigc::signal<void, Area*> child_queue_draw; //!< Signal emitted when a child of this view is scheduled for a draw.
virtual Area* KeyNavIteration(KeyNavDirection direction);
virtual bool AcceptKeyNavFocus();
virtual Area* FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type);
virtual Area* FindKeyFocusArea(unsigned int key_symbol,
unsigned long x11_key_code,
unsigned long special_keys_state);
#ifdef NUX_GESTURES_SUPPORT
virtual Area* GetInputAreaHitByGesture(const nux::GestureEvent &event);
#endif
protected:
virtual void ChildViewQueuedDraw(Area* area);
void BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);
void EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);
void OnChildFocusChanged(/*Area *parent,*/ Area *child);
sigc::connection _on_focus_changed_handler;
virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw) = 0;
virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw);
virtual void PreLayoutManagement();
virtual long PostLayoutManagement(long LayoutResult);
virtual void PreResizeGeometry();
virtual void PostResizeGeometry();
void InitializeWidgets();
void InitializeLayout();
Color m_TextColor;
//! Deprecated. Use GetLayout();
virtual Layout* GetCompositionLayout();
//! Deprecated. Use SetLayout();
virtual bool SetCompositionLayout(Layout *layout);
void RemoveLayout();
void RemoveCompositionLayout();
/*!
Accessed inside ContentDraw() to help determine if some parts needs to be rendered.
Do not use it elsewhere.
@return True if Draw() was called before ContentDraw().
*/
bool IsFullRedraw() const;
virtual void GeometryChangePending(bool position_about_to_change, bool size_about_to_change);
virtual void GeometryChanged(bool position_has_changed, bool size_has_changed);
Layout *view_layout_;
bool draw_cmd_queued_; //<! The rendering of the view needs to be refreshed.
bool child_draw_cmd_queued_; //<! A child of this view has requested a draw.
bool full_view_draw_cmd_; //<! True if Draw is called before ContentDraw. It is read-only and can be accessed by calling IsFullRedraw();
private:
ObjectPtr<FontTexture> _font;
friend class WindowCompositor;
friend class Layout;
friend class Area;
friend class LayeredLayout;
friend class Canvas;
friend class VSplitter;
friend class HSplitter;
};
}
#endif // ABSTRACTOBJECTBASE_H
|