File: koffsetcolumn.h

package info (click to toggle)
kdeutils 4%3A3.3.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 14,628 kB
  • ctags: 13,095
  • sloc: cpp: 95,511; sh: 9,030; perl: 2,786; ansic: 2,425; makefile: 931; lex: 302; xml: 287; yacc: 167
file content (108 lines) | stat: -rw-r--r-- 3,242 bytes parent folder | download
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/***************************************************************************
                          koffsetcolumn.h  -  description
                             -------------------
    begin                : Mit Mai 14 2003
    copyright            : (C) 2003 by Friedrich W. H. Kossebau
    email                : Friedrich.W.H@Kossebau.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This library is free software; you can redistribute it and/or         *
 *   modify it under the terms of the GNU Library General Public           *
 *   License version 2 as published by the Free Software Foundation.       *
 *                                                                         *
 ***************************************************************************/


#ifndef KHE_KOFFSETCOLUMN_H
#define KHE_KOFFSETCOLUMN_H

// lib specific
#include "koffsetformat.h"
#include "kcolumn.h"

namespace KHE
{

/**
  *@author Friedrich W. H. Kossebau
  */

class KOffsetColumn : public KColumn
{
  public:
    KOffsetColumn( KColumnsView *V, int FLO, int D, KOffsetFormat::KFormat F );
    virtual ~KOffsetColumn();

  public:  // KColumn API
    virtual void paintFirstLine( QPainter *P, KPixelX cx, KPixelX cw, int FirstLine );
    virtual void paintNextLine( QPainter *P );

  public:
    int firstLineOffset() const;
    void setFirstLineOffset( int FLO );

    int delta() const;
    void setDelta( int D );

    void setFormat( KOffsetFormat::KFormat F );
    /** sets width of digits and recalculates depend sizes  */
    void setDigitWidth( KPixelX DW );
    /** */
    void setMetrics( KPixelX DW, KPixelY DBL );

  public:
    int codingWidth()                      const;
    KOffsetFormat::print printFunction()   const;


  protected:
    /** recalculates all x values */
    void recalcX();
    /** paints full line */
    void paintLine( QPainter *P, int Line );


  protected: // user settings
    /** starting offset of the first line
      * if different from StartOffset results in leading space
      */
    int FirstLineOffset;
    /** offset delta per line */
    int Delta;

  protected: // pixel related
    /** size of the line margin */
    int Margin;
    /** */
    KPixelX DigitWidth;
    /** */
    KPixelY DigitBaseLine;

  protected: // general layout
    KOffsetFormat::KFormat Format;

    int CodingWidth;
    KOffsetFormat::print PrintFunction;

    /** buffer to hold the formatted coding */
    mutable char CodedOffset[KOffsetFormat::MaxFormatWidth+1];

  protected: // firstnext trips related
    /** */
    int PaintLine;
};


inline int KOffsetColumn::firstLineOffset()  const  { return FirstLineOffset; }
inline void KOffsetColumn::setFirstLineOffset( int FLO ) { FirstLineOffset = FLO; }
inline int KOffsetColumn::delta() const { return Delta; }
inline void KOffsetColumn::setDelta( int D )  { Delta = D; }

inline int KOffsetColumn::codingWidth()                       const { return CodingWidth; }
inline KOffsetFormat::print KOffsetColumn::printFunction()    const { return PrintFunction; }

}

#endif