aboutsummaryrefslogtreecommitdiff
path: root/display.h
blob: 5c1ce59be979ac7994fe2e25940e44a0ebc1ed7f (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
/*
 * Copyright 2010, Intel Corporation
 *
 * This file is part of PowerTOP
 *
 * This program file 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; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program in a file named COPYING; if not, write to the
 * Free Software Foundation, Inc,
 * 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 * or just google for it.
 *
 * Authors:
 *	Arjan van de Ven <arjan@linux.intel.com>
 */
#ifndef __INCLUDE_GUARD_DISPLAY_H_
#define __INCLUDE_GUARD_DISPLAY_H_


#include <map>
#include <string>
#include <ncurses.h>

using namespace std;

extern void init_display(void);
extern void reset_display(void);
extern int ncurses_initialized(void);
extern void show_tab(unsigned int tab);
extern void show_next_tab(void);
extern void show_prev_tab(void);
extern void show_cur_tab(void);
extern void cursor_up(void);
extern void cursor_down(void);
extern void cursor_enter(void);

class tab_window {
public:
	int cursor_pos;
	int cursor_max;
	WINDOW *win;
	
	virtual void cursor_down(void) { if (cursor_pos < cursor_max ) cursor_pos++; repaint(); } ;
	virtual void cursor_up(void) { if (cursor_pos > 0) cursor_pos--; repaint(); };

	virtual void cursor_enter(void) { };

	virtual void repaint(void) { };
	virtual void expose(void) { cursor_pos = 0; repaint();};
	virtual void hide(void) { };
};

extern map<string, class tab_window *> tab_windows;

WINDOW *get_ncurses_win(const char *name);
WINDOW *get_ncurses_win(const string &name);
WINDOW *get_ncurses_win(int nr);

void create_tab(const string &name, const string &translation, class tab_window *w = NULL, string bottom_line = "");


#endif