nux-1.14.0
|
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: Neil Jagdish Patel <neil.patel@canonical.com> 00019 * 00020 */ 00021 00022 00023 #ifndef LAYERED_LAYOUT_H 00024 #define LAYERED_LAYOUT_H 00025 00026 #include "Layout.h" 00027 00028 namespace nux 00029 { 00031 00041 class LayeredLayout: public Layout 00042 { 00043 NUX_DECLARE_OBJECT_TYPE (LayeredLayout, Layout); 00044 00045 public: 00046 00047 typedef enum 00048 { 00049 INPUT_MODE_ACTIVE = 0, 00050 INPUT_MODE_COMPOSITE 00051 00052 } InputMode; 00053 00054 LayeredLayout (NUX_FILE_LINE_PROTO); 00055 ~LayeredLayout (); 00056 00058 00067 void AddLayer (Area *area, bool expand=true, int x=0, int y=0, int width=0, int height=0); 00068 00070 00079 void UpdateLayer (Area *area, bool expand=true, int x=0, int y=0, int width=0, int height=0); 00080 00082 00086 void RemoveLayer (Area *area); 00087 00089 00093 void SetActiveLayerN (int index_); 00094 00096 00100 int GetActiveLayerN (); 00101 00103 00107 void SetActiveLayer (Area *area); 00108 00110 00114 Area * GetActiveLayer (); 00115 00117 00123 void SetPaintAll (bool paint_all); 00124 00126 00130 bool GetPaintAll (); 00131 00133 00142 void SetInputMode (LayeredLayout::InputMode input_mode); 00143 00145 00150 void Raise (Area *area, Area *above); 00151 00153 00158 void Lower (Area *area, Area *below); 00159 00161 00165 void RaiseTop (Area *area); 00166 00168 00172 void LowerBottom (Area *area); 00173 00175 00179 LayeredLayout::InputMode GetInputMode (); 00180 00181 // 00182 // Overrides 00183 // 00184 long ComputeLayout2 (); 00185 void GetCompositeList (std::list<Area *> *ViewList); 00186 void ProcessDraw (GraphicsEngine &gfx_context, bool force_draw); 00187 Area* FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type); 00188 00189 void AddLayout (Layout *layouy, 00190 unsigned int stretch_factor = 1, 00191 MinorDimensionPosition position = eAbove, 00192 MinorDimensionSize extend = eFull, 00193 float percentage = 100.0f); 00194 void AddView (Area *view, 00195 unsigned int stretch_factor = 1, 00196 MinorDimensionPosition positioning = eAbove, 00197 MinorDimensionSize extend = eFull, 00198 float percentage = 100.0f); 00199 void RemoveChildObject (Area *area); 00200 void Clear (); 00201 00202 protected: 00203 virtual long DoFocusPrev (IEvent &ievent, long TraverseInfo, long ProcessEventInfo); 00204 virtual long DoFocusNext (IEvent &ievent, long TraverseInfo, long ProcessEventInfo); 00205 virtual bool FocusFirstChild (); 00206 virtual bool FocusLastChild (); 00207 00208 virtual Area* KeyNavIteration(KeyNavDirection direction); 00209 void OnLayerGeometryChanged(Area* area, Geometry geo); 00210 00211 private: 00212 void PaintOne (Area *area, GraphicsEngine &GfxContext, bool force_draw); 00213 void ChildQueueDraw (Area *area); 00214 void ChildVisibilityChanged (Area *area, bool visible); 00215 00216 private: 00217 int m_active_index; 00218 Area *m_active_area; 00219 bool m_paint_all; 00220 LayeredLayout::InputMode m_input_mode; 00221 bool m_child_draw_queued; 00222 }; 00223 } 00224 00225 #endif // LAYERED_LAYOUT_H