summaryrefslogtreecommitdiff
path: root/scroller.h
blob: dae6cf2dc57b4579f4ce8661d4e6de51432c815b (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
/*
 *  $Id: scroller.h,v 1.1.1.1 2004/11/19 16:45:31 lordjaxom Exp $
 */

#ifndef VDR_TEXT2SKIN_SCROLLER_H
#define VDR_TEXT2SKIN_SCROLLER_H

#include "common.h"
#include <vdr/font.h>

class cText2SkinScreen;

class cText2SkinScroller {
private:
  cText2SkinScreen *mScreen;
  const cFont      *mFont;
  int               mLeft;
	int               mTop;
	int               mWidth;
	int               mHeight;
  int               mOffset;
	int               mShown;
  tColor            mColorFg;
	tColor            mColorBg;
  cTextWrapper      mWrapper;

public:
  cText2SkinScroller(void);
  cText2SkinScroller(cText2SkinScreen *Screen, int Left, int Top, int Width, int Height, const char *Text, const cFont *Font, tColor ColorFg, tColor ColorBg);

  void Set(cText2SkinScreen *Screen, int Left, int Top, int Width, int Height, const char *Text, const cFont *Font, tColor ColorFg, tColor ColorBg);
  void DrawText(void);
  void Reset(void);
  int Left(void) { return mLeft; }
  int Top(void) { return mTop; }
  int Width(void) { return mWidth; }
  int Height(void) { return mHeight; }
  int Total(void) { return mWrapper.Lines(); }
  int Offset(void) { return mOffset; }
  int Shown(void) { return mShown; }
  bool CanScroll(void) { return CanScrollUp() || CanScrollDown(); }
  bool CanScrollUp(void) { return mOffset > 0; }
  bool CanScrollDown(void) { return mOffset + mShown < Total(); }
  void Scroll(bool Up, bool Page);
};

#endif // VDR_TEXT2SKIN_SCROLLER_H