Labyrinth
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
containerwindow.hpp
1 //////////////////////////////
2 //
3 // File: lxs/windowing/containerwindow.hpp
4 // Author: Maciej Kaminski
5 // E-mail: maciej.a.kaminski@gmail.com
6 // Website: maciejkaminski.pl
7 //
8 // File creation date: Oct 24 2012
9 // This file is part of Project Labyrinth
10 // This file is going to be released under terms of GNU GPL in near future
11 //
12 //////////////////////////////
13 
14 #ifndef __LXS_CONTAIN_WINDOW__
15 #define __LXS_CONTAIN_WINDOW__
16 #include "lxs/windowing/window.hpp"
17 namespace LxS
18 {
19  namespace Windowing
20  {
21  //! window that contains multiple window
22  class ContainerWindow: public Window
23  {
24  //! x coordinate of previous mouse/touch interaction
25  float prev_x;
26  //! y coordinate of previous mouse/touch interaction
27  float prev_y;
28  protected:
29  //! which subwindow may be clicked?
31  //! typedef of pointer to window
32  typedef Window* childdata;
33  //! typedef for vector of contained windows
34  typedef std::vector<childdata> childvector;
35  //! windows within this window
37  public:
38  //! remove all children
39  virtual void EraseChildren();
40  //! attach child - first to be drawn, first on auto-generated layouts
41  virtual void AttachChildAtFront(Window * child);
42  //! attach child at end
43  virtual void AttachChild(Window * child);
44  //! detach particular child
45  virtual void DetachChild(Window * child);
46  virtual void OnFocus();
47  //! replace child. new is emplaced at position right before old one
48  virtual void ReplaceChild(Window * old_child, Window * new_child);
49  void MovementHandler();
50  void ResizeHandler();
51  //! constructor
52  ContainerWindow() {clicked=0; prev_y=0, prev_x=0;}
53  virtual void Render(Rendermode mode);
54  void SaveFile();
55  virtual void Animate(float dt);
56  virtual void Clicked(float x, float y);
57  virtual void Released(float x, float y);
58  virtual void Dragged(float x, float y);
59  virtual void DraggedAngle(float x, float y);
60  virtual unsigned long GetTexelsCount();
61  virtual unsigned long GetFacesCount();
62  void Initialize();
63  void UnloadResources();
64  virtual void Refresh();
65  virtual ~ContainerWindow() {UnloadResources();}
66  };
67  }
68 }
69 #endif