summaryrefslogtreecommitdiff
path: root/src/PSEditWidget.H
blob: e3c48863bcc255c2924e868f7131fe1b03fb3f05 (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
107
108
109
110
111
112
//
// Copyright 2007 Johannes Hofmann <Johannes.Hofmann@gmx.de>
//
// This software may be used and distributed according to the terms
// of the GNU General Public License, incorporated herein by reference.

#ifndef PSEditWidget_H
#define PSEditWidget_H

#include "GsWidget.H"
#include "PSEditModel.H"

typedef void (PSEditCallback)(); 

class PSText;

class PSEditWidget : public GsWidget {
	private:
		int cur_size;

		PSEditColor cur_text_color;

		int show_tags;

		int zoom_percent;

		PSEditCallback *property_changed_cb;

	protected:
		PSEditModel *model;

		int loaded;

		int mod;

		void clear_text();

		void draw();

	public: 
		PSEditWidget(int X,int Y,int W, int H);  

		int next();

		void new_text(int x1, int y1, const char *s, int p);

		void new_text(int x1, int y1, const char *s);

		int set_cur_text(int x1, int y1);

		int next_text();

		void append_text(const char *s);

		void move(int x1, int y1);

		void rel_move(int dx, int dy);

		void rm_char();

		int reload();

		void set_size(int s);

		int get_size();

		void set_color(const PSEditColor *c);

		void get_color(PSEditColor *c);

		int get_max_pages();

		char *get_tag();

		int set_tag(const char *t);

		int get_show_tags();

		void set_show_tags(int s);

		PSText * get_text(int p);

		int modified();

		int file_loaded();

		int replace_tag(char* tag, char* text);

		int zoom(int p);

		void property_changed_callback(PSEditCallback *cb) {
			property_changed_cb = cb;};

	private:
		int bb_x(PSEditText *t);

		int bb_y(PSEditText *t);

		int bb_w(PSEditText *t);

		int bb_h(PSEditText *t);

		int ps_to_display_x(int x1);

		int ps_to_display_y(int y1);

		int ps_x(int x1);

		int ps_y(int y1);
};

#endif