File: alignedtextblock.hh

package info (click to toggle)
dillo 3.0.5-7.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,560 kB
  • sloc: cpp: 33,618; ansic: 19,437; sh: 4,006; makefile: 561; perl: 131
file content (61 lines) | stat: -rw-r--r-- 1,443 bytes parent folder | download | duplicates (7)
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
57
58
59
60
61
#ifndef __DW_ALIGNEDTEXTBLOCK_HH__
#define __DW_ALIGNEDTEXTBLOCK_HH__

#include "core.hh"
#include "textblock.hh"

namespace dw {

/**
 * \brief Base widget for all textblocks (sub classes of dw::Textblock), which
 *    are positioned vertically and aligned horizontally.
 */
class AlignedTextblock: public Textblock
{
private:
   class List
   {
   private:
      lout::misc::SimpleVector <AlignedTextblock*> *textblocks;
      lout::misc::SimpleVector <int> *values;
      int maxValue, refCount;

      ~List ();

   public:
      List ();
      inline int add (AlignedTextblock *textblock);
      void unref (int pos);

      inline int getMaxValue () { return maxValue; }
      inline void setMaxValue (int maxValue) { this->maxValue = maxValue; }

      inline int size () { return textblocks->size (); }
      inline AlignedTextblock *getTextblock (int pos) {
         return textblocks->get (pos); }
      inline int getValue (int pos) {return values->get (pos); }
      inline void setValue (int pos, int value) {
         return values->set (pos, value); }
   };

   List *list;
   int listPos;

protected:
   AlignedTextblock(bool limitTextWidth);

   virtual int getValue () = 0;
   virtual void setMaxValue (int maxValue, int value) = 0;

   void setRefTextblock (AlignedTextblock *ref);
   void updateValue ();

public:
   static int CLASS_ID;

   ~AlignedTextblock();
};

} // namespace dw

#endif // __DW_ALIGNEDTEXTBLOCK_HH__