nux-0.9.46

Nux/LayeredLayout.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: 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     long ProcessEvent (IEvent &ievent, long traverse_info, long process_event_info);
00188     void AddLayout (Layout                *layouy,
00189                     unsigned int           stretch_factor = 1,
00190                     MinorDimensionPosition position       = eAbove,
00191                     MinorDimensionSize     extend         = eFull,
00192                     float                  percentage     = 100.0f);
00193     void AddView (Area                  *view,
00194                   unsigned int           stretch_factor = 1,
00195                   MinorDimensionPosition positioning    = eAbove,
00196                   MinorDimensionSize     extend         = eFull,
00197                   float                  percentage     = 100.0f);
00198     void RemoveChildObject (Area *area);
00199     void Clear ();
00200 
00201   protected:
00202     virtual long DoFocusPrev  (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
00203     virtual long DoFocusNext (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
00204     virtual bool FocusFirstChild ();
00205     virtual bool FocusLastChild ();
00206     
00207   private:
00208     void PaintOne (Area *area, GraphicsEngine &GfxContext, bool force_draw);
00209     long ProcessOne (Area *_area, IEvent &ievent, long traverse_info, long process_event_info);
00210     void ChildQueueDraw (Area *area);
00211     void ChildVisibilityChanged (Area *area, bool visible);
00212     
00213   private:
00214     int                      m_active_index;
00215     Area                    *m_active_area;
00216     bool                     m_paint_all;
00217     LayeredLayout::InputMode m_input_mode;
00218     bool                     m_child_draw_queued;
00219   };
00220 }
00221 
00222 #endif // LAYERED_LAYOUT_H