summaryrefslogtreecommitdiffstats
path: root/ksirc/KSTicker/ksticker.h
blob: d11d8a0f6ee3f0db90a8c8b5cf798fa44e927f1c (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
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
#ifndef KSTICKER_H
#define KSTICKER_H

#include <qobject.h>
#include <qframe.h>
#include <qstring.h>
#include <qptrlist.h>
#include <qpopupmenu.h>

class SInfo {
public:
  int length;
};

class KSTicker : public QFrame
{
  Q_OBJECT

public:
  KSTicker(QWidget * parent=0, const char * name=0, WFlags f=0);
  virtual ~KSTicker();

  void setString(QString);
  void mergeString(QString);
  void mergeString(QString, QColor);

  virtual void show();
  virtual void hide();

  void speed(int *, int *);

  virtual void setBackgroundColor ( const QColor & );
  virtual void setPalette ( const QPalette & p );

signals:
  void doubleClick();
  void closing();

public slots:
  virtual void setSpeed(int, int);

protected slots:
  virtual void fontSelector();
  virtual void scrollRate();
  virtual void updateFont(const QFont &font);
  virtual void scrollConstantly();

protected:
  virtual void timerEvent ( QTimerEvent * );
  virtual void paintEvent ( QPaintEvent * );
  virtual void resizeEvent( QResizeEvent * );
  virtual void closeEvent( QCloseEvent * );
  virtual void mouseDoubleClickEvent( QMouseEvent * );
  virtual void mousePressEvent ( QMouseEvent * );
  virtual void iconify();


private:

    QString stripCols(QString);

    QStringList strlist;   /* everything left to parse */
    QStringList strbuffer; /* fifo of the last 10 lines to scroll in scroll constantly mode */
    QStringList tipbuffer; /* 5 lines for the tooltip */
    QString currentStr;   /* the string we are currently parsing */

    QFont ourFont;

    int onechar;
    int chars;
    int descent;

    int tickStep;
    int cOffset;

    int tickRate;

    int pHeight;

    int currentChar;

    void startTicker();
    void stopTicker();

    bool bScrollConstantly;
    int iScrollItem;
    bool bAtEnd;

    QPixmap *pic;

    QPopupMenu *popup;

    /*
     * Drawing settings and variables
     */
    bool bold;
    bool underline;
    bool italics;
    QColor defbg;
    QColor deffg;
    QColor bg;
    QColor fg;
};

#endif // KSTICKER_H