File: display.h

package info (click to toggle)
vdr-plugin-osdteletext 0.9.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 684 kB
  • sloc: ansic: 9,963; makefile: 59; sh: 14
file content (114 lines) | stat: -rw-r--r-- 4,399 bytes parent folder | download | duplicates (2)
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
109
110
111
112
113
114
/*************************************************************** -*- c++ -*-
 *                                                                         *
 *   display.h - Actual implementation of OSD display variants and         *
 *               Display:: namespace that encapsulates a single cDisplay.  *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   Changelog:                                                            *
 *     2005-03    initial version (c) Udo Richter                          *
 *                                                                         *
 ***************************************************************************/

#ifndef OSDTELETEXT_DISPLAY_H_
#define OSDTELETEXT_DISPLAY_H_

#include "displaybase.h"
#include <vdr/osd.h>

namespace Display {
    // The Display:: namespace mainly encapsulates a cDisplay *display variable
    // and allows NULL-safe access to display members.
    // Additionally, selects via mode the actually used instance for *display.

    enum Mode { Full, HalfUpper, HalfLower };
    // Full mode: 2BPP or 4BPP full screen display, depending on memory constrains
    // HalfUpper: 4BPP display of upper half, drop lower half if out of memory
    // HalfLower: 4BPP display of lower half, drop upper half if out of memory

    extern Mode mode;
    extern cDisplay *display;

    // Access to display mode:
    void SetMode(Display::Mode mode);
    inline void Delete()
        { if (display) { DELETENULL(display); } }

    void ShowUpperHalf();
    // Make sure the upper half of screen is visible
    // eg. for entering numbers etc.


    // Wrapper calls for various *display members:
    inline bool GetBlink()
        { if (display) return display->GetBlink(); else return false; }
    inline bool SetBlink(bool blink)
        { if (display) display->SetBlink(blink); else return false; }
    inline bool GetConceal()
        { if (display) return display->GetConceal(); else return false; }
    inline bool SetConceal(bool conceal)
        { if (display) display->SetConceal(conceal); else return false; }
    inline cDisplay::enumZoom GetZoom()
        { if (display) return display->GetZoom(); else return cDisplay::Zoom_Off; }
    inline void SetZoom(cDisplay::enumZoom zoom)
        { if (display) display->SetZoom(zoom); }

    inline void SetBackgroundColor(tColor c)
        { if (display) display->SetBackgroundColor(c); }

    inline tColor GetBackgroundColor()
        { if (display) return display->GetBackgroundColor(); else return 0; }

    inline void HoldFlush()
        { if (display) display->HoldFlush(); }
    inline void ReleaseFlush()
        { if (display) display->ReleaseFlush(); }

    inline void RenderTeletextCode(unsigned char *PageCode)
        { if (display) display->RenderTeletextCode(PageCode); }

    inline void DrawClock()
        { if (display) display->DrawClock(); }
    inline void DrawPageId(const char *text)
        { if (display) display->DrawPageId(text); }
    inline void DrawMessage(const char *txt)
        { if (display) display->DrawMessage(txt); }
    inline void ClearMessage()
        { if (display) display->ClearMessage(); }
}


class cDisplay32BPP : public cDisplay {
    // True Color OSD display
    // No need for color mapping
    // Uses cPixmap instead of cBitmap
public:
    cDisplay32BPP(int x0, int y0, int width, int height);
};



class cDisplay32BPPHalf : public cDisplay {
    // 32BPP (true color) OSD display with auto size reduction on memory constrains
    // Automatically tries to make visible area as big as possible
    // No need for color mapping
    bool Upper;
    // Prefer to show upper half or lower half?

    int OsdX0,OsdY0;
    // Needed to re-initialize osd

public:
    cDisplay32BPPHalf(int x0, int y0, int width, int height, bool upper);
    bool GetUpper() { return Upper; }
    void SetUpper(bool upper)
        { if (Upper!=upper) { Upper=upper; InitOSD(); } }
protected:
    void InitOSD();
};


#endif