aboutsummaryrefslogtreecommitdiff
path: root/test/dw_simple_container.hh
blob: bb1a37afb077965a35e0cebd9ae0319f6e23ae25 (plain)
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
#ifndef __DW_SIMPLE_CONTAINER_HH__
#define __DWR_SIMPLE_CONTAINER_HH__

#include "dw/core.hh"

namespace dw {

/**
 * Simple widget used for testing concepts.
 */
class SimpleContainer: public core::Widget
{
private:
   class SimpleContainerIterator: public core::Iterator
   {
   private:
      int index ();

   public:
      SimpleContainerIterator (SimpleContainer *simpleContainer,
                               core::Content::Type mask,
                      bool atEnd);

      lout::object::Object *clone ();
      int compareTo (lout::object::Comparable *other);

      bool next ();
      bool prev ();
      void highlight (int start, int end, core::HighlightLayer layer);
      void unhighlight (int direction, core::HighlightLayer layer);
      void getAllocation (int start, int end, core::Allocation *allocation);
   };

   Widget *child;

protected:
   void sizeRequestImpl (core::Requisition *requisition);
   void getExtremesImpl (core::Extremes *extremes);
   void sizeAllocateImpl (core::Allocation *allocation);

public:
   static int CLASS_ID;

   SimpleContainer ();
   ~SimpleContainer ();

   void draw (core::View *view, core::Rectangle *area);
   core::Iterator *iterator (core::Content::Type mask, bool atEnd);
   void removeChild (Widget *child);

   void setChild (core::Widget *child);
};

} // namespace dw

#endif // __DW_SIMPLE_CONTAINER_HH__