adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-commits] CVS: adonthell/src/gui layout.cc, NONE, 1.1 layout.h


From: VENNIN Joel <address@hidden>
Subject: [Adonthell-commits] CVS: adonthell/src/gui layout.cc, NONE, 1.1 layout.h, NONE, 1.1 listlayout.cc, NONE, 1.1 listlayout.h, NONE, 1.1 Makefile.am, 1.1, 1.2 base.cc, 1.1, 1.2 base.h, 1.1, 1.2 container.cc, 1.1, 1.2 container.h, 1.1, 1.2 gui.h, 1.1, 1.2
Date: Mon, 28 Jul 2003 13:05:09 -0400

Update of /cvsroot/adonthell/adonthell/src/gui
In directory subversions:/tmp/cvs-serv24284

Modified Files:
        Makefile.am base.cc base.h container.cc container.h gui.h 
Added Files:
        layout.cc layout.h listlayout.cc listlayout.h 
Log Message:
Add layout for container


--- NEW FILE ---
#include "gui/container.h"
#include "gui/layout.h"

using namespace gui;


layout::layout ()
{
  m_container = NULL;
}

bool layout::update ()
{
  return true;
}

void layout::setContainer (container * ct)
{
  m_container = ct;
  if (ct) update ();
}

--- NEW FILE ---
#ifndef GUI_LAYOUT_H_
#define GUI_LAYOUT_H_

namespace gui
{
  class container;
  
  class layout
    {
    public:
      layout ();
      
      virtual bool update ();
      
      void setContainer (container * ct);

    protected:

      container * m_container;
    };
}

#endif

--- NEW FILE ---
#include "gui/container.h"
#include "gui/listlayout.h"

using namespace gui;



listlayout::listlayout (): layout ()
{

}

bool listlayout::update ()
{
  if (m_container)
    {
      s_int16 nx = m_container->getPadX () + m_container->getSpaceBorder (), 
        ny =  m_container->getPadY () + m_container->getSpaceBorder ();
      for (ListChild::iterator i = m_container->getChilds ().begin (); 
           i != m_container->getChilds ().end (); ++i)
        {
          (*i)->setLocation (nx, ny);
          ny += (*i)->getHeight () + m_container->getSpaceChild ();
        }
      return true;
    }
  return false;
}

--- NEW FILE ---
#ifndef GUI_LISTLAYOUT_H_
#define GUI_LISTLAYOUT_H_

#include "gui/layout.h"

namespace gui
{
  class listlayout : public layout
    {
    public:
      listlayout ();
      
      bool update ();
      
    protected:

    };
}

#endif

Index: Makefile.am
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Makefile.am 28 Jul 2003 12:48:42 -0000      1.1
--- Makefile.am 28 Jul 2003 17:05:05 -0000      1.2
***************
*** 5,9 ****
  pkgincludeinput_HEADERS = \
        base.h \
!       container.h
  
  lib_LTLIBRARIES = libadonthell_gui.la
--- 5,10 ----
  pkgincludeinput_HEADERS = \
        base.h \
!       container.h \
!       layout.h listlayout.h
  
  lib_LTLIBRARIES = libadonthell_gui.la
***************
*** 11,15 ****
  libadonthell_gui_la_SOURCES = \
        base.cc \
!       container.cc
  
  libadonthell_gui_la_CXXFLAGS = -DPKGLIBDIR=\"$(pkglibdir)\"
--- 12,17 ----
  libadonthell_gui_la_SOURCES = \
        base.cc \
!       container.cc \
!       layout.cc listlayout.cc
  
  libadonthell_gui_la_CXXFLAGS = -DPKGLIBDIR=\"$(pkglibdir)\"

Index: base.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/base.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** base.cc     28 Jul 2003 12:48:42 -0000      1.1
--- base.cc     28 Jul 2003 17:05:05 -0000      1.2
***************
*** 1,2 ****
--- 1,4 ----
+ #include <iostream>
+ 
  #include "gfx/screen.h"
  #include "gfx/surface.h"
***************
*** 14,17 ****
--- 16,21 ----
    m_x = m_y = m_padx = m_pady = 0;
  
+   m_vertical_align = m_horizontal_align = base::ALIGN_NONE;
+ 
    m_visible = m_enable = true;
  }
***************
*** 95,100 ****
--- 99,122 ----
  }
  
+ void base::setVerticalAlign (u_int8 align)
+ {
+   m_vertical_align = align;
+   // TODO
+   std::cout << "setVerticalAlign:: TODO\n";
+ }
+ 
+ void base::setHorizontalAlign (u_int8 align)
+ {
+   m_horizontal_align = align;
+   // TODO
+   std::cout << "setHorizontalAlign:: TODO\n";
+ }
+ 
+ 
  base::~base ()
  {
    if (m_parent) m_parent->removeChild (this);
  }
+ 
+ 
+ 

Index: base.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/base.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** base.h      28 Jul 2003 12:48:42 -0000      1.1
--- base.h      28 Jul 2003 17:05:05 -0000      1.2
***************
*** 81,87 ****
--- 81,99 ----
        gfx::drawing_area * getParentDrawingArea ();
        
+ 
+       void setVerticalAlign ( u_int8 align);
        
+       void setHorizontalAlign ( u_int8 align);
+ 
        virtual ~base ();
        
+       /* Constant value */
+       static const u_int8 ALIGN_NONE = 0;
+       static const u_int8 ALIGN_LEFT = 1;
+       static const u_int8 ALIGN_RIGHT = 2;
+       static const u_int8 ALIGN_CENTER = 3;
+       static const u_int8 ALIGN_TOP = 4;
+       static const u_int8 ALIGN_BOTTOM = 5;
+ 
      protected:
        
***************
*** 93,96 ****
--- 105,112 ----
        
        s_int16 m_pady; // y padding
+ 
+       u_int8 m_vertical_align; // vertical alignment
+       
+       u_int8 m_horizontal_align; // horizontal alignment
        
        bool m_visible; //if the object is visible

Index: container.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/container.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** container.cc        28 Jul 2003 12:48:42 -0000      1.1
--- container.cc        28 Jul 2003 17:05:05 -0000      1.2
***************
*** 3,6 ****
--- 3,12 ----
  using namespace gui;
  
+ 
+ container::container () : base ()
+ {
+   m_layout = NULL;
+ }
+ 
  void container::addChild (base * m)
  {
***************
*** 41,44 ****
--- 47,51 ----
    // we can imagine a solution with a pluggable system
    // to set a specific manage
+   if (m_layout) m_layout->update ();
  }
  
***************
*** 66,72 ****
--- 73,100 ----
  
  
+ void container::setSpaceChild (s_int16 space)
+ {
+   m_space_child = space;
+   updateLayout ();
+ }
+ 
+ void container::setSpaceBorder (s_int16 space)
+ {
+   m_space_border = space;
+   updateLayout ();
+ }
+ 
  container::~container ()
  {
    destroyAll ();
    if (m_parent) m_parent->removeChild (this);
+   if (m_layout) delete m_layout;
+ }
+ 
+ void container::setLayout (layout * l)
+ {
+   if (m_layout) delete m_layout;
+   m_layout = l;
+   if (m_layout) m_layout->setContainer (this);
+   updateLayout ();
  }

Index: container.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/container.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** container.h 28 Jul 2003 12:48:42 -0000      1.1
--- container.h 28 Jul 2003 17:05:05 -0000      1.2
***************
*** 5,34 ****
  
  #include "gui/base.h"
! 
  
  namespace gui {
! 
    class container : public base
      {
      public:
!       
!       virtual void addChild (base * m);
  
        virtual void removeChild (base * m);
        
        virtual void updatePosition ();
        
!       virtual void updateLayout ();
  
        virtual bool drawContents ();
  
        void destroyAll ();
  
        virtual ~container ();
      protected:
        
-       typedef std::list <base * > ListChild;
        ListChild m_childs;
        
      };
  }
--- 5,56 ----
  
  #include "gui/base.h"
! #include "gui/layout.h"
  
  namespace gui {
!   
!   typedef std::list <base * > ListChild;
!   
    class container : public base
      {
      public:
!       container ();
  
+       virtual void addChild (base * m);
+       
        virtual void removeChild (base * m);
        
        virtual void updatePosition ();
        
!       void updateLayout ();
  
        virtual bool drawContents ();
  
+       void setSpaceChild (s_int16 space);
+       
+       s_int16 getSpaceChild ()
+       { return m_space_child; }
+       
+       s_int16 getSpaceBorder ()
+       { return m_space_border; }
+ 
+       void setSpaceBorder (s_int16 space);
+ 
+       void setLayout (layout * l);
+ 
        void destroyAll ();
  
+       ListChild & getChilds ()
+       { return m_childs; }
+ 
        virtual ~container ();
      protected:
+ 
+       layout * m_layout;
        
        ListChild m_childs;
        
+       s_int16 m_space_child; // space between each object
+ 
+       s_int16 m_space_border; // space between child and order of the 
container
      };
  }

Index: gui.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/gui.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** gui.h       28 Jul 2003 12:50:05 -0000      1.1
--- gui.h       28 Jul 2003 17:05:05 -0000      1.2
***************
*** 4,7 ****
--- 4,9 ----
  #include "gui/base.h"
  #include "gui/container.h"
+ #include "gui/layout.h"
+ #include "gui/listlayout.h"
  
  #endif





reply via email to

[Prev in Thread] Current Thread [Next in Thread]